From 21b074feb09b7f2e4807a816be6fd0687f23c564 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 21 Jun 2023 11:34:49 +0200 Subject: refactor(lsp): report full Nvim version string in clientInfo --- runtime/lua/vim/lsp.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index cb1c101c58..ea81244c68 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1345,7 +1345,6 @@ function lsp.start_client(config) messages = 'messages', verbose = 'verbose', } - local version = vim.version() local workspace_folders --- @type table[]? local root_uri --- @type string? @@ -1379,7 +1378,7 @@ function lsp.start_client(config) -- since 3.15.0 clientInfo = { name = 'Neovim', - version = string.format('%s.%s.%s', version.major, version.minor, version.patch), + version = tostring(vim.version()), }, -- The rootPath of the workspace. Is null if no folder is open. -- -- cgit From 59048814fdad7a8769374f03c0137a8b8a2f5539 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 21 Jun 2023 11:40:03 +0200 Subject: docs(lsp): mention ctx.version Since 643546b82b4bc0c29ca869f81af868a019723d83 the request handler context (`ctx`) includes a `version` field. --- runtime/doc/lsp.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 3732ddf2bd..2a781119cf 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -238,6 +238,11 @@ For |lsp-response|, each |lsp-handler| has this signature: > The parameters used in the original request which resulted in this handler call. + {version} (number) Document version at time of + request. Handlers can compare this to the + current document version to check if the + response is "stale". + See also |b:changedtick|. {config} (table) Configuration for the handler. -- cgit