mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
Add restartServerOnConfigChange setting
This commit is contained in:
parent
92241d65ae
commit
213fe5755c
2 changed files with 21 additions and 1 deletions
|
@ -1115,6 +1115,11 @@
|
|||
"Search in current workspace and dependencies."
|
||||
]
|
||||
},
|
||||
"rust-analyzer.restartServerOnConfigChange": {
|
||||
"markdownDescription": "Whether to restart the server automatically when certain settings that require a restart are changed.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"$generated-end": {}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -60,7 +60,18 @@ export class Config {
|
|||
|
||||
if (!requiresReloadOpt) return;
|
||||
|
||||
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") {
|
||||
|
|
Loading…
Reference in a new issue