mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
Merge #33660 from MariaSolOs/supports-dynamic
This commit is contained in:
@ -840,7 +840,8 @@ end
|
||||
--- Get options for a method that is registered dynamically.
|
||||
--- @param method vim.lsp.protocol.Method
|
||||
function Client:_supports_registration(method)
|
||||
local capability = vim.tbl_get(self.capabilities, unpack(vim.split(method, '/')))
|
||||
local capability_path = lsp.protocol._request_name_to_client_capability[method]
|
||||
local capability = vim.tbl_get(self.capabilities, unpack(capability_path))
|
||||
return type(capability) == 'table' and capability.dynamicRegistration
|
||||
end
|
||||
|
||||
@ -1069,7 +1070,7 @@ function Client:supports_method(method, bufnr)
|
||||
--- @diagnostic disable-next-line:no-unknown
|
||||
bufnr = bufnr.bufnr
|
||||
end
|
||||
local required_capability = lsp.protocol._request_name_to_capability[method]
|
||||
local required_capability = lsp.protocol._request_name_to_server_capability[method]
|
||||
-- if we don't know about the method, assume that the client supports it.
|
||||
if not required_capability then
|
||||
return true
|
||||
|
@ -1092,10 +1092,88 @@ protocol.Methods = {
|
||||
workspace_workspaceFolders = 'workspace/workspaceFolders',
|
||||
}
|
||||
|
||||
-- stylua: ignore start
|
||||
-- Generated by gen_lsp.lua, keep at end of file.
|
||||
--- Maps method names to the required client capability
|
||||
protocol._request_name_to_client_capability = {
|
||||
['codeAction/resolve'] = { 'textDocument', 'codeAction', 'resolveSupport' },
|
||||
['codeLens/resolve'] = { 'textDocument', 'codeLens', 'resolveSupport' },
|
||||
['completionItem/resolve'] = { 'textDocument', 'completion', 'completionItem', 'resolveSupport' },
|
||||
['documentLink/resolve'] = { 'textDocument', 'documentLink' },
|
||||
['inlayHint/resolve'] = { 'textDocument', 'inlayHint', 'resolveSupport' },
|
||||
['textDocument/codeAction'] = { 'textDocument', 'codeAction' },
|
||||
['textDocument/codeLens'] = { 'textDocument', 'codeLens' },
|
||||
['textDocument/completion'] = { 'textDocument', 'completion' },
|
||||
['textDocument/declaration'] = { 'textDocument', 'declaration' },
|
||||
['textDocument/definition'] = { 'textDocument', 'definition' },
|
||||
['textDocument/diagnostic'] = { 'textDocument', 'diagnostic' },
|
||||
['textDocument/didChange'] = { 'textDocument', 'synchronization' },
|
||||
['textDocument/didClose'] = { 'textDocument', 'synchronization' },
|
||||
['textDocument/didOpen'] = { 'textDocument', 'synchronization' },
|
||||
['textDocument/didSave'] = { 'textDocument', 'synchronization', 'didSave' },
|
||||
['textDocument/documentColor'] = { 'textDocument', 'colorProvider' },
|
||||
['textDocument/documentHighlight'] = { 'textDocument', 'documentHighlight' },
|
||||
['textDocument/documentLink'] = { 'textDocument', 'documentLink' },
|
||||
['textDocument/documentSymbol'] = { 'textDocument', 'documentSymbol' },
|
||||
['textDocument/foldingRange'] = { 'textDocument', 'foldingRange' },
|
||||
['textDocument/formatting'] = { 'textDocument', 'formatting' },
|
||||
['textDocument/hover'] = { 'textDocument', 'hover' },
|
||||
['textDocument/implementation'] = { 'textDocument', 'implementation' },
|
||||
['textDocument/inlayHint'] = { 'textDocument', 'inlayHint' },
|
||||
['textDocument/inlineCompletion'] = { 'textDocument', 'inlineCompletion' },
|
||||
['textDocument/inlineValue'] = { 'textDocument', 'inlineValue' },
|
||||
['textDocument/linkedEditingRange'] = { 'textDocument', 'linkedEditingRange' },
|
||||
['textDocument/moniker'] = { 'textDocument', 'moniker' },
|
||||
['textDocument/onTypeFormatting'] = { 'textDocument', 'onTypeFormatting' },
|
||||
['textDocument/prepareCallHierarchy'] = { 'textDocument', 'callHierarchy' },
|
||||
['textDocument/prepareRename'] = { 'textDocument', 'rename', 'prepareSupport' },
|
||||
['textDocument/prepareTypeHierarchy'] = { 'textDocument', 'typeHierarchy' },
|
||||
['textDocument/publishDiagnostics'] = { 'textDocument', 'publishDiagnostics' },
|
||||
['textDocument/rangeFormatting'] = { 'textDocument', 'rangeFormatting' },
|
||||
['textDocument/rangesFormatting'] = { 'textDocument', 'rangeFormatting', 'rangesSupport' },
|
||||
['textDocument/references'] = { 'textDocument', 'references' },
|
||||
['textDocument/rename'] = { 'textDocument', 'rename' },
|
||||
['textDocument/selectionRange'] = { 'textDocument', 'selectionRange' },
|
||||
['textDocument/semanticTokens/full'] = { 'textDocument', 'semanticTokens' },
|
||||
['textDocument/semanticTokens/full/delta'] = { 'textDocument', 'semanticTokens', 'requests', 'full', 'delta' },
|
||||
['textDocument/semanticTokens/range'] = { 'textDocument', 'semanticTokens', 'requests', 'range' },
|
||||
['textDocument/signatureHelp'] = { 'textDocument', 'signatureHelp' },
|
||||
['textDocument/typeDefinition'] = { 'textDocument', 'typeDefinition' },
|
||||
['textDocument/willSave'] = { 'textDocument', 'synchronization', 'willSave' },
|
||||
['textDocument/willSaveWaitUntil'] = { 'textDocument', 'synchronization', 'willSaveWaitUntil' },
|
||||
['window/showDocument'] = { 'window', 'showDocument', 'support' },
|
||||
['window/showMessage'] = { 'window', 'showMessage' },
|
||||
['window/showMessageRequest'] = { 'window', 'showMessage' },
|
||||
['window/workDoneProgress/create'] = { 'window', 'workDoneProgress' },
|
||||
['workspaceSymbol/resolve'] = { 'workspace', 'symbol', 'resolveSupport' },
|
||||
['workspace/applyEdit'] = { 'workspace', 'applyEdit' },
|
||||
['workspace/codeLens/refresh'] = { 'workspace', 'codeLens' },
|
||||
['workspace/configuration'] = { 'workspace', 'configuration' },
|
||||
['workspace/diagnostic'] = { 'workspace', 'diagnostics' },
|
||||
['workspace/diagnostic/refresh'] = { 'workspace', 'diagnostics', 'refreshSupport' },
|
||||
['workspace/didChangeConfiguration'] = { 'workspace', 'didChangeConfiguration' },
|
||||
['workspace/didChangeWatchedFiles'] = { 'workspace', 'didChangeWatchedFiles' },
|
||||
['workspace/didCreateFiles'] = { 'workspace', 'fileOperations', 'didCreate' },
|
||||
['workspace/didDeleteFiles'] = { 'workspace', 'fileOperations', 'didDelete' },
|
||||
['workspace/didRenameFiles'] = { 'workspace', 'fileOperations', 'didRename' },
|
||||
['workspace/executeCommand'] = { 'workspace', 'executeCommand' },
|
||||
['workspace/foldingRange/refresh'] = { 'workspace', 'foldingRange', 'refreshSupport' },
|
||||
['workspace/inlayHint/refresh'] = { 'workspace', 'inlayHint', 'refreshSupport' },
|
||||
['workspace/inlineValue/refresh'] = { 'workspace', 'inlineValue', 'refreshSupport' },
|
||||
['workspace/semanticTokens/refresh'] = { 'workspace', 'semanticTokens', 'refreshSupport' },
|
||||
['workspace/symbol'] = { 'workspace', 'symbol' },
|
||||
['workspace/textDocumentContent'] = { 'workspace', 'textDocumentContent' },
|
||||
['workspace/willCreateFiles'] = { 'workspace', 'fileOperations', 'willCreate' },
|
||||
['workspace/willDeleteFiles'] = { 'workspace', 'fileOperations', 'willDelete' },
|
||||
['workspace/willRenameFiles'] = { 'workspace', 'fileOperations', 'willRename' },
|
||||
['workspace/workspaceFolders'] = { 'workspace', 'workspaceFolders' },
|
||||
}
|
||||
-- stylua: ignore end
|
||||
|
||||
-- stylua: ignore start
|
||||
-- Generated by gen_lsp.lua, keep at end of file.
|
||||
--- Maps method names to the required server capability
|
||||
protocol._request_name_to_capability = {
|
||||
protocol._request_name_to_server_capability = {
|
||||
['codeAction/resolve'] = { 'codeActionProvider', 'resolveProvider' },
|
||||
['codeLens/resolve'] = { 'codeLensProvider', 'resolveProvider' },
|
||||
['completionItem/resolve'] = { 'completionProvider', 'resolveProvider' },
|
||||
|
@ -7,7 +7,7 @@ Generates lua-ls annotations for lsp.
|
||||
Also updates types in runtime/lua/vim/lsp/protocol.lua
|
||||
|
||||
Usage:
|
||||
src/gen/gen_lsp.lua [options]
|
||||
nvim -l src/gen/gen_lsp.lua [options]
|
||||
|
||||
Options:
|
||||
--version <version> LSP version to use (default: 3.18)
|
||||
@ -198,12 +198,32 @@ local function write_to_vim_protocol(protocol)
|
||||
end
|
||||
|
||||
do -- capabilities
|
||||
vim.list_extend(output, {
|
||||
'',
|
||||
'-- stylua: ignore start',
|
||||
'-- Generated by gen_lsp.lua, keep at end of file.',
|
||||
'--- Maps method names to the required client capability',
|
||||
'protocol._request_name_to_client_capability = {',
|
||||
})
|
||||
|
||||
for _, item in ipairs(all) do
|
||||
if item.clientCapability then
|
||||
output[#output + 1] = (" ['%s'] = { %s },"):format(
|
||||
item.method,
|
||||
"'" .. item.clientCapability:gsub('%.', "', '") .. "'"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
output[#output + 1] = '}'
|
||||
output[#output + 1] = '-- stylua: ignore end'
|
||||
|
||||
vim.list_extend(output, {
|
||||
'',
|
||||
'-- stylua: ignore start',
|
||||
'-- Generated by gen_lsp.lua, keep at end of file.',
|
||||
'--- Maps method names to the required server capability',
|
||||
'protocol._request_name_to_capability = {',
|
||||
'protocol._request_name_to_server_capability = {',
|
||||
})
|
||||
|
||||
for _, item in ipairs(all) do
|
||||
|
Reference in New Issue
Block a user