mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-12 00:45:06 +00:00
Use rustup rust-analyzer component when there is a toolchain file override for the opened workspace
This commit is contained in:
parent
232e55515f
commit
02c8b7df64
2 changed files with 44 additions and 18 deletions
|
|
@ -187,19 +187,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
|
|||
}
|
||||
|
||||
if (!this._client) {
|
||||
this._serverPath = await bootstrap(this.extCtx, this.config, this.state).catch(
|
||||
(err) => {
|
||||
let message = "bootstrap error. ";
|
||||
|
||||
message +=
|
||||
'See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically). ';
|
||||
message +=
|
||||
'To enable verbose logs use { "rust-analyzer.trace.extension": true }';
|
||||
|
||||
log.error("Bootstrap error", err);
|
||||
throw new Error(message);
|
||||
},
|
||||
);
|
||||
this._serverPath = await this.bootstrap();
|
||||
text(spawn(this._serverPath, ["--version"]).stdout.setEncoding("utf-8")).then(
|
||||
(data) => {
|
||||
const prefix = `rust-analyzer `;
|
||||
|
|
@ -291,6 +279,19 @@ export class Ctx implements RustAnalyzerExtensionApi {
|
|||
return this._client;
|
||||
}
|
||||
|
||||
private async bootstrap(): Promise<string> {
|
||||
return bootstrap(this.extCtx, this.config, this.state).catch((err) => {
|
||||
let message = "bootstrap error. ";
|
||||
|
||||
message +=
|
||||
'See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically). ';
|
||||
message += 'To enable verbose logs use { "rust-analyzer.trace.extension": true }';
|
||||
|
||||
log.error("Bootstrap error", err);
|
||||
throw new Error(message);
|
||||
});
|
||||
}
|
||||
|
||||
async start() {
|
||||
log.info("Starting language client");
|
||||
const client = await this.getOrCreateClient();
|
||||
|
|
@ -501,7 +502,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
|
|||
|
||||
const toggleCheckOnSave = this.config.checkOnSave ? "Disable" : "Enable";
|
||||
statusBar.tooltip.appendMarkdown(
|
||||
`[Extension Info](command:analyzer.serverVersion "Show version and server binary info"): Version ${this.version}, Server Version ${this._serverVersion}` +
|
||||
`[Extension Info](command:rust-analyzer.serverVersion "Show version and server binary info"): Version ${this.version}, Server Version ${this._serverVersion}` +
|
||||
"\n\n---\n\n" +
|
||||
'[$(terminal) Open Logs](command:rust-analyzer.openLogs "Open the server logs")' +
|
||||
"\n\n" +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue