From 1a4d380b5abfff2cf5e46a1b00e98f4381b7e5b0 Mon Sep 17 00:00:00 2001 From: Chris Kipp Date: Mon, 18 Jan 2021 10:13:26 +0100 Subject: LSP: Add in clientInfo to initalize_params. (#13757) * Add in clienInfo to initalize_params. Some servers (like Metals in my case) will actually pull this info from the initalize_params and display it in the logs. I know from the server perspective it helps at times to have this available to pull from to have more details about the client and version. You can see that this is part of the spec here: microsoft.github.io/language-server-protocol/specification#initialize --- runtime/lua/vim/lsp.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 1a814f5b6c..9e05eeae89 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -582,12 +582,19 @@ function lsp.start_client(config) local valid_traces = { off = 'off'; messages = 'messages'; verbose = 'verbose'; } + local version = vim.version() local initialize_params = { -- The process Id of the parent process that started the server. Is null if -- the process has not been started by another process. If the parent -- process is not alive then the server should exit (see exit notification) -- its process. processId = uv.getpid(); + -- Information about the client + -- since 3.15.0 + clientInfo = { + name = "Neovim", + version = string.format("%s.%s.%s", version.major, version.minor, version.patch) + }; -- The rootPath of the workspace. Is null if no folder is open. -- -- @deprecated in favour of rootUri. -- cgit