diff options
author | Timmy Xiao <34635512+tzx@users.noreply.github.com> | 2021-01-05 15:15:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-05 21:15:08 +0100 |
commit | 2bfd0ba8aed19e11349403578bfe305106a7fe88 (patch) | |
tree | d9f33b7e70f179c89a6d4a3c9de4a36afdbf5461 /runtime/lua/vim/lsp/protocol.lua | |
parent | 0efc71313638faa6e7d06df2663ab7e1f87ad3ba (diff) | |
download | rneovim-2bfd0ba8aed19e11349403578bfe305106a7fe88.tar.gz rneovim-2bfd0ba8aed19e11349403578bfe305106a7fe88.tar.bz2 rneovim-2bfd0ba8aed19e11349403578bfe305106a7fe88.zip |
LSP: Add diagnostic tags to client capabilities (#13578)
pyright (possibly others) does not send any hint diagnostics if we do not have tagSupport in PublishDiagnosticsClientCapabilities. This PR just adds them.
Diffstat (limited to 'runtime/lua/vim/lsp/protocol.lua')
-rw-r--r-- | runtime/lua/vim/lsp/protocol.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index b2d3d0641c..3e111c154a 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -34,6 +34,13 @@ local constants = { Hint = 4; }; + DiagnosticTag = { + -- Unused or unnecessary code + Unnecessary = 1; + -- Deprecated or obsolete code + Deprecated = 2; + }; + MessageType = { -- An error message. Error = 1; @@ -521,6 +528,13 @@ export interface TextDocumentClientCapabilities { publishDiagnostics?: { --Whether the clients accepts diagnostics with related information. relatedInformation?: boolean; + --Client supports the tag property to provide meta data about a diagnostic. + --Clients supporting tags have to handle unknown tags gracefully. + --Since 3.15.0 + tagSupport?: { + --The tags supported by this client + valueSet: DiagnosticTag[]; + }; }; --Capabilities specific to `textDocument/foldingRange` requests. -- @@ -706,6 +720,18 @@ function protocol.make_client_capabilities() dynamicRegistration = false; prepareSupport = true; }; + publishDiagnostics = { + relatedInformation = true; + tagSupport = { + valueSet = (function() + local res = {} + for k in ipairs(protocol.DiagnosticTag) do + if type(k) == 'number' then table.insert(res, k) end + end + return res + end)(); + }; + }; }; workspace = { symbol = { |