feat(lsp): implement textDocument/diagnostic (#24128)

This commit is contained in:
Chris AtLee
2023-07-20 03:03:48 -04:00
committed by GitHub
parent 86ce3878d6
commit 63b3408551
10 changed files with 422 additions and 74 deletions

View File

@@ -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