From 583fb651b0dc27d6deb56df6b617f1941c49f255 Mon Sep 17 00:00:00 2001 From: Grzegorz Lukasik <32371993+hauserx@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:03:19 +0100 Subject: [PATCH] feat(lsp): Add option to trace LSP communication (#425) 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 | 7 ++++++- 2 files changed, 16 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..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 LSP Client", serverOptions, clientOptions); + return new LanguageClient( + "bazel", + "Bazel LSP Client", + serverOptions, + clientOptions, + ); } /**