mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-18 03:13:31 +00:00
Auto merge of #17438 - jjoeldaniel:toggle_lsp_logs, r=Veykril
feat: add `toggleLSPLogs` command Implement client-side command to toggle LSP logs in VSCode. The command replaces the need to add/remove the `"rust-analyzer.trace.server": "verbose"` setting each time one wants to display logs. I've also updated the docs/ instances that reference the now outdated manual method. The command labeled `rust-analyzer: Toggle LSP Logs` enables the setting project-wide and opens the relevant trace output channel. Closes #8233
This commit is contained in:
commit
87ee18da54
5 changed files with 25 additions and 2 deletions
|
|
@ -1489,3 +1489,16 @@ export function toggleCheckOnSave(ctx: Ctx): Cmd {
|
|||
ctx.refreshServerStatus();
|
||||
};
|
||||
}
|
||||
|
||||
export function toggleLSPLogs(ctx: Ctx): Cmd {
|
||||
return async () => {
|
||||
const config = vscode.workspace.getConfiguration("rust-analyzer");
|
||||
const targetValue =
|
||||
config.get<string | undefined>("trace.server") === "verbose" ? undefined : "verbose";
|
||||
|
||||
await config.update("trace.server", targetValue, vscode.ConfigurationTarget.Workspace);
|
||||
if (targetValue && ctx.client && ctx.client.traceOutputChannel) {
|
||||
ctx.client.traceOutputChannel.show();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue