Skip to content

Commit 2da06c1

Browse files
bors[bot]rylev
andauthored
Merge #9771
9771: Give better error message when the rust-analyzer binary path was set in the user's config but the binary is invalid r=matklad a=rylev `@yoshuawuyts` and I ran into an issue where my rust-analyzer binary path was set in my extension config (which I didn't realize), but the path set in the config was invalid (it simply wasn't on my path). Having an error message that hinted that the binary's path was explicitly set in the config would have considerably shortened the debug time. Thanks! Co-authored-by: Ryan Levick <me@ryanlevick.com>
2 parents ffbb43f + ac50e35 commit 2da06c1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

editors/code/src/main.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,12 @@ async function bootstrapServer(config: Config, state: PersistentState): Promise<
252252
log.info("Using server binary at", path);
253253

254254
if (!isValidExecutable(path)) {
255-
throw new Error(`Failed to execute ${path} --version`);
255+
if (config.serverPath) {
256+
throw new Error(`Failed to execute ${path} --version. \`config.server.path\` or \`config.serverPath\` has been set explicitly.\
257+
Consider removing this config or making a valid server binary available at that path.`);
258+
} else {
259+
throw new Error(`Failed to execute ${path} --version`);
260+
}
256261
}
257262

258263
return path;

0 commit comments

Comments
 (0)