diff options
author | Chris AtLee <chris@atlee.ca> | 2023-07-20 03:03:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-20 09:03:48 +0200 |
commit | 63b3408551561127f7845470eb51404bcd6f547b (patch) | |
tree | 8dd17a411e61db4592662b2d014e5c5a5e4ff655 /runtime/lua/vim/lsp.lua | |
parent | 86ce3878d662c1dbfec61a5ad8e7c16c4283ed5c (diff) | |
download | rneovim-63b3408551561127f7845470eb51404bcd6f547b.tar.gz rneovim-63b3408551561127f7845470eb51404bcd6f547b.tar.bz2 rneovim-63b3408551561127f7845470eb51404bcd6f547b.zip |
feat(lsp): implement textDocument/diagnostic (#24128)
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r-- | runtime/lua/vim/lsp.lua | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 65cce6af47..fa2a888a54 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -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 |