From e63c4a47c730e1558ee450cb73fd61f6385c847d Mon Sep 17 00:00:00 2001 From: Grzegorz Lukasik Date: Thu, 28 Nov 2024 12:21:25 +0100 Subject: [PATCH 1/2] feat(lsp): Add option to trace LSP communication This option is useful to see messages passed between VS and LSP server to debug issues in LSP server implementations. Similar functionality is for many other languages, see e.g. previous changes for go and rust: https://github.com/golang/vscode-go/commit/70e7c4bd3ac06de9f9b4cdeac88ce8681f60ab52 https://github.com/rust-lang/rust-analyzer/pull/302/files --- package.json | 10 ++++++++++ src/extension/extension.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index bab267bb..77a7a534 100644 --- a/package.json +++ b/package.json @@ -193,6 +193,16 @@ }, "default": [], "description": "The arguments to pass to the LSP executable" + }, + "bazel.trace.server": { + "type": "string", + "enum": [ + "off", + "messages", + "verbose" + ], + "default": "off", + "description": "Trace the communication between VS Code and Bazel LSP server (language server)." } } }, diff --git a/src/extension/extension.ts b/src/extension/extension.ts index b3897222..c56733f3 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -161,7 +161,7 @@ function createLsp(config: vscode.WorkspaceConfiguration) { documentSelector: [{ scheme: "file", language: "starlark" }], }; - return new LanguageClient("Bazel LSP Client", serverOptions, clientOptions); + return new LanguageClient("bazel", "Bazel LSP Client", serverOptions, clientOptions) } /** From 6474dddcfee62ec4dc3004496337e21e5ff97e56 Mon Sep 17 00:00:00 2001 From: Grzegorz Lukasik Date: Thu, 28 Nov 2024 18:17:30 +0100 Subject: [PATCH 2/2] Prettier --- src/extension/extension.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/extension/extension.ts b/src/extension/extension.ts index c56733f3..d69bc049 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -161,7 +161,12 @@ function createLsp(config: vscode.WorkspaceConfiguration) { documentSelector: [{ scheme: "file", language: "starlark" }], }; - return new LanguageClient("bazel", "Bazel LSP Client", serverOptions, clientOptions) + return new LanguageClient( + "bazel", + "Bazel LSP Client", + serverOptions, + clientOptions, + ); } /**