Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/ctx.ts')
| -rw-r--r-- | editors/code/src/ctx.ts | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index caa99d7619..675bfda65a 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -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" + |