about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorHasan Ali <hasan@hasali.dev>2022-06-06 08:51:50 +0100
committerHasan Ali <hasan@hasali.dev>2022-06-06 08:51:50 +0100
commit213fe5755c4145ae50cf78233ae46b0f8da55c84 (patch)
treea6159bdf21445d1ed53c981d9ccdae9c2ddbc6c7 /editors/code/src
parent92241d65aed0b2908e15c7b4baa2992bba28b260 (diff)
downloadrust-213fe5755c4145ae50cf78233ae46b0f8da55c84.tar.gz
rust-213fe5755c4145ae50cf78233ae46b0f8da55c84.zip
Add restartServerOnConfigChange setting
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/config.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 498defa4cb6..c9ca235ed5f 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") {