From 5732aa706c639b3d775573d91d1139f24624629c Mon Sep 17 00:00:00 2001 From: Jon Huhn Date: Sat, 25 Feb 2023 03:07:18 -0600 Subject: feat(lsp): implement workspace/didChangeWatchedFiles (#21293) --- runtime/lua/vim/lsp/protocol.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 12345b6c8c..df1ab26667 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -28,6 +28,10 @@ end ---@class lsp.MessageActionItem ---@field title string +---@class lsp.FileEvent +---@field uri string +---@field type lsp.FileChangeType + local constants = { DiagnosticSeverity = { -- Reports an error. @@ -60,6 +64,7 @@ local constants = { }, -- The file event type. + ---@enum lsp.FileChangeType FileChangeType = { -- The file got created. Created = 1, @@ -841,6 +846,10 @@ function protocol.make_client_capabilities() semanticTokens = { refreshSupport = true, }, + didChangeWatchedFiles = { + dynamicRegistration = true, + relativePatternSupport = true, + }, }, experimental = nil, window = { -- cgit From f0f27e9aef7c237dd55fbb5c2cd47c2f42d01742 Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Sat, 25 Feb 2023 11:17:28 +0100 Subject: Revert "feat(lsp): implement workspace/didChangeWatchedFiles (#21293)" This reverts commit 5732aa706c639b3d775573d91d1139f24624629c. Causes editor to freeze in projects with many watcher registrations --- runtime/lua/vim/lsp/protocol.lua | 9 --------- 1 file changed, 9 deletions(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index df1ab26667..12345b6c8c 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -28,10 +28,6 @@ end ---@class lsp.MessageActionItem ---@field title string ----@class lsp.FileEvent ----@field uri string ----@field type lsp.FileChangeType - local constants = { DiagnosticSeverity = { -- Reports an error. @@ -64,7 +60,6 @@ local constants = { }, -- The file event type. - ---@enum lsp.FileChangeType FileChangeType = { -- The file got created. Created = 1, @@ -846,10 +841,6 @@ function protocol.make_client_capabilities() semanticTokens = { refreshSupport = true, }, - didChangeWatchedFiles = { - dynamicRegistration = true, - relativePatternSupport = true, - }, }, experimental = nil, window = { -- cgit From c1514d7e6762ed62dee027ecc29bafd4aae2206e Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Sat, 25 Feb 2023 18:47:05 +0100 Subject: fix(lsp): fix some type annotations (#22397) --- runtime/lua/vim/lsp/protocol.lua | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 12345b6c8c..41dfc9e00e 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -20,14 +20,6 @@ function transform_schema_to_table() end --]=] ----@class lsp.ShowMessageRequestParams ----@field type lsp.MessageType ----@field message string ----@field actions nil|lsp.MessageActionItem[] - ----@class lsp.MessageActionItem ----@field title string - local constants = { DiagnosticSeverity = { -- Reports an error. @@ -60,6 +52,7 @@ local constants = { }, -- The file event type. + ---@enum lsp.FileChangeType FileChangeType = { -- The file got created. Created = 1, -- cgit From ac69ba5fa0081026f2c5e6e29d5788802479b7b9 Mon Sep 17 00:00:00 2001 From: Jon Huhn Date: Sun, 5 Mar 2023 00:52:27 -0600 Subject: feat(lsp): implement workspace/didChangeWatchedFiles (#22405) --- runtime/lua/vim/lsp/protocol.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 41dfc9e00e..27dd68645a 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -834,6 +834,10 @@ function protocol.make_client_capabilities() semanticTokens = { refreshSupport = true, }, + didChangeWatchedFiles = { + dynamicRegistration = false, + relativePatternSupport = true, + }, }, experimental = nil, window = { -- cgit From 865d8d4720ca72de1c385773ca4c597f3642874c Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 11 Mar 2023 21:49:53 +0800 Subject: refactor(lsp): remove _resolve_capabilities_compat (#22628) --- runtime/lua/vim/lsp/protocol.lua | 174 --------------------------------------- 1 file changed, 174 deletions(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 27dd68645a..1686e22c48 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -854,7 +854,6 @@ function protocol.make_client_capabilities() } end -local if_nil = vim.F.if_nil --- Creates a normalized object describing LSP server capabilities. ---@param server_capabilities table Table of capabilities supported by the server ---@return table Normalized table of capabilities @@ -892,178 +891,5 @@ function protocol.resolve_capabilities(server_capabilities) return server_capabilities end ----@private ---- Creates a normalized object describing LSP server capabilities. --- @deprecated access resolved_capabilities instead ----@param server_capabilities table Table of capabilities supported by the server ----@return table Normalized table of capabilities -function protocol._resolve_capabilities_compat(server_capabilities) - local general_properties = {} - local text_document_sync_properties - do - local TextDocumentSyncKind = protocol.TextDocumentSyncKind - local textDocumentSync = server_capabilities.textDocumentSync - if textDocumentSync == nil then - -- Defaults if omitted. - text_document_sync_properties = { - text_document_open_close = false, - text_document_did_change = TextDocumentSyncKind.None, - -- text_document_did_change = false; - text_document_will_save = false, - text_document_will_save_wait_until = false, - text_document_save = false, - text_document_save_include_text = false, - } - elseif type(textDocumentSync) == 'number' then - -- Backwards compatibility - if not TextDocumentSyncKind[textDocumentSync] then - return nil, 'Invalid server TextDocumentSyncKind for textDocumentSync' - end - text_document_sync_properties = { - text_document_open_close = true, - text_document_did_change = textDocumentSync, - text_document_will_save = false, - text_document_will_save_wait_until = false, - text_document_save = true, - text_document_save_include_text = false, - } - elseif type(textDocumentSync) == 'table' then - text_document_sync_properties = { - text_document_open_close = if_nil(textDocumentSync.openClose, false), - text_document_did_change = if_nil(textDocumentSync.change, TextDocumentSyncKind.None), - text_document_will_save = if_nil(textDocumentSync.willSave, true), - text_document_will_save_wait_until = if_nil(textDocumentSync.willSaveWaitUntil, true), - text_document_save = if_nil(textDocumentSync.save, false), - text_document_save_include_text = if_nil( - type(textDocumentSync.save) == 'table' and textDocumentSync.save.includeText, - false - ), - } - else - return nil, string.format('Invalid type for textDocumentSync: %q', type(textDocumentSync)) - end - end - general_properties.completion = server_capabilities.completionProvider ~= nil - general_properties.hover = server_capabilities.hoverProvider or false - general_properties.goto_definition = server_capabilities.definitionProvider or false - general_properties.find_references = server_capabilities.referencesProvider or false - general_properties.document_highlight = server_capabilities.documentHighlightProvider or false - general_properties.document_symbol = server_capabilities.documentSymbolProvider or false - general_properties.workspace_symbol = server_capabilities.workspaceSymbolProvider or false - general_properties.document_formatting = server_capabilities.documentFormattingProvider or false - general_properties.document_range_formatting = server_capabilities.documentRangeFormattingProvider - or false - general_properties.call_hierarchy = server_capabilities.callHierarchyProvider or false - general_properties.execute_command = server_capabilities.executeCommandProvider ~= nil - - if server_capabilities.renameProvider == nil then - general_properties.rename = false - elseif type(server_capabilities.renameProvider) == 'boolean' then - general_properties.rename = server_capabilities.renameProvider - else - general_properties.rename = true - end - - if server_capabilities.codeLensProvider == nil then - general_properties.code_lens = false - general_properties.code_lens_resolve = false - elseif type(server_capabilities.codeLensProvider) == 'table' then - general_properties.code_lens = true - general_properties.code_lens_resolve = server_capabilities.codeLensProvider.resolveProvider - or false - else - error('The server sent invalid codeLensProvider') - end - - if server_capabilities.codeActionProvider == nil then - general_properties.code_action = false - elseif - type(server_capabilities.codeActionProvider) == 'boolean' - or type(server_capabilities.codeActionProvider) == 'table' - then - general_properties.code_action = server_capabilities.codeActionProvider - else - error('The server sent invalid codeActionProvider') - end - - if server_capabilities.declarationProvider == nil then - general_properties.declaration = false - elseif type(server_capabilities.declarationProvider) == 'boolean' then - general_properties.declaration = server_capabilities.declarationProvider - elseif type(server_capabilities.declarationProvider) == 'table' then - general_properties.declaration = server_capabilities.declarationProvider - else - error('The server sent invalid declarationProvider') - end - - if server_capabilities.typeDefinitionProvider == nil then - general_properties.type_definition = false - elseif type(server_capabilities.typeDefinitionProvider) == 'boolean' then - general_properties.type_definition = server_capabilities.typeDefinitionProvider - elseif type(server_capabilities.typeDefinitionProvider) == 'table' then - general_properties.type_definition = server_capabilities.typeDefinitionProvider - else - error('The server sent invalid typeDefinitionProvider') - end - - if server_capabilities.implementationProvider == nil then - general_properties.implementation = false - elseif type(server_capabilities.implementationProvider) == 'boolean' then - general_properties.implementation = server_capabilities.implementationProvider - elseif type(server_capabilities.implementationProvider) == 'table' then - general_properties.implementation = server_capabilities.implementationProvider - else - error('The server sent invalid implementationProvider') - end - - local workspace = server_capabilities.workspace - local workspace_properties = {} - if workspace == nil or workspace.workspaceFolders == nil then - -- Defaults if omitted. - workspace_properties = { - workspace_folder_properties = { - supported = false, - changeNotifications = false, - }, - } - elseif type(workspace.workspaceFolders) == 'table' then - workspace_properties = { - workspace_folder_properties = { - supported = if_nil(workspace.workspaceFolders.supported, false), - changeNotifications = if_nil(workspace.workspaceFolders.changeNotifications, false), - }, - } - else - error('The server sent invalid workspace') - end - - local signature_help_properties - if server_capabilities.signatureHelpProvider == nil then - signature_help_properties = { - signature_help = false, - signature_help_trigger_characters = {}, - } - elseif type(server_capabilities.signatureHelpProvider) == 'table' then - signature_help_properties = { - signature_help = true, - -- The characters that trigger signature help automatically. - signature_help_trigger_characters = server_capabilities.signatureHelpProvider.triggerCharacters - or {}, - } - else - error('The server sent invalid signatureHelpProvider') - end - - local capabilities = vim.tbl_extend( - 'error', - text_document_sync_properties, - signature_help_properties, - workspace_properties, - general_properties - ) - - return capabilities -end - return protocol -- vim:sw=2 ts=2 et -- cgit From 226a6c3eaef2a7220841d3d5e69e1baf543b3d6f Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 30 Mar 2023 14:49:58 +0100 Subject: feat(diagnostic): add support for tags The LSP spec supports two tags that can be added to diagnostics: unnecessary and deprecated. Extend vim.diagnostic to be able to handle these. --- runtime/lua/vim/lsp/protocol.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 1686e22c48..f4489ad17d 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -21,6 +21,7 @@ end --]=] local constants = { + --- @enum lsp.DiagnosticSeverity DiagnosticSeverity = { -- Reports an error. Error = 1, @@ -32,6 +33,7 @@ local constants = { Hint = 4, }, + --- @enum lsp.DiagnosticTag DiagnosticTag = { -- Unused or unnecessary code Unnecessary = 1, -- cgit From bfb28b62dab756ec76a73506c2070ddf491a0cdd Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Thu, 13 Apr 2023 15:29:13 -0600 Subject: refactor: remove modelines from Lua files Now that we have builtin EditorConfig support and a formatting check in CI, these are not necessary. --- runtime/lua/vim/lsp/protocol.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index f4489ad17d..2cb8fc7955 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -894,4 +894,3 @@ function protocol.resolve_capabilities(server_capabilities) end return protocol --- vim:sw=2 ts=2 et -- cgit From e9b85acfbb8d3b1dd6f92deb187800be757c6c68 Mon Sep 17 00:00:00 2001 From: Jon Huhn Date: Sat, 22 Apr 2023 02:37:38 -0500 Subject: feat(lsp): enable workspace/didChangeWatchedFiles by default (#23190) --- runtime/lua/vim/lsp/protocol.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 2cb8fc7955..a7919f12f5 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -837,7 +837,7 @@ function protocol.make_client_capabilities() refreshSupport = true, }, didChangeWatchedFiles = { - dynamicRegistration = false, + dynamicRegistration = true, relativePatternSupport = true, }, }, -- cgit From ddd92a70d2aab5247895e89abaaa79c62ba7dbb4 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 28 May 2023 07:51:28 +0200 Subject: feat(lsp): initial support for dynamic capabilities (#23681) - `client.dynamic_capabilities` is an object that tracks client register/unregister - `client.supports_method` will additionally check if a dynamic capability supports the method, taking document filters into account. But only if the client enabled `dynamicRegistration` for the capability - updated the default client capabilities to include dynamicRegistration for: - formatting - rangeFormatting - hover - codeAction - hover - rename --- runtime/lua/vim/lsp/protocol.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index a7919f12f5..a28ff407b7 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -697,7 +697,7 @@ function protocol.make_client_capabilities() didSave = true, }, codeAction = { - dynamicRegistration = false, + dynamicRegistration = true, codeActionLiteralSupport = { codeActionKind = { @@ -714,6 +714,12 @@ function protocol.make_client_capabilities() properties = { 'edit' }, }, }, + formatting = { + dynamicRegistration = true, + }, + rangeFormatting = { + dynamicRegistration = true, + }, completion = { dynamicRegistration = false, completionItem = { @@ -747,6 +753,7 @@ function protocol.make_client_capabilities() }, definition = { linkSupport = true, + dynamicRegistration = true, }, implementation = { linkSupport = true, @@ -755,7 +762,7 @@ function protocol.make_client_capabilities() linkSupport = true, }, hover = { - dynamicRegistration = false, + dynamicRegistration = true, contentFormat = { protocol.MarkupKind.Markdown, protocol.MarkupKind.PlainText }, }, signatureHelp = { @@ -790,7 +797,7 @@ function protocol.make_client_capabilities() hierarchicalDocumentSymbolSupport = true, }, rename = { - dynamicRegistration = false, + dynamicRegistration = true, prepareSupport = true, }, publishDiagnostics = { -- cgit From 15641f38cf4b489a7c83e2c3aa6efc4c63009f00 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Thu, 1 Jun 2023 11:39:51 -0500 Subject: feat(lsp): include positionEncodings in default client capabilities --- runtime/lua/vim/lsp/protocol.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index a28ff407b7..7e49a572e7 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -634,6 +634,13 @@ export interface WorkspaceClientCapabilities { --- capabilities. function protocol.make_client_capabilities() return { + general = { + positionEncodings = { + 'utf-8', + 'utf-16', + 'utf-32', + }, + }, textDocument = { semanticTokens = { dynamicRegistration = false, -- cgit From ca26ec34386dfe98b0edf3de9aeb7b66f40d5efd Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Mon, 5 Jun 2023 08:21:23 -0500 Subject: fix(lsp): use only utf-16 in default client positionEncodings (#23903) The Nvim client does not yet support multiple offset encodings for clients in the same buffer. Until it does, stick to utf-16 by default. --- runtime/lua/vim/lsp/protocol.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 7e49a572e7..7558b5c6ba 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -636,9 +636,7 @@ function protocol.make_client_capabilities() return { general = { positionEncodings = { - 'utf-8', 'utf-16', - 'utf-32', }, }, textDocument = { -- cgit From 4ecc71f6fc7377403ed91ae5bc32992a5d08f678 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 7 Jun 2023 13:39:41 +0100 Subject: fix(lsp): reduce diagnostics and add more types (#23948) --- runtime/lua/vim/lsp/protocol.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 7558b5c6ba..172d43e483 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -632,6 +632,7 @@ export interface WorkspaceClientCapabilities { --- Gets a new ClientCapabilities object describing the LSP client --- capabilities. +--- @return lsp.ClientCapabilities function protocol.make_client_capabilities() return { general = { -- cgit From 643546b82b4bc0c29ca869f81af868a019723d83 Mon Sep 17 00:00:00 2001 From: Chinmay Dalal Date: Sun, 11 Jun 2023 15:23:37 +0530 Subject: feat(lsp): add handlers for inlay hints (#23736) initial support; public API left for a follow-up PR --- runtime/lua/vim/lsp/protocol.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 172d43e483..b3a7903420 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -641,6 +641,12 @@ function protocol.make_client_capabilities() }, }, textDocument = { + inlayHint = { + dynamicRegistration = false, + resolveSupport = { + properties = {}, + }, + }, semanticTokens = { dynamicRegistration = false, tokenTypes = { @@ -853,6 +859,9 @@ function protocol.make_client_capabilities() dynamicRegistration = true, relativePatternSupport = true, }, + inlayHint = { + refreshSupport = true, + }, }, experimental = nil, window = { -- cgit From 12c2c16acf7051d364d29cfd71f2542b0943d8e8 Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Thu, 22 Jun 2023 19:39:57 +0200 Subject: feat(lsp): opt-in to dynamicRegistration for inlay hints (#24102) Since https://github.com/neovim/neovim/pull/23681 there is dynamic registration support. We should use that for new features unless there is a good reason to turn it off. --- runtime/lua/vim/lsp/protocol.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index b3a7903420..ea38bfe237 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -642,7 +642,7 @@ function protocol.make_client_capabilities() }, textDocument = { inlayHint = { - dynamicRegistration = false, + dynamicRegistration = true, resolveSupport = { properties = {}, }, -- cgit From ba8f19ebb67ca27d746f4b1cd902ab3d807eace3 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 1 Jul 2023 18:42:37 +0800 Subject: fix(lsp): lint warnings, default offset_encoding #24046 - fix lint / analysis warnings - locations_to_items(): get default offset_encoding from active client - character_offset(): get default offset_encoding from active client --- runtime/lua/vim/lsp/protocol.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index ea38bfe237..27da891656 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -880,7 +880,7 @@ end --- Creates a normalized object describing LSP server capabilities. ---@param server_capabilities table Table of capabilities supported by the server ----@return table Normalized table of capabilities +---@return table|nil Normalized table of capabilities function protocol.resolve_capabilities(server_capabilities) local TextDocumentSyncKind = protocol.TextDocumentSyncKind local textDocumentSync = server_capabilities.textDocumentSync @@ -898,7 +898,8 @@ function protocol.resolve_capabilities(server_capabilities) elseif type(textDocumentSync) == 'number' then -- Backwards compatibility if not TextDocumentSyncKind[textDocumentSync] then - return nil, 'Invalid server TextDocumentSyncKind for textDocumentSync' + vim.notify('Invalid server TextDocumentSyncKind for textDocumentSync', vim.log.levels.ERROR) + return nil end server_capabilities.textDocumentSync = { openClose = true, @@ -910,7 +911,11 @@ function protocol.resolve_capabilities(server_capabilities) }, } elseif type(textDocumentSync) ~= 'table' then - return nil, string.format('Invalid type for textDocumentSync: %q', type(textDocumentSync)) + vim.notify( + string.format('Invalid type for textDocumentSync: %q', type(textDocumentSync)), + vim.log.levels.ERROR + ) + return nil end return server_capabilities end -- cgit From 2ecba65b4ba741618ecbfd2a50a939987078bc98 Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Fri, 14 Jul 2023 05:36:10 +0000 Subject: fix(lsp): remove unknown LSP protocol property (#24345) 'hierarchicalWorkspaceSymbolSupport' is not part of the LSP Specification --- runtime/lua/vim/lsp/protocol.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 27da891656..5bc0baf241 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -844,7 +844,6 @@ function protocol.make_client_capabilities() return res end)(), }, - hierarchicalWorkspaceSymbolSupport = true, }, configuration = true, workspaceFolders = true, -- cgit From 63b3408551561127f7845470eb51404bcd6f547b Mon Sep 17 00:00:00 2001 From: Chris AtLee Date: Thu, 20 Jul 2023 03:03:48 -0400 Subject: feat(lsp): implement textDocument/diagnostic (#24128) --- runtime/lua/vim/lsp/protocol.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 5bc0baf241..537a5eda39 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -641,6 +641,9 @@ function protocol.make_client_capabilities() }, }, textDocument = { + diagnostic = { + dynamicRegistration = false, + }, inlayHint = { dynamicRegistration = true, resolveSupport = { -- cgit From 966eb8e0b3be1b409e491d5cf1e32e82e806a134 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Mon, 24 Jul 2023 19:26:17 +0200 Subject: fix(lsp): announce publishDiagnostics.dataSupport (#24442) Neovim already passed `data` element from published diagnostic to code action, but failed to announce it in client capabilities. Here is the test that shows that `data` element is returned by `vim.lsp.diagnostic.get_line_diagnostics()`: https://github.com/neovim/neovim/blob/f56c1848091bb64c63b5bc25ec74bcbd2f52bdde/test/functional/plugin/lsp/diagnostic_spec.lua#L103-L115 and then `get_line_diagnostics()` is used to construct the context for code action request: https://github.com/neovim/neovim/blob/f56c1848091bb64c63b5bc25ec74bcbd2f52bdde/runtime/lua/vim/lsp/buf.lua#L742 --- runtime/lua/vim/lsp/protocol.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 537a5eda39..31cc071d18 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -828,6 +828,7 @@ function protocol.make_client_capabilities() return res end)(), }, + dataSupport = true, }, callHierarchy = { dynamicRegistration = false, -- cgit From da09f9b551badfb3fd363589009168560ae607f6 Mon Sep 17 00:00:00 2001 From: mathew Date: Fri, 28 Jul 2023 15:24:18 +0800 Subject: feat(gen_lsp.lua): protocol.Methods #24504 --- runtime/lua/vim/lsp/protocol.lua | 270 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 31cc071d18..e45baa59c5 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -923,4 +923,274 @@ function protocol.resolve_capabilities(server_capabilities) return server_capabilities end +-- Generated by lsp_types.lua, keep at end of file. +--- LSP method names. +--- +---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#metaModel +protocol.Methods = { + --- The initialize request is sent from the client to the server. + --- It is sent once as the request after starting up the server. + --- The requests parameter is of type {@link InitializeParams} + --- the response if of type {@link InitializeResult} of a Thenable that + --- resolves to such. + initialize = 'initialize', + --- A shutdown request is sent from the client to the server. + --- It is sent once when the client decides to shutdown the + --- server. The only notification that is sent after a shutdown request + --- is the exit event. + shutdown = 'shutdown', + --- The `client/registerCapability` request is sent from the server to the client to register a new capability + --- handler on the client side. + client_registerCapability = 'client/registerCapability', + --- The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability + --- handler on the client side. + client_unregisterCapability = 'client/unregisterCapability', + --- A request to resolve the implementation locations of a symbol at a given text + --- document position. The request's parameter is of type [TextDocumentPositionParams] + --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a + --- Thenable that resolves to such. + textDocument_implementation = 'textDocument/implementation', + --- A request to resolve the type definition locations of a symbol at a given text + --- document position. The request's parameter is of type [TextDocumentPositionParams] + --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a + --- Thenable that resolves to such. + textDocument_typeDefinition = 'textDocument/typeDefinition', + --- A request to list all color symbols found in a given text document. The request's + --- parameter is of type {@link DocumentColorParams} the + --- response is of type {@link ColorInformation ColorInformation[]} or a Thenable + --- that resolves to such. + textDocument_documentColor = 'textDocument/documentColor', + --- A request to list all presentation for a color. The request's + --- parameter is of type {@link ColorPresentationParams} the + --- response is of type {@link ColorInformation ColorInformation[]} or a Thenable + --- that resolves to such. + textDocument_colorPresentation = 'textDocument/colorPresentation', + --- A request to provide folding ranges in a document. The request's + --- parameter is of type {@link FoldingRangeParams}, the + --- response is of type {@link FoldingRangeList} or a Thenable + --- that resolves to such. + textDocument_foldingRange = 'textDocument/foldingRange', + --- A request to resolve the type definition locations of a symbol at a given text + --- document position. The request's parameter is of type [TextDocumentPositionParams] + --- (#TextDocumentPositionParams) the response is of type {@link Declaration} + --- or a typed array of {@link DeclarationLink} or a Thenable that resolves + --- to such. + textDocument_declaration = 'textDocument/declaration', + --- A request to provide selection ranges in a document. The request's + --- parameter is of type {@link SelectionRangeParams}, the + --- response is of type {@link SelectionRange SelectionRange[]} or a Thenable + --- that resolves to such. + textDocument_selectionRange = 'textDocument/selectionRange', + --- A request to result a `CallHierarchyItem` in a document at a given position. + --- Can be used as an input to an incoming or outgoing call hierarchy. + --- @since 3.16.0 + textDocument_prepareCallHierarchy = 'textDocument/prepareCallHierarchy', + --- @since 3.16.0 + textDocument_semanticTokens_full = 'textDocument/semanticTokens/full', + --- @since 3.16.0 + textDocument_semanticTokens_full_delta = 'textDocument/semanticTokens/full/delta', + --- @since 3.16.0 + textDocument_semanticTokens_range = 'textDocument/semanticTokens/range', + --- A request to provide ranges that can be edited together. + --- @since 3.16.0 + textDocument_linkedEditingRange = 'textDocument/linkedEditingRange', + --- A request to get the moniker of a symbol at a given text document position. + --- The request parameter is of type {@link TextDocumentPositionParams}. + --- The response is of type {@link Moniker Moniker[]} or `null`. + textDocument_moniker = 'textDocument/moniker', + --- A request to result a `TypeHierarchyItem` in a document at a given position. + --- Can be used as an input to a subtypes or supertypes type hierarchy. + --- @since 3.17.0 + textDocument_prepareTypeHierarchy = 'textDocument/prepareTypeHierarchy', + --- A request to provide inline values in a document. The request's parameter is of + --- type {@link InlineValueParams}, the response is of type + --- {@link InlineValue InlineValue[]} or a Thenable that resolves to such. + --- @since 3.17.0 + textDocument_inlineValue = 'textDocument/inlineValue', + --- A request to provide inlay hints in a document. The request's parameter is of + --- type {@link InlayHintsParams}, the response is of type + --- {@link InlayHint InlayHint[]} or a Thenable that resolves to such. + --- @since 3.17.0 + textDocument_inlayHint = 'textDocument/inlayHint', + --- The document diagnostic request definition. + --- @since 3.17.0 + textDocument_diagnostic = 'textDocument/diagnostic', + --- A request to provide inline completions in a document. The request's parameter is of + --- type {@link InlineCompletionParams}, the response is of type + --- {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such. + --- @since 3.18.0 + textDocument_inlineCompletion = 'textDocument/inlineCompletion', + --- A document will save request is sent from the client to the server before + --- the document is actually saved. The request can return an array of TextEdits + --- which will be applied to the text document before it is saved. Please note that + --- clients might drop results if computing the text edits took too long or if a + --- server constantly fails on this request. This is done to keep the save fast and + --- reliable. + textDocument_willSaveWaitUntil = 'textDocument/willSaveWaitUntil', + --- Request to request completion at a given text document position. The request's + --- parameter is of type {@link TextDocumentPosition} the response + --- is of type {@link CompletionItem CompletionItem[]} or {@link CompletionList} + --- or a Thenable that resolves to such. + --- The request can delay the computation of the {@link CompletionItem.detail `detail`} + --- and {@link CompletionItem.documentation `documentation`} properties to the `completionItem/resolve` + --- request. However, properties that are needed for the initial sorting and filtering, like `sortText`, + --- `filterText`, `insertText`, and `textEdit`, must not be changed during resolve. + textDocument_completion = 'textDocument/completion', + --- Request to request hover information at a given text document position. The request's + --- parameter is of type {@link TextDocumentPosition} the response is of + --- type {@link Hover} or a Thenable that resolves to such. + textDocument_hover = 'textDocument/hover', + textDocument_signatureHelp = 'textDocument/signatureHelp', + --- A request to resolve the definition location of a symbol at a given text + --- document position. The request's parameter is of type [TextDocumentPosition] + --- (#TextDocumentPosition) the response is of either type {@link Definition} + --- or a typed array of {@link DefinitionLink} or a Thenable that resolves + --- to such. + textDocument_definition = 'textDocument/definition', + --- A request to resolve project-wide references for the symbol denoted + --- by the given text document position. The request's parameter is of + --- type {@link ReferenceParams} the response is of type + --- {@link Location Location[]} or a Thenable that resolves to such. + textDocument_references = 'textDocument/references', + --- Request to resolve a {@link DocumentHighlight} for a given + --- text document position. The request's parameter is of type [TextDocumentPosition] + --- (#TextDocumentPosition) the request response is of type [DocumentHighlight[]] + --- (#DocumentHighlight) or a Thenable that resolves to such. + textDocument_documentHighlight = 'textDocument/documentHighlight', + --- A request to list all symbols found in a given text document. The request's + --- parameter is of type {@link TextDocumentIdentifier} the + --- response is of type {@link SymbolInformation SymbolInformation[]} or a Thenable + --- that resolves to such. + textDocument_documentSymbol = 'textDocument/documentSymbol', + --- A request to provide commands for the given text document and range. + textDocument_codeAction = 'textDocument/codeAction', + --- A request to provide code lens for the given text document. + textDocument_codeLens = 'textDocument/codeLens', + --- A request to provide document links + textDocument_documentLink = 'textDocument/documentLink', + --- A request to to format a whole document. + textDocument_formatting = 'textDocument/formatting', + --- A request to format a range in a document. + textDocument_rangeFormatting = 'textDocument/rangeFormatting', + --- A request to format ranges in a document. + --- @since 3.18.0 + --- @proposed + textDocument_rangesFormatting = 'textDocument/rangesFormatting', + --- A request to format a document on type. + textDocument_onTypeFormatting = 'textDocument/onTypeFormatting', + --- A request to rename a symbol. + textDocument_rename = 'textDocument/rename', + --- A request to test and perform the setup necessary for a rename. + --- @since 3.16 - support for default behavior + textDocument_prepareRename = 'textDocument/prepareRename', + --- The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders. + workspace_workspaceFolders = 'workspace/workspaceFolders', + --- The 'workspace/configuration' request is sent from the server to the client to fetch a certain + --- configuration setting. + --- This pull model replaces the old push model were the client signaled configuration change via an + --- event. If the server still needs to react to configuration changes (since the server caches the + --- result of `workspace/configuration` requests) the server should register for an empty configuration + --- change event and empty the cache if such an event is received. + workspace_configuration = 'workspace/configuration', + --- @since 3.16.0 + workspace_semanticTokens_refresh = 'workspace/semanticTokens/refresh', + --- The will create files request is sent from the client to the server before files are actually + --- created as long as the creation is triggered from within the client. + --- The request can return a `WorkspaceEdit` which will be applied to workspace before the + --- files are created. Hence the `WorkspaceEdit` can not manipulate the content of the file + --- to be created. + --- @since 3.16.0 + workspace_willCreateFiles = 'workspace/willCreateFiles', + --- The will rename files request is sent from the client to the server before files are actually + --- renamed as long as the rename is triggered from within the client. + --- @since 3.16.0 + workspace_willRenameFiles = 'workspace/willRenameFiles', + --- The did delete files notification is sent from the client to the server when + --- files were deleted from within the client. + --- @since 3.16.0 + workspace_willDeleteFiles = 'workspace/willDeleteFiles', + --- @since 3.17.0 + workspace_inlineValue_refresh = 'workspace/inlineValue/refresh', + --- @since 3.17.0 + workspace_inlayHint_refresh = 'workspace/inlayHint/refresh', + --- The workspace diagnostic request definition. + --- @since 3.17.0 + workspace_diagnostic = 'workspace/diagnostic', + --- The diagnostic refresh request definition. + --- @since 3.17.0 + workspace_diagnostic_refresh = 'workspace/diagnostic/refresh', + --- A request to list project-wide symbols matching the query string given + --- by the {@link WorkspaceSymbolParams}. The response is + --- of type {@link SymbolInformation SymbolInformation[]} or a Thenable that + --- resolves to such. + --- @since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients + --- need to advertise support for WorkspaceSymbols via the client capability + --- `workspace.symbol.resolveSupport`. + workspace_symbol = 'workspace/symbol', + --- A request to refresh all code actions + --- @since 3.16.0 + workspace_codeLens_refresh = 'workspace/codeLens/refresh', + --- A request send from the client to the server to execute a command. The request might return + --- a workspace edit which the client will apply to the workspace. + workspace_executeCommand = 'workspace/executeCommand', + --- A request sent from the server to the client to modified certain resources. + workspace_applyEdit = 'workspace/applyEdit', + --- The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress + --- reporting from the server. + window_workDoneProgress_create = 'window/workDoneProgress/create', + --- A request to resolve the incoming calls for a given `CallHierarchyItem`. + --- @since 3.16.0 + callHierarchy_incomingCalls = 'callHierarchy/incomingCalls', + --- A request to resolve the outgoing calls for a given `CallHierarchyItem`. + --- @since 3.16.0 + callHierarchy_outgoingCalls = 'callHierarchy/outgoingCalls', + --- A request to show a document. This request might open an + --- external program depending on the value of the URI to open. + --- For example a request to open `https://code.visualstudio.com/` + --- will very likely open the URI in a WEB browser. + --- @since 3.16.0 + window_showDocument = 'window/showDocument', + --- A request to resolve the supertypes for a given `TypeHierarchyItem`. + --- @since 3.17.0 + typeHierarchy_supertypes = 'typeHierarchy/supertypes', + --- A request to resolve the subtypes for a given `TypeHierarchyItem`. + --- @since 3.17.0 + typeHierarchy_subtypes = 'typeHierarchy/subtypes', + --- A request to resolve additional properties for an inlay hint. + --- The request's parameter is of type {@link InlayHint}, the response is + --- of type {@link InlayHint} or a Thenable that resolves to such. + --- @since 3.17.0 + inlayHint_resolve = 'inlayHint/resolve', + --- The show message request is sent from the server to the client to show a message + --- and a set of options actions to the user. + window_showMessageRequest = 'window/showMessageRequest', + --- Request to resolve additional information for a given completion item.The request's + --- parameter is of type {@link CompletionItem} the response + --- is of type {@link CompletionItem} or a Thenable that resolves to such. + completionItem_resolve = 'completionItem/resolve', + --- Request to resolve additional information for a given code action.The request's + --- parameter is of type {@link CodeAction} the response + --- is of type {@link CodeAction} or a Thenable that resolves to such. + codeAction_resolve = 'codeAction/resolve', + --- A request to resolve the range inside the workspace + --- symbol's location. + --- @since 3.17.0 + workspaceSymbol_resolve = 'workspaceSymbol/resolve', + --- A request to resolve a command for a given code lens. + codeLens_resolve = 'codeLens/resolve', + --- Request to resolve additional information for a given document link. The request's + --- parameter is of type {@link DocumentLink} the response + --- is of type {@link DocumentLink} or a Thenable that resolves to such. + documentLink_resolve = 'documentLink/resolve', +} +local function freeze(t) + return setmetatable({}, { + __index = t, + __newindex = function() + error('cannot modify immutable table') + end, + }) +end +protocol.Methods = freeze(protocol.Methods) + return protocol -- cgit From f41496ce74fb30c18bb9a03027a172800b269643 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 1 Aug 2023 15:52:53 +0200 Subject: feat(gen_lsp.lua): sort by name, handle failure #24504 --- runtime/lua/vim/lsp/protocol.lua | 362 +++++++++++++++++++-------------------- 1 file changed, 181 insertions(+), 181 deletions(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index e45baa59c5..3844c697c6 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -923,110 +923,62 @@ function protocol.resolve_capabilities(server_capabilities) return server_capabilities end --- Generated by lsp_types.lua, keep at end of file. +-- Generated by gen_lsp.lua, keep at end of file. --- LSP method names. --- ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#metaModel protocol.Methods = { + --- A request to resolve the incoming calls for a given `CallHierarchyItem`. + --- @since 3.16.0 + callHierarchy_incomingCalls = 'callHierarchy/incomingCalls', + --- A request to resolve the outgoing calls for a given `CallHierarchyItem`. + --- @since 3.16.0 + callHierarchy_outgoingCalls = 'callHierarchy/outgoingCalls', + --- The `client/registerCapability` request is sent from the server to the client to register a new capability + --- handler on the client side. + client_registerCapability = 'client/registerCapability', + --- The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability + --- handler on the client side. + client_unregisterCapability = 'client/unregisterCapability', + --- Request to resolve additional information for a given code action.The request's + --- parameter is of type {@link CodeAction} the response + --- is of type {@link CodeAction} or a Thenable that resolves to such. + codeAction_resolve = 'codeAction/resolve', + --- A request to resolve a command for a given code lens. + codeLens_resolve = 'codeLens/resolve', + --- Request to resolve additional information for a given completion item.The request's + --- parameter is of type {@link CompletionItem} the response + --- is of type {@link CompletionItem} or a Thenable that resolves to such. + completionItem_resolve = 'completionItem/resolve', + --- Request to resolve additional information for a given document link. The request's + --- parameter is of type {@link DocumentLink} the response + --- is of type {@link DocumentLink} or a Thenable that resolves to such. + documentLink_resolve = 'documentLink/resolve', --- The initialize request is sent from the client to the server. --- It is sent once as the request after starting up the server. --- The requests parameter is of type {@link InitializeParams} --- the response if of type {@link InitializeResult} of a Thenable that --- resolves to such. initialize = 'initialize', + --- A request to resolve additional properties for an inlay hint. + --- The request's parameter is of type {@link InlayHint}, the response is + --- of type {@link InlayHint} or a Thenable that resolves to such. + --- @since 3.17.0 + inlayHint_resolve = 'inlayHint/resolve', --- A shutdown request is sent from the client to the server. --- It is sent once when the client decides to shutdown the --- server. The only notification that is sent after a shutdown request --- is the exit event. shutdown = 'shutdown', - --- The `client/registerCapability` request is sent from the server to the client to register a new capability - --- handler on the client side. - client_registerCapability = 'client/registerCapability', - --- The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability - --- handler on the client side. - client_unregisterCapability = 'client/unregisterCapability', - --- A request to resolve the implementation locations of a symbol at a given text - --- document position. The request's parameter is of type [TextDocumentPositionParams] - --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a - --- Thenable that resolves to such. - textDocument_implementation = 'textDocument/implementation', - --- A request to resolve the type definition locations of a symbol at a given text - --- document position. The request's parameter is of type [TextDocumentPositionParams] - --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a - --- Thenable that resolves to such. - textDocument_typeDefinition = 'textDocument/typeDefinition', - --- A request to list all color symbols found in a given text document. The request's - --- parameter is of type {@link DocumentColorParams} the - --- response is of type {@link ColorInformation ColorInformation[]} or a Thenable - --- that resolves to such. - textDocument_documentColor = 'textDocument/documentColor', + --- A request to provide commands for the given text document and range. + textDocument_codeAction = 'textDocument/codeAction', + --- A request to provide code lens for the given text document. + textDocument_codeLens = 'textDocument/codeLens', --- A request to list all presentation for a color. The request's --- parameter is of type {@link ColorPresentationParams} the --- response is of type {@link ColorInformation ColorInformation[]} or a Thenable --- that resolves to such. textDocument_colorPresentation = 'textDocument/colorPresentation', - --- A request to provide folding ranges in a document. The request's - --- parameter is of type {@link FoldingRangeParams}, the - --- response is of type {@link FoldingRangeList} or a Thenable - --- that resolves to such. - textDocument_foldingRange = 'textDocument/foldingRange', - --- A request to resolve the type definition locations of a symbol at a given text - --- document position. The request's parameter is of type [TextDocumentPositionParams] - --- (#TextDocumentPositionParams) the response is of type {@link Declaration} - --- or a typed array of {@link DeclarationLink} or a Thenable that resolves - --- to such. - textDocument_declaration = 'textDocument/declaration', - --- A request to provide selection ranges in a document. The request's - --- parameter is of type {@link SelectionRangeParams}, the - --- response is of type {@link SelectionRange SelectionRange[]} or a Thenable - --- that resolves to such. - textDocument_selectionRange = 'textDocument/selectionRange', - --- A request to result a `CallHierarchyItem` in a document at a given position. - --- Can be used as an input to an incoming or outgoing call hierarchy. - --- @since 3.16.0 - textDocument_prepareCallHierarchy = 'textDocument/prepareCallHierarchy', - --- @since 3.16.0 - textDocument_semanticTokens_full = 'textDocument/semanticTokens/full', - --- @since 3.16.0 - textDocument_semanticTokens_full_delta = 'textDocument/semanticTokens/full/delta', - --- @since 3.16.0 - textDocument_semanticTokens_range = 'textDocument/semanticTokens/range', - --- A request to provide ranges that can be edited together. - --- @since 3.16.0 - textDocument_linkedEditingRange = 'textDocument/linkedEditingRange', - --- A request to get the moniker of a symbol at a given text document position. - --- The request parameter is of type {@link TextDocumentPositionParams}. - --- The response is of type {@link Moniker Moniker[]} or `null`. - textDocument_moniker = 'textDocument/moniker', - --- A request to result a `TypeHierarchyItem` in a document at a given position. - --- Can be used as an input to a subtypes or supertypes type hierarchy. - --- @since 3.17.0 - textDocument_prepareTypeHierarchy = 'textDocument/prepareTypeHierarchy', - --- A request to provide inline values in a document. The request's parameter is of - --- type {@link InlineValueParams}, the response is of type - --- {@link InlineValue InlineValue[]} or a Thenable that resolves to such. - --- @since 3.17.0 - textDocument_inlineValue = 'textDocument/inlineValue', - --- A request to provide inlay hints in a document. The request's parameter is of - --- type {@link InlayHintsParams}, the response is of type - --- {@link InlayHint InlayHint[]} or a Thenable that resolves to such. - --- @since 3.17.0 - textDocument_inlayHint = 'textDocument/inlayHint', - --- The document diagnostic request definition. - --- @since 3.17.0 - textDocument_diagnostic = 'textDocument/diagnostic', - --- A request to provide inline completions in a document. The request's parameter is of - --- type {@link InlineCompletionParams}, the response is of type - --- {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such. - --- @since 3.18.0 - textDocument_inlineCompletion = 'textDocument/inlineCompletion', - --- A document will save request is sent from the client to the server before - --- the document is actually saved. The request can return an array of TextEdits - --- which will be applied to the text document before it is saved. Please note that - --- clients might drop results if computing the text edits took too long or if a - --- server constantly fails on this request. This is done to keep the save fast and - --- reliable. - textDocument_willSaveWaitUntil = 'textDocument/willSaveWaitUntil', --- Request to request completion at a given text document position. The request's --- parameter is of type {@link TextDocumentPosition} the response --- is of type {@link CompletionItem CompletionItem[]} or {@link CompletionList} @@ -1036,55 +988,153 @@ protocol.Methods = { --- request. However, properties that are needed for the initial sorting and filtering, like `sortText`, --- `filterText`, `insertText`, and `textEdit`, must not be changed during resolve. textDocument_completion = 'textDocument/completion', - --- Request to request hover information at a given text document position. The request's - --- parameter is of type {@link TextDocumentPosition} the response is of - --- type {@link Hover} or a Thenable that resolves to such. - textDocument_hover = 'textDocument/hover', - textDocument_signatureHelp = 'textDocument/signatureHelp', + --- A request to resolve the type definition locations of a symbol at a given text + --- document position. The request's parameter is of type [TextDocumentPositionParams] + --- (#TextDocumentPositionParams) the response is of type {@link Declaration} + --- or a typed array of {@link DeclarationLink} or a Thenable that resolves + --- to such. + textDocument_declaration = 'textDocument/declaration', --- A request to resolve the definition location of a symbol at a given text --- document position. The request's parameter is of type [TextDocumentPosition] --- (#TextDocumentPosition) the response is of either type {@link Definition} --- or a typed array of {@link DefinitionLink} or a Thenable that resolves --- to such. textDocument_definition = 'textDocument/definition', - --- A request to resolve project-wide references for the symbol denoted - --- by the given text document position. The request's parameter is of - --- type {@link ReferenceParams} the response is of type - --- {@link Location Location[]} or a Thenable that resolves to such. - textDocument_references = 'textDocument/references', + --- The document diagnostic request definition. + --- @since 3.17.0 + textDocument_diagnostic = 'textDocument/diagnostic', + --- A request to list all color symbols found in a given text document. The request's + --- parameter is of type {@link DocumentColorParams} the + --- response is of type {@link ColorInformation ColorInformation[]} or a Thenable + --- that resolves to such. + textDocument_documentColor = 'textDocument/documentColor', --- Request to resolve a {@link DocumentHighlight} for a given --- text document position. The request's parameter is of type [TextDocumentPosition] --- (#TextDocumentPosition) the request response is of type [DocumentHighlight[]] --- (#DocumentHighlight) or a Thenable that resolves to such. textDocument_documentHighlight = 'textDocument/documentHighlight', + --- A request to provide document links + textDocument_documentLink = 'textDocument/documentLink', --- A request to list all symbols found in a given text document. The request's --- parameter is of type {@link TextDocumentIdentifier} the --- response is of type {@link SymbolInformation SymbolInformation[]} or a Thenable --- that resolves to such. textDocument_documentSymbol = 'textDocument/documentSymbol', - --- A request to provide commands for the given text document and range. - textDocument_codeAction = 'textDocument/codeAction', - --- A request to provide code lens for the given text document. - textDocument_codeLens = 'textDocument/codeLens', - --- A request to provide document links - textDocument_documentLink = 'textDocument/documentLink', - --- A request to to format a whole document. + --- A request to provide folding ranges in a document. The request's + --- parameter is of type {@link FoldingRangeParams}, the + --- response is of type {@link FoldingRangeList} or a Thenable + --- that resolves to such. + textDocument_foldingRange = 'textDocument/foldingRange', + --- A request to format a whole document. textDocument_formatting = 'textDocument/formatting', + --- Request to request hover information at a given text document position. The request's + --- parameter is of type {@link TextDocumentPosition} the response is of + --- type {@link Hover} or a Thenable that resolves to such. + textDocument_hover = 'textDocument/hover', + --- A request to resolve the implementation locations of a symbol at a given text + --- document position. The request's parameter is of type [TextDocumentPositionParams] + --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a + --- Thenable that resolves to such. + textDocument_implementation = 'textDocument/implementation', + --- A request to provide inlay hints in a document. The request's parameter is of + --- type {@link InlayHintsParams}, the response is of type + --- {@link InlayHint InlayHint[]} or a Thenable that resolves to such. + --- @since 3.17.0 + textDocument_inlayHint = 'textDocument/inlayHint', + --- A request to provide inline completions in a document. The request's parameter is of + --- type {@link InlineCompletionParams}, the response is of type + --- {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such. + --- @since 3.18.0 + textDocument_inlineCompletion = 'textDocument/inlineCompletion', + --- A request to provide inline values in a document. The request's parameter is of + --- type {@link InlineValueParams}, the response is of type + --- {@link InlineValue InlineValue[]} or a Thenable that resolves to such. + --- @since 3.17.0 + textDocument_inlineValue = 'textDocument/inlineValue', + --- A request to provide ranges that can be edited together. + --- @since 3.16.0 + textDocument_linkedEditingRange = 'textDocument/linkedEditingRange', + --- A request to get the moniker of a symbol at a given text document position. + --- The request parameter is of type {@link TextDocumentPositionParams}. + --- The response is of type {@link Moniker Moniker[]} or `null`. + textDocument_moniker = 'textDocument/moniker', + --- A request to format a document on type. + textDocument_onTypeFormatting = 'textDocument/onTypeFormatting', + --- A request to result a `CallHierarchyItem` in a document at a given position. + --- Can be used as an input to an incoming or outgoing call hierarchy. + --- @since 3.16.0 + textDocument_prepareCallHierarchy = 'textDocument/prepareCallHierarchy', + --- A request to test and perform the setup necessary for a rename. + --- @since 3.16 - support for default behavior + textDocument_prepareRename = 'textDocument/prepareRename', + --- A request to result a `TypeHierarchyItem` in a document at a given position. + --- Can be used as an input to a subtypes or supertypes type hierarchy. + --- @since 3.17.0 + textDocument_prepareTypeHierarchy = 'textDocument/prepareTypeHierarchy', --- A request to format a range in a document. textDocument_rangeFormatting = 'textDocument/rangeFormatting', --- A request to format ranges in a document. --- @since 3.18.0 --- @proposed textDocument_rangesFormatting = 'textDocument/rangesFormatting', - --- A request to format a document on type. - textDocument_onTypeFormatting = 'textDocument/onTypeFormatting', + --- A request to resolve project-wide references for the symbol denoted + --- by the given text document position. The request's parameter is of + --- type {@link ReferenceParams} the response is of type + --- {@link Location Location[]} or a Thenable that resolves to such. + textDocument_references = 'textDocument/references', --- A request to rename a symbol. textDocument_rename = 'textDocument/rename', - --- A request to test and perform the setup necessary for a rename. - --- @since 3.16 - support for default behavior - textDocument_prepareRename = 'textDocument/prepareRename', - --- The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders. - workspace_workspaceFolders = 'workspace/workspaceFolders', + --- A request to provide selection ranges in a document. The request's + --- parameter is of type {@link SelectionRangeParams}, the + --- response is of type {@link SelectionRange SelectionRange[]} or a Thenable + --- that resolves to such. + textDocument_selectionRange = 'textDocument/selectionRange', + --- @since 3.16.0 + textDocument_semanticTokens_full = 'textDocument/semanticTokens/full', + --- @since 3.16.0 + textDocument_semanticTokens_full_delta = 'textDocument/semanticTokens/full/delta', + --- @since 3.16.0 + textDocument_semanticTokens_range = 'textDocument/semanticTokens/range', + textDocument_signatureHelp = 'textDocument/signatureHelp', + --- A request to resolve the type definition locations of a symbol at a given text + --- document position. The request's parameter is of type [TextDocumentPositionParams] + --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a + --- Thenable that resolves to such. + textDocument_typeDefinition = 'textDocument/typeDefinition', + --- A document will save request is sent from the client to the server before + --- the document is actually saved. The request can return an array of TextEdits + --- which will be applied to the text document before it is saved. Please note that + --- clients might drop results if computing the text edits took too long or if a + --- server constantly fails on this request. This is done to keep the save fast and + --- reliable. + textDocument_willSaveWaitUntil = 'textDocument/willSaveWaitUntil', + --- A request to resolve the subtypes for a given `TypeHierarchyItem`. + --- @since 3.17.0 + typeHierarchy_subtypes = 'typeHierarchy/subtypes', + --- A request to resolve the supertypes for a given `TypeHierarchyItem`. + --- @since 3.17.0 + typeHierarchy_supertypes = 'typeHierarchy/supertypes', + --- A request to show a document. This request might open an + --- external program depending on the value of the URI to open. + --- For example a request to open `https://code.visualstudio.com/` + --- will very likely open the URI in a WEB browser. + --- @since 3.16.0 + window_showDocument = 'window/showDocument', + --- The show message request is sent from the server to the client to show a message + --- and a set of options actions to the user. + window_showMessageRequest = 'window/showMessageRequest', + --- The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress + --- reporting from the server. + window_workDoneProgress_create = 'window/workDoneProgress/create', + --- A request to resolve the range inside the workspace + --- symbol's location. + --- @since 3.17.0 + workspaceSymbol_resolve = 'workspaceSymbol/resolve', + --- A request sent from the server to the client to modified certain resources. + workspace_applyEdit = 'workspace/applyEdit', + --- A request to refresh all code actions + --- @since 3.16.0 + workspace_codeLens_refresh = 'workspace/codeLens/refresh', --- The 'workspace/configuration' request is sent from the server to the client to fetch a certain --- configuration setting. --- This pull model replaces the old push model were the client signaled configuration change via an @@ -1092,33 +1142,21 @@ protocol.Methods = { --- result of `workspace/configuration` requests) the server should register for an empty configuration --- change event and empty the cache if such an event is received. workspace_configuration = 'workspace/configuration', - --- @since 3.16.0 - workspace_semanticTokens_refresh = 'workspace/semanticTokens/refresh', - --- The will create files request is sent from the client to the server before files are actually - --- created as long as the creation is triggered from within the client. - --- The request can return a `WorkspaceEdit` which will be applied to workspace before the - --- files are created. Hence the `WorkspaceEdit` can not manipulate the content of the file - --- to be created. - --- @since 3.16.0 - workspace_willCreateFiles = 'workspace/willCreateFiles', - --- The will rename files request is sent from the client to the server before files are actually - --- renamed as long as the rename is triggered from within the client. - --- @since 3.16.0 - workspace_willRenameFiles = 'workspace/willRenameFiles', - --- The did delete files notification is sent from the client to the server when - --- files were deleted from within the client. - --- @since 3.16.0 - workspace_willDeleteFiles = 'workspace/willDeleteFiles', - --- @since 3.17.0 - workspace_inlineValue_refresh = 'workspace/inlineValue/refresh', - --- @since 3.17.0 - workspace_inlayHint_refresh = 'workspace/inlayHint/refresh', --- The workspace diagnostic request definition. --- @since 3.17.0 workspace_diagnostic = 'workspace/diagnostic', --- The diagnostic refresh request definition. --- @since 3.17.0 workspace_diagnostic_refresh = 'workspace/diagnostic/refresh', + --- A request send from the client to the server to execute a command. The request might return + --- a workspace edit which the client will apply to the workspace. + workspace_executeCommand = 'workspace/executeCommand', + --- @since 3.17.0 + workspace_inlayHint_refresh = 'workspace/inlayHint/refresh', + --- @since 3.17.0 + workspace_inlineValue_refresh = 'workspace/inlineValue/refresh', + --- @since 3.16.0 + workspace_semanticTokens_refresh = 'workspace/semanticTokens/refresh', --- A request to list project-wide symbols matching the query string given --- by the {@link WorkspaceSymbolParams}. The response is --- of type {@link SymbolInformation SymbolInformation[]} or a Thenable that @@ -1127,61 +1165,23 @@ protocol.Methods = { --- need to advertise support for WorkspaceSymbols via the client capability --- `workspace.symbol.resolveSupport`. workspace_symbol = 'workspace/symbol', - --- A request to refresh all code actions - --- @since 3.16.0 - workspace_codeLens_refresh = 'workspace/codeLens/refresh', - --- A request send from the client to the server to execute a command. The request might return - --- a workspace edit which the client will apply to the workspace. - workspace_executeCommand = 'workspace/executeCommand', - --- A request sent from the server to the client to modified certain resources. - workspace_applyEdit = 'workspace/applyEdit', - --- The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress - --- reporting from the server. - window_workDoneProgress_create = 'window/workDoneProgress/create', - --- A request to resolve the incoming calls for a given `CallHierarchyItem`. + --- The will create files request is sent from the client to the server before files are actually + --- created as long as the creation is triggered from within the client. + --- The request can return a `WorkspaceEdit` which will be applied to workspace before the + --- files are created. Hence the `WorkspaceEdit` can not manipulate the content of the file + --- to be created. --- @since 3.16.0 - callHierarchy_incomingCalls = 'callHierarchy/incomingCalls', - --- A request to resolve the outgoing calls for a given `CallHierarchyItem`. + workspace_willCreateFiles = 'workspace/willCreateFiles', + --- The did delete files notification is sent from the client to the server when + --- files were deleted from within the client. --- @since 3.16.0 - callHierarchy_outgoingCalls = 'callHierarchy/outgoingCalls', - --- A request to show a document. This request might open an - --- external program depending on the value of the URI to open. - --- For example a request to open `https://code.visualstudio.com/` - --- will very likely open the URI in a WEB browser. + workspace_willDeleteFiles = 'workspace/willDeleteFiles', + --- The will rename files request is sent from the client to the server before files are actually + --- renamed as long as the rename is triggered from within the client. --- @since 3.16.0 - window_showDocument = 'window/showDocument', - --- A request to resolve the supertypes for a given `TypeHierarchyItem`. - --- @since 3.17.0 - typeHierarchy_supertypes = 'typeHierarchy/supertypes', - --- A request to resolve the subtypes for a given `TypeHierarchyItem`. - --- @since 3.17.0 - typeHierarchy_subtypes = 'typeHierarchy/subtypes', - --- A request to resolve additional properties for an inlay hint. - --- The request's parameter is of type {@link InlayHint}, the response is - --- of type {@link InlayHint} or a Thenable that resolves to such. - --- @since 3.17.0 - inlayHint_resolve = 'inlayHint/resolve', - --- The show message request is sent from the server to the client to show a message - --- and a set of options actions to the user. - window_showMessageRequest = 'window/showMessageRequest', - --- Request to resolve additional information for a given completion item.The request's - --- parameter is of type {@link CompletionItem} the response - --- is of type {@link CompletionItem} or a Thenable that resolves to such. - completionItem_resolve = 'completionItem/resolve', - --- Request to resolve additional information for a given code action.The request's - --- parameter is of type {@link CodeAction} the response - --- is of type {@link CodeAction} or a Thenable that resolves to such. - codeAction_resolve = 'codeAction/resolve', - --- A request to resolve the range inside the workspace - --- symbol's location. - --- @since 3.17.0 - workspaceSymbol_resolve = 'workspaceSymbol/resolve', - --- A request to resolve a command for a given code lens. - codeLens_resolve = 'codeLens/resolve', - --- Request to resolve additional information for a given document link. The request's - --- parameter is of type {@link DocumentLink} the response - --- is of type {@link DocumentLink} or a Thenable that resolves to such. - documentLink_resolve = 'documentLink/resolve', + workspace_willRenameFiles = 'workspace/willRenameFiles', + --- The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders. + workspace_workspaceFolders = 'workspace/workspaceFolders', } local function freeze(t) return setmetatable({}, { -- cgit From 214b125132778c5d51d4d7e673d31a9be835e150 Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 3 Aug 2023 17:52:21 +0800 Subject: fix(gen_lsp.lua): no notifications in lsp.Methods #24530 Problem: - Notifications are missing from `lsp.Methods`. - Need a way to represent `$/` prefixed methods. Solution: - Generate notifications. - Use "dollar_" prefix for `$/` methods. --- runtime/lua/vim/lsp/protocol.lua | 86 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 3844c697c6..0755fa991f 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -954,22 +954,46 @@ protocol.Methods = { --- parameter is of type {@link DocumentLink} the response --- is of type {@link DocumentLink} or a Thenable that resolves to such. documentLink_resolve = 'documentLink/resolve', + dollar_cancelRequest = '$/cancelRequest', + dollar_logTrace = '$/logTrace', + dollar_progress = '$/progress', + dollar_setTrace = '$/setTrace', + --- The exit event is sent from the client to the server to + --- ask the server to exit its process. + exit = 'exit', --- The initialize request is sent from the client to the server. --- It is sent once as the request after starting up the server. --- The requests parameter is of type {@link InitializeParams} --- the response if of type {@link InitializeResult} of a Thenable that --- resolves to such. initialize = 'initialize', + --- The initialized notification is sent from the client to the + --- server after the client is fully initialized and the server + --- is allowed to send requests from the server to the client. + initialized = 'initialized', --- A request to resolve additional properties for an inlay hint. --- The request's parameter is of type {@link InlayHint}, the response is --- of type {@link InlayHint} or a Thenable that resolves to such. --- @since 3.17.0 inlayHint_resolve = 'inlayHint/resolve', + notebookDocument_didChange = 'notebookDocument/didChange', + --- A notification sent when a notebook closes. + --- @since 3.17.0 + notebookDocument_didClose = 'notebookDocument/didClose', + --- A notification sent when a notebook opens. + --- @since 3.17.0 + notebookDocument_didOpen = 'notebookDocument/didOpen', + --- A notification sent when a notebook document is saved. + --- @since 3.17.0 + notebookDocument_didSave = 'notebookDocument/didSave', --- A shutdown request is sent from the client to the server. --- It is sent once when the client decides to shutdown the --- server. The only notification that is sent after a shutdown request --- is the exit event. shutdown = 'shutdown', + --- The telemetry event notification is sent from the server to the client to ask + --- the client to log telemetry data. + telemetry_event = 'telemetry/event', --- A request to provide commands for the given text document and range. textDocument_codeAction = 'textDocument/codeAction', --- A request to provide code lens for the given text document. @@ -1003,6 +1027,29 @@ protocol.Methods = { --- The document diagnostic request definition. --- @since 3.17.0 textDocument_diagnostic = 'textDocument/diagnostic', + --- The document change notification is sent from the client to the server to signal + --- changes to a text document. + textDocument_didChange = 'textDocument/didChange', + --- The document close notification is sent from the client to the server when + --- the document got closed in the client. The document's truth now exists where + --- the document's uri points to (e.g. if the document's uri is a file uri the + --- truth now exists on disk). As with the open notification the close notification + --- is about managing the document's content. Receiving a close notification + --- doesn't mean that the document was open in an editor before. A close + --- notification requires a previous open notification to be sent. + textDocument_didClose = 'textDocument/didClose', + --- The document open notification is sent from the client to the server to signal + --- newly opened text documents. The document's truth is now managed by the client + --- and the server must not try to read the document's truth using the document's + --- uri. Open in this sense means it is managed by the client. It doesn't necessarily + --- mean that its content is presented in an editor. An open notification must not + --- be sent more than once without a corresponding close notification send before. + --- This means open and close notification must be balanced and the max open count + --- is one. + textDocument_didOpen = 'textDocument/didOpen', + --- The document save notification is sent from the client to the server when + --- the document got saved in the client. + textDocument_didSave = 'textDocument/didSave', --- A request to list all color symbols found in a given text document. The request's --- parameter is of type {@link DocumentColorParams} the --- response is of type {@link ColorInformation ColorInformation[]} or a Thenable @@ -1025,7 +1072,7 @@ protocol.Methods = { --- response is of type {@link FoldingRangeList} or a Thenable --- that resolves to such. textDocument_foldingRange = 'textDocument/foldingRange', - --- A request to format a whole document. + --- A request to to format a whole document. textDocument_formatting = 'textDocument/formatting', --- Request to request hover information at a given text document position. The request's --- parameter is of type {@link TextDocumentPosition} the response is of @@ -1071,6 +1118,9 @@ protocol.Methods = { --- Can be used as an input to a subtypes or supertypes type hierarchy. --- @since 3.17.0 textDocument_prepareTypeHierarchy = 'textDocument/prepareTypeHierarchy', + --- Diagnostics notification are sent from the server to the client to signal + --- results of validation runs. + textDocument_publishDiagnostics = 'textDocument/publishDiagnostics', --- A request to format a range in a document. textDocument_rangeFormatting = 'textDocument/rangeFormatting', --- A request to format ranges in a document. @@ -1101,6 +1151,9 @@ protocol.Methods = { --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a --- Thenable that resolves to such. textDocument_typeDefinition = 'textDocument/typeDefinition', + --- A document will save notification is sent from the client to the server before + --- the document is actually saved. + textDocument_willSave = 'textDocument/willSave', --- A document will save request is sent from the client to the server before --- the document is actually saved. The request can return an array of TextEdits --- which will be applied to the text document before it is saved. Please note that @@ -1114,15 +1167,24 @@ protocol.Methods = { --- A request to resolve the supertypes for a given `TypeHierarchyItem`. --- @since 3.17.0 typeHierarchy_supertypes = 'typeHierarchy/supertypes', + --- The log message notification is sent from the server to the client to ask + --- the client to log a particular message. + window_logMessage = 'window/logMessage', --- A request to show a document. This request might open an --- external program depending on the value of the URI to open. --- For example a request to open `https://code.visualstudio.com/` --- will very likely open the URI in a WEB browser. --- @since 3.16.0 window_showDocument = 'window/showDocument', + --- The show message notification is sent from a server to a client to ask + --- the client to display a particular message in the user interface. + window_showMessage = 'window/showMessage', --- The show message request is sent from the server to the client to show a message --- and a set of options actions to the user. window_showMessageRequest = 'window/showMessageRequest', + --- The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress + --- initiated on the server side. + window_workDoneProgress_cancel = 'window/workDoneProgress/cancel', --- The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress --- reporting from the server. window_workDoneProgress_create = 'window/workDoneProgress/create', @@ -1148,6 +1210,28 @@ protocol.Methods = { --- The diagnostic refresh request definition. --- @since 3.17.0 workspace_diagnostic_refresh = 'workspace/diagnostic/refresh', + --- The configuration change notification is sent from the client to the server + --- when the client's configuration has changed. The notification contains + --- the changed configuration as defined by the language client. + workspace_didChangeConfiguration = 'workspace/didChangeConfiguration', + --- The watched files notification is sent from the client to the server when + --- the client detects changes to file watched by the language client. + workspace_didChangeWatchedFiles = 'workspace/didChangeWatchedFiles', + --- The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace + --- folder configuration changes. + workspace_didChangeWorkspaceFolders = 'workspace/didChangeWorkspaceFolders', + --- The did create files notification is sent from the client to the server when + --- files were created from within the client. + --- @since 3.16.0 + workspace_didCreateFiles = 'workspace/didCreateFiles', + --- The will delete files request is sent from the client to the server before files are actually + --- deleted as long as the deletion is triggered from within the client. + --- @since 3.16.0 + workspace_didDeleteFiles = 'workspace/didDeleteFiles', + --- The did rename files notification is sent from the client to the server when + --- files were renamed from within the client. + --- @since 3.16.0 + workspace_didRenameFiles = 'workspace/didRenameFiles', --- A request send from the client to the server to execute a command. The request might return --- a workspace edit which the client will apply to the workspace. workspace_executeCommand = 'workspace/executeCommand', -- cgit From f1775da07fe48da629468bcfcc2a8a6c4c3f40ed Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Fri, 20 Oct 2023 23:51:26 -0700 Subject: feat(lsp): add snippet API (#25301) --- runtime/lua/vim/lsp/protocol.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 0755fa991f..3a1b16c450 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -742,7 +742,6 @@ function protocol.make_client_capabilities() -- this should be disabled out of the box. -- However, users can turn this back on if they have a snippet plugin. snippetSupport = false, - commitCharactersSupport = false, preselectSupport = false, deprecatedSupport = false, -- cgit From 1e10310f4cc70cf95a68457c2be9e7459b5bbba6 Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Sat, 21 Oct 2023 09:47:24 +0200 Subject: refactor(lsp): move completion logic into _completion module To reduce cross-chatter between modules and for https://github.com/neovim/neovim/issues/25272 Also preparing for https://github.com/neovim/neovim/issues/25714 --- runtime/lua/vim/lsp/protocol.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 3a1b16c450..7a48c800c6 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -242,6 +242,7 @@ local constants = { -- Defines whether the insert text in a completion item should be interpreted as -- plain text or a snippet. + --- @enum lsp.InsertTextFormat InsertTextFormat = { -- The primary text to be inserted is treated as a plain string. PlainText = 1, -- cgit From 448907f65d6709fa234d8366053e33311a01bdb9 Mon Sep 17 00:00:00 2001 From: LW Date: Sun, 12 Nov 2023 04:54:27 -0800 Subject: feat(lsp)!: vim.lsp.inlay_hint.get(), enable(), is_enabled() #25512 refactor!: `vim.lsp.inlay_hint()` -> `vim.lsp.inlay_hint.enable()` Problem: The LSP specification allows inlay hints to include tooltips, clickable label parts, and code actions; but Neovim provides no API to query for these. Solution: Add minimal viable extension point from which plugins can query for inlay hints in a range, in order to build functionality on top of. Possible Next Steps --- - Add `virt_text_idx` field to `vim.fn.getmousepos()` return value, for usage in mappings of ``, ``, etc --- runtime/lua/vim/lsp/protocol.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 7a48c800c6..e2396e9a5f 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -648,7 +648,12 @@ function protocol.make_client_capabilities() inlayHint = { dynamicRegistration = true, resolveSupport = { - properties = {}, + properties = { + 'textEdits', + 'tooltip', + 'location', + 'command', + }, }, }, semanticTokens = { -- cgit From 48bcc7b9710d6db619b05254ea87f4087cdd9764 Mon Sep 17 00:00:00 2001 From: Chris Simon Date: Tue, 14 Nov 2023 05:39:43 +1100 Subject: fix(lsp): advertise workspace.didChangeConfiguration capability (#26028) This ensures workspace/didChangeConfiguration notification sent after init is correctly handled --- runtime/lua/vim/lsp/protocol.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/lua/vim/lsp/protocol.lua') diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index e2396e9a5f..a7c3914834 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -855,6 +855,9 @@ function protocol.make_client_capabilities() }, }, configuration = true, + didChangeConfiguration = { + dynamicRegistration = false, + }, workspaceFolders = true, applyEdit = true, workspaceEdit = { -- cgit