Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #14678 - Veykril:restart-server, r=Veykril
fix: Fix restart server button trying to start instead of restart the server
bors 2023-04-29
parent 3ad835f · parent cf8f13b · commit 370b72c
-rw-r--r--crates/hir-def/src/nameres/collector.rs2
-rw-r--r--editors/code/package.json4
-rw-r--r--editors/code/src/config.ts5
-rw-r--r--editors/code/src/ctx.ts4
-rw-r--r--editors/code/src/main.ts4
5 files changed, 9 insertions, 10 deletions
diff --git a/crates/hir-def/src/nameres/collector.rs b/crates/hir-def/src/nameres/collector.rs
index 51879dd555..05d49ee814 100644
--- a/crates/hir-def/src/nameres/collector.rs
+++ b/crates/hir-def/src/nameres/collector.rs
@@ -1874,7 +1874,6 @@ impl ModCollector<'_, '_> {
let vis = def_map
.resolve_visibility(self.def_collector.db, self.module_id, visibility, false)
.unwrap_or(Visibility::Public);
- let modules = &mut def_map.modules;
let origin = match definition {
None => ModuleOrigin::Inline {
definition: declaration,
@@ -1888,6 +1887,7 @@ impl ModCollector<'_, '_> {
},
};
+ let modules = &mut def_map.modules;
let res = modules.alloc(ModuleData::new(origin, vis));
modules[res].parent = Some(self.module_id);
for (name, mac) in modules[self.module_id].scope.collect_legacy_macros() {
diff --git a/editors/code/package.json b/editors/code/package.json
index c164595aff..79e2c62e82 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -211,7 +211,7 @@
"category": "rust-analyzer"
},
{
- "command": "rust-analyzer.reload",
+ "command": "rust-analyzer.restartServer",
"title": "Restart server",
"category": "rust-analyzer"
},
@@ -1909,7 +1909,7 @@
"when": "inRustProject"
},
{
- "command": "rust-analyzer.reload",
+ "command": "rust-analyzer.restartServer",
"when": "inRustProject"
},
{
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index da7c74c28b..d6b8cc7a56 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -21,7 +21,6 @@ export class Config {
"serverPath",
"server",
"files",
- "lens", // works as lens.*
].map((opt) => `${this.rootSection}.${opt}`);
readonly package: {
@@ -70,7 +69,7 @@ export class Config {
if (!requiresReloadOpt) return;
if (this.restartServerOnConfigChange) {
- await vscode.commands.executeCommand("rust-analyzer.reload");
+ await vscode.commands.executeCommand("rust-analyzer.restartServer");
return;
}
@@ -78,7 +77,7 @@ export class Config {
const userResponse = await vscode.window.showInformationMessage(message, "Restart now");
if (userResponse) {
- const command = "rust-analyzer.reload";
+ const command = "rust-analyzer.restartServer";
await vscode.commands.executeCommand(command);
}
}
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index 0ffa42c2a5..567b9216bc 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -390,7 +390,9 @@ export class Ctx {
statusBar.tooltip.appendMarkdown(
"\n\n[Rebuild Proc Macros](command:rust-analyzer.rebuildProcMacros)"
);
- statusBar.tooltip.appendMarkdown("\n\n[Restart server](command:rust-analyzer.startServer)");
+ statusBar.tooltip.appendMarkdown(
+ "\n\n[Restart server](command:rust-analyzer.restartServer)"
+ );
statusBar.tooltip.appendMarkdown("\n\n[Stop server](command:rust-analyzer.stopServer)");
if (!status.quiescent) icon = "$(sync~spin) ";
statusBar.text = `${icon}rust-analyzer`;
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index de40f99e00..6c990f804b 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -120,13 +120,11 @@ function createCommands(): Record<string, CommandFactory> {
enabled: commands.onEnter,
disabled: (_) => () => vscode.commands.executeCommand("default:type", { text: "\n" }),
},
- reload: {
+ restartServer: {
enabled: (ctx) => async () => {
- void vscode.window.showInformationMessage("Reloading rust-analyzer...");
await ctx.restart();
},
disabled: (ctx) => async () => {
- void vscode.window.showInformationMessage("Reloading rust-analyzer...");
await ctx.start();
},
},