diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2025-03-22 21:04:36 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2025-03-24 07:44:46 +0100 |
| commit | 6b9625dc0a8d5d673dbfdbeb0ad778eca062265b (patch) | |
| tree | 0273be81fc7da3f98d458bbd4d0e63652348407f /src/tools/rust-analyzer/editors/code | |
| parent | 2aa893313adadfad397f5899469417ba8c9e0853 (diff) | |
| download | rust-6b9625dc0a8d5d673dbfdbeb0ad778eca062265b.tar.gz rust-6b9625dc0a8d5d673dbfdbeb0ad778eca062265b.zip | |
chore: Cleanup vscode extension output channels
Diffstat (limited to 'src/tools/rust-analyzer/editors/code')
6 files changed, 10 insertions, 24 deletions
diff --git a/src/tools/rust-analyzer/editors/code/package.json b/src/tools/rust-analyzer/editors/code/package.json index 11732ddd3e6..55477b71154 100644 --- a/src/tools/rust-analyzer/editors/code/package.json +++ b/src/tools/rust-analyzer/editors/code/package.json @@ -606,11 +606,6 @@ "/rustc/<id>": "${env:USERPROFILE}/.rustup/toolchains/<toolchain-id>/lib/rustlib/src/rust" } }, - "rust-analyzer.debug.openDebugPane": { - "markdownDescription": "Whether to open up the `Debug Panel` on debugging start.", - "type": "boolean", - "default": false - }, "rust-analyzer.debug.buildBeforeRestart": { "markdownDescription": "Whether to rebuild the project modules before debugging the same test again", "type": "boolean", diff --git a/src/tools/rust-analyzer/editors/code/src/config.ts b/src/tools/rust-analyzer/editors/code/src/config.ts index 896b3c10cbf..9b8ac666ce0 100644 --- a/src/tools/rust-analyzer/editors/code/src/config.ts +++ b/src/tools/rust-analyzer/editors/code/src/config.ts @@ -323,7 +323,6 @@ export class Config { return { engine: this.get<string>("debug.engine"), engineSettings: this.get<object>("debug.engineSettings") ?? {}, - openDebugPane: this.get<boolean>("debug.openDebugPane"), buildBeforeRestart: this.get<boolean>("debug.buildBeforeRestart"), sourceFileMap: sourceFileMap, }; diff --git a/src/tools/rust-analyzer/editors/code/src/ctx.ts b/src/tools/rust-analyzer/editors/code/src/ctx.ts index 37a2ee23691..11495236223 100644 --- a/src/tools/rust-analyzer/editors/code/src/ctx.ts +++ b/src/tools/rust-analyzer/editors/code/src/ctx.ts @@ -190,11 +190,11 @@ export class Ctx implements RustAnalyzerExtensionApi { } if (!this.traceOutputChannel) { - this.traceOutputChannel = new LazyOutputChannel("Rust Analyzer Language Server Trace"); + this.traceOutputChannel = new LazyOutputChannel("rust-analyzer LSP Trace"); this.pushExtCleanup(this.traceOutputChannel); } if (!this.outputChannel) { - this.outputChannel = vscode.window.createOutputChannel("Rust Analyzer Language Server"); + this.outputChannel = vscode.window.createOutputChannel("rust-analyzer Language Server"); this.pushExtCleanup(this.outputChannel); } diff --git a/src/tools/rust-analyzer/editors/code/src/debug.ts b/src/tools/rust-analyzer/editors/code/src/debug.ts index 72a9aabc043..04211d77e77 100644 --- a/src/tools/rust-analyzer/editors/code/src/debug.ts +++ b/src/tools/rust-analyzer/editors/code/src/debug.ts @@ -6,11 +6,9 @@ import type * as ra from "./lsp_ext"; import { Cargo } from "./toolchain"; import type { Ctx } from "./ctx"; import { createTaskFromRunnable, prepareEnv } from "./run"; -import { execute, isCargoRunnableArgs, unwrapUndefinable } from "./util"; +import { execute, isCargoRunnableArgs, unwrapUndefinable, log } from "./util"; import type { Config } from "./config"; -const debugOutput = vscode.window.createOutputChannel("Debug"); - // Here we want to keep track on everything that's currently running const activeDebugSessionIds: string[] = []; @@ -56,15 +54,14 @@ export async function startDebugSession(ctx: Ctx, runnable: ra.Runnable): Promis if (-1 !== index) { debugConfig = configurations[index]; message = " (from launch.json)"; - debugOutput.clear(); } else { debugConfig = await getDebugConfiguration(ctx.config, runnable); } if (!debugConfig) return false; - debugOutput.appendLine(`Launching debug configuration${message}:`); - debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); + log.debug(`Launching debug configuration${message}:`); + log.debug(JSON.stringify(debugConfig, null, 2)); return vscode.debug.startDebugging(undefined, debugConfig); } @@ -118,10 +115,6 @@ async function getDebugConfiguration( return; } - debugOutput.clear(); - if (config.debug.openDebugPane) { - debugOutput.show(true); - } // folder exists or RA is not active. const workspaceFolders = vscode.workspace.workspaceFolders!; @@ -321,7 +314,7 @@ async function getDebugExecutable( runnableArgs: ra.CargoRunnableArgs, env: Record<string, string>, ): Promise<string> { - const cargo = new Cargo(runnableArgs.workspaceRoot || ".", debugOutput, env); + const cargo = new Cargo(runnableArgs.workspaceRoot || ".", env); const executable = await cargo.executableFromArgs(runnableArgs); // if we are here, there were no compilation errors. diff --git a/src/tools/rust-analyzer/editors/code/src/toolchain.ts b/src/tools/rust-analyzer/editors/code/src/toolchain.ts index bb061442953..a859ce6ff00 100644 --- a/src/tools/rust-analyzer/editors/code/src/toolchain.ts +++ b/src/tools/rust-analyzer/editors/code/src/toolchain.ts @@ -37,7 +37,6 @@ interface CompilerMessage { export class Cargo { constructor( readonly rootFolder: string, - readonly output: vscode.OutputChannel, readonly env: Record<string, string>, ) {} @@ -93,14 +92,14 @@ export class Cargo { }); } } else if (message.reason === "compiler-message") { - this.output.append(message.message.rendered); + log.info(message.message.rendered); } }, - (stderr) => this.output.append(stderr), + (stderr) => log.error(stderr), env, ); } catch (err) { - this.output.show(true); + log.error(`Cargo invocation has failed: ${err}`); throw new Error(`Cargo invocation has failed: ${err}`); } diff --git a/src/tools/rust-analyzer/editors/code/src/util.ts b/src/tools/rust-analyzer/editors/code/src/util.ts index 93c7bf8d73e..4b3a6970db5 100644 --- a/src/tools/rust-analyzer/editors/code/src/util.ts +++ b/src/tools/rust-analyzer/editors/code/src/util.ts @@ -18,7 +18,7 @@ export type Env = { }; class Log { - private readonly output = vscode.window.createOutputChannel("Rust Analyzer Client", { + private readonly output = vscode.window.createOutputChannel("rust-analyzer Extension", { log: true, }); |
