Skip to content

Commit 370b72c

Browse files
committed
Auto merge of rust-lang#14678 - Veykril:restart-server, r=Veykril
fix: Fix restart server button trying to start instead of restart the server
2 parents 3ad835f + cf8f13b commit 370b72c

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

crates/hir-def/src/nameres/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,6 @@ impl ModCollector<'_, '_> {
18741874
let vis = def_map
18751875
.resolve_visibility(self.def_collector.db, self.module_id, visibility, false)
18761876
.unwrap_or(Visibility::Public);
1877-
let modules = &mut def_map.modules;
18781877
let origin = match definition {
18791878
None => ModuleOrigin::Inline {
18801879
definition: declaration,
@@ -1888,6 +1887,7 @@ impl ModCollector<'_, '_> {
18881887
},
18891888
};
18901889

1890+
let modules = &mut def_map.modules;
18911891
let res = modules.alloc(ModuleData::new(origin, vis));
18921892
modules[res].parent = Some(self.module_id);
18931893
for (name, mac) in modules[self.module_id].scope.collect_legacy_macros() {

editors/code/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
"category": "rust-analyzer"
212212
},
213213
{
214-
"command": "rust-analyzer.reload",
214+
"command": "rust-analyzer.restartServer",
215215
"title": "Restart server",
216216
"category": "rust-analyzer"
217217
},
@@ -1909,7 +1909,7 @@
19091909
"when": "inRustProject"
19101910
},
19111911
{
1912-
"command": "rust-analyzer.reload",
1912+
"command": "rust-analyzer.restartServer",
19131913
"when": "inRustProject"
19141914
},
19151915
{

editors/code/src/config.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export class Config {
2121
"serverPath",
2222
"server",
2323
"files",
24-
"lens", // works as lens.*
2524
].map((opt) => `${this.rootSection}.${opt}`);
2625

2726
readonly package: {
@@ -70,15 +69,15 @@ export class Config {
7069
if (!requiresReloadOpt) return;
7170

7271
if (this.restartServerOnConfigChange) {
73-
await vscode.commands.executeCommand("rust-analyzer.reload");
72+
await vscode.commands.executeCommand("rust-analyzer.restartServer");
7473
return;
7574
}
7675

7776
const message = `Changing "${requiresReloadOpt}" requires a server restart`;
7877
const userResponse = await vscode.window.showInformationMessage(message, "Restart now");
7978

8079
if (userResponse) {
81-
const command = "rust-analyzer.reload";
80+
const command = "rust-analyzer.restartServer";
8281
await vscode.commands.executeCommand(command);
8382
}
8483
}

editors/code/src/ctx.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ export class Ctx {
390390
statusBar.tooltip.appendMarkdown(
391391
"\n\n[Rebuild Proc Macros](command:rust-analyzer.rebuildProcMacros)"
392392
);
393-
statusBar.tooltip.appendMarkdown("\n\n[Restart server](command:rust-analyzer.startServer)");
393+
statusBar.tooltip.appendMarkdown(
394+
"\n\n[Restart server](command:rust-analyzer.restartServer)"
395+
);
394396
statusBar.tooltip.appendMarkdown("\n\n[Stop server](command:rust-analyzer.stopServer)");
395397
if (!status.quiescent) icon = "$(sync~spin) ";
396398
statusBar.text = `${icon}rust-analyzer`;

editors/code/src/main.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,11 @@ function createCommands(): Record<string, CommandFactory> {
120120
enabled: commands.onEnter,
121121
disabled: (_) => () => vscode.commands.executeCommand("default:type", { text: "\n" }),
122122
},
123-
reload: {
123+
restartServer: {
124124
enabled: (ctx) => async () => {
125-
void vscode.window.showInformationMessage("Reloading rust-analyzer...");
126125
await ctx.restart();
127126
},
128127
disabled: (ctx) => async () => {
129-
void vscode.window.showInformationMessage("Reloading rust-analyzer...");
130128
await ctx.start();
131129
},
132130
},

0 commit comments

Comments
 (0)