mirror of
https://github.com/neovim/neovim.git
synced 2025-12-09 16:12:48 +00:00
feat(lsp): implement textDocument/diagnostic (#24128)
This commit is contained in:
@@ -61,6 +61,7 @@ lsp._request_name_to_capability = {
|
||||
['textDocument/semanticTokens/full'] = { 'semanticTokensProvider' },
|
||||
['textDocument/semanticTokens/full/delta'] = { 'semanticTokensProvider' },
|
||||
['textDocument/inlayHint'] = { 'inlayHintProvider' },
|
||||
['textDocument/diagnostic'] = { 'diagnosticProvider' },
|
||||
['inlayHint/resolve'] = { 'inlayHintProvider', 'resolveProvider' },
|
||||
}
|
||||
|
||||
@@ -954,6 +955,9 @@ function lsp._set_defaults(client, bufnr)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = bufnr })
|
||||
end
|
||||
end)
|
||||
if client.supports_method('textDocument/diagnostic') then
|
||||
lsp.diagnostic._enable(bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
--- @class lsp.ClientConfig
|
||||
@@ -1567,7 +1571,23 @@ function lsp.start_client(config)
|
||||
if method ~= 'textDocument/didChange' then
|
||||
changetracking.flush(client)
|
||||
end
|
||||
return rpc.notify(method, params)
|
||||
|
||||
local result = rpc.notify(method, params)
|
||||
|
||||
if result then
|
||||
vim.schedule(function()
|
||||
nvim_exec_autocmds('LspNotify', {
|
||||
modeline = false,
|
||||
data = {
|
||||
client_id = client.id,
|
||||
method = method,
|
||||
params = params,
|
||||
},
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
---@private
|
||||
|
||||
Reference in New Issue
Block a user