Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/config.ts')
| -rw-r--r-- | editors/code/src/config.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 498defa4cb..c9ca235ed5 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -60,7 +60,18 @@ export class Config { if (!requiresReloadOpt) return; - await vscode.commands.executeCommand("rust-analyzer.reload"); + if (this.restartServerOnConfigChange) { + await vscode.commands.executeCommand("rust-analyzer.reload"); + } else { + const userResponse = await vscode.window.showInformationMessage( + `Changing "${requiresReloadOpt}" requires a reload`, + "Reload now" + ); + + if (userResponse === "Reload now") { + await vscode.commands.executeCommand("rust-analyzer.reload"); + } + } } // We don't do runtime config validation here for simplicity. More on stackoverflow: @@ -112,6 +123,10 @@ export class Config { return this.get<RunnableEnvCfg>("runnableEnv"); } + get restartServerOnConfigChange() { + return this.get<boolean>("restartServerOnConfigChange"); + } + get debug() { let sourceFileMap = this.get<Record<string, string> | "auto">("debug.sourceFileMap"); if (sourceFileMap !== "auto") { |