File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 11151115 " Search in current workspace and dependencies."
11161116 ]
11171117 },
1118+ "rust-analyzer.restartServerOnConfigChange" : {
1119+ "markdownDescription" : " Whether to restart the server automatically when certain settings that require a restart are changed." ,
1120+ "default" : false ,
1121+ "type" : " boolean"
1122+ },
11181123 "$generated-end" : {}
11191124 }
11201125 },
Original file line number Diff line number Diff line change @@ -60,7 +60,18 @@ export class Config {
6060
6161 if ( ! requiresReloadOpt ) return ;
6262
63- await vscode . commands . executeCommand ( "rust-analyzer.reload" ) ;
63+ if ( this . restartServerOnConfigChange ) {
64+ await vscode . commands . executeCommand ( "rust-analyzer.reload" ) ;
65+ } else {
66+ const userResponse = await vscode . window . showInformationMessage (
67+ `Changing "${ requiresReloadOpt } " requires a reload` ,
68+ "Reload now"
69+ ) ;
70+
71+ if ( userResponse === "Reload now" ) {
72+ await vscode . commands . executeCommand ( "rust-analyzer.reload" ) ;
73+ }
74+ }
6475 }
6576
6677 // We don't do runtime config validation here for simplicity. More on stackoverflow:
@@ -112,6 +123,10 @@ export class Config {
112123 return this . get < RunnableEnvCfg > ( "runnableEnv" ) ;
113124 }
114125
126+ get restartServerOnConfigChange ( ) {
127+ return this . get < boolean > ( "restartServerOnConfigChange" ) ;
128+ }
129+
115130 get debug ( ) {
116131 let sourceFileMap = this . get < Record < string , string > | "auto" > ( "debug.sourceFileMap" ) ;
117132 if ( sourceFileMap !== "auto" ) {
You can’t perform that action at this time.
0 commit comments