From c6219a5486de24215a4997d812ae6e41f91d1e6d Mon Sep 17 00:00:00 2001 From: Greg Miller Date: Tue, 15 Sep 2026 14:30:37 -0400 Subject: [PATCH] fix: restore the server binary check broken by rust-lang/rust-analyzer#18281 `isValidExecutable` was synchronous until rust-lang/rust-analyzer#18281 made it `async` without updating its only caller. `!isValidExecutable(...)` has negated a Promise ever since, which is never false, so the check has silently done nothing for about 2 years. A bad `rust-analyzer.server.path` therefore failed with Cannot activate rust-analyzer extension: undefined naming neither the binary nor the setting, because vscode-languageclient rejects with a string rather than an Error. The probe command still runs and still logs a warning with the real reason. Also fixed some string messages that were hidden by the dead check: - missing space after `--version.`, plus a run of indentation pulled in by a line continuation inside the template literal - the bootstrap notification and the `trace.extension` deprecation message both pointed at `OUTPUT > Rust Analyzer Client`, which is now called `rust-analyzer Extension` This restores the behaviour from before that change, which I think is desirable. However, there are two (somewhat uncommon, IMO) things that can start failing _again_ as a result of restoring this behavior: - a `server.path` that does not exit 0 on `--version`, even if it speaks LSP fine. Yesterday that would log the warning and continue, and would work fine. Now it will give an error, which is probably what was originally intended there. - a relative `server.path`, since the probe runs in the extension host's working directory while the server is launched in the workspace folder. --- editors/code/package.json | 2 +- editors/code/src/bootstrap.ts | 6 +++--- editors/code/src/ctx.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/editors/code/package.json b/editors/code/package.json index 4d523c8cc6e0..83a987e1d443 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -695,7 +695,7 @@ }, "rust-analyzer.trace.extension": { "description": "Enable logging of VS Code extensions itself.", - "markdownDeprecationMessage": "Log level is now controlled by the [Developer: Set Log Level...](command:workbench.action.setLogLevel) command.You can set the log level for the current session and also the default log level from there. This is also available by clicking the gear icon on the OUTPUT tab when Rust Analyzer Client is visible or by passing the --log rust-lang.rust-analyzer:debug parameter to VS Code.", + "markdownDeprecationMessage": "Log level is now controlled by the [Developer: Set Log Level...](command:workbench.action.setLogLevel) command. You can set the log level for the current session and also the default log level from there. This is also available by clicking the gear icon on the OUTPUT tab when rust-analyzer Extension is visible or by passing the --log rust-lang.rust-analyzer:debug parameter to VS Code.", "type": "boolean", "default": false } diff --git a/editors/code/src/bootstrap.ts b/editors/code/src/bootstrap.ts index 440f21cbe3c5..5a5ddab155d4 100644 --- a/editors/code/src/bootstrap.ts +++ b/editors/code/src/bootstrap.ts @@ -21,12 +21,12 @@ export async function bootstrap( log.info("Using server binary at", path); - if (!isValidExecutable(path, config.serverExtraEnv)) { + if (!(await isValidExecutable(path, config.serverExtraEnv))) { throw new Error( `Failed to execute ${path} --version.` + (config.serverPath - ? `\`config.server.path\` or \`config.serverPath\` has been set explicitly.\ - Consider removing this config or making a valid server binary available at that path.` + ? ` \`config.server.path\` or \`config.serverPath\` has been set explicitly.` + + ` Consider removing this config or making a valid server binary available at that path.` : ""), ); } diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index e07fbb8bead6..c6e20259399d 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -287,9 +287,9 @@ export class Ctx implements RustAnalyzerExtensionApi { let message = "bootstrap error. "; message += - 'See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically).'; + 'See the logs in "OUTPUT > rust-analyzer Extension" (should open automatically).'; message += - 'To enable verbose logs, click the gear icon in the "OUTPUT" tab and select "Debug".'; + ' To enable verbose logs, click the gear icon in the "OUTPUT" tab and select "Debug".'; log.error("Bootstrap error", err); throw new Error(message);