Skip to content

Commit

Permalink
fix(diagnostic): remove useless highlight links (neovim#15683)
Browse files Browse the repository at this point in the history
These links were actually defined backwards: the highlight groups
actually being used for display are the new "Diagnostic*" groups, so
linking the old "LspDiagnostics*" groups to these does absolutely
nothing, since there is nothing actually being highlighted with the
LspDiagnostics* groups.

These links were made in an attempt to preserve backward compatibility
with existing colorschemes. We could reverse the links to maintain this
preservation, but then that disallows us from actually defining default
values for the new highlight groups.

Instead, just remove the links and be done with the old LspDiagnostics*
highlight groups.

This is not technically a breaking change: the breaking change already
happened in neovim#15585, but this PR just makes that explicit.
  • Loading branch information
gpanders committed Sep 17, 2021
1 parent c2a6592 commit c13242c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 76 deletions.
26 changes: 0 additions & 26 deletions runtime/lua/vim/lsp/diagnostic.lua
Expand Up @@ -446,14 +446,6 @@ end
---
---@deprecated Prefer |vim.diagnostic._set_signs()|
---
--- Sign characters can be customized with the following commands:
---
--- <pre>
--- sign define LspDiagnosticsSignError text=E texthl=LspDiagnosticsSignError linehl= numhl=
--- sign define LspDiagnosticsSignWarning text=W texthl=LspDiagnosticsSignWarning linehl= numhl=
--- sign define LspDiagnosticsSignInformation text=I texthl=LspDiagnosticsSignInformation linehl= numhl=
--- sign define LspDiagnosticsSignHint text=H texthl=LspDiagnosticsSignHint linehl= numhl=
--- </pre>
---@param diagnostics Diagnostic[]
---@param bufnr number The buffer number
---@param client_id number the client id
Expand All @@ -478,15 +470,6 @@ end
---
---@deprecated Prefer |vim.diagnostic._set_underline()|
---
--- Underline highlights can be customized by changing the following |:highlight| groups.
---
--- <pre>
--- LspDiagnosticsUnderlineError
--- LspDiagnosticsUnderlineWarning
--- LspDiagnosticsUnderlineInformation
--- LspDiagnosticsUnderlineHint
--- </pre>
---
---@param diagnostics Diagnostic[]
---@param bufnr number: The buffer number
---@param client_id number: The client id
Expand All @@ -506,15 +489,6 @@ end
---
---@deprecated Prefer |vim.diagnostic._set_virtual_text()|
---
--- Virtual text highlights can be customized by changing the following |:highlight| groups.
---
--- <pre>
--- LspDiagnosticsVirtualTextError
--- LspDiagnosticsVirtualTextWarning
--- LspDiagnosticsVirtualTextInformation
--- LspDiagnosticsVirtualTextHint
--- </pre>
---
---@param diagnostics Diagnostic[]
---@param bufnr number
---@param client_id number
Expand Down
22 changes: 0 additions & 22 deletions runtime/plugin/diagnostic.vim
Expand Up @@ -24,25 +24,3 @@ hi default link DiagnosticSignError DiagnosticError
hi default link DiagnosticSignWarn DiagnosticWarn
hi default link DiagnosticSignInfo DiagnosticInfo
hi default link DiagnosticSignHint DiagnosticHint

" Link LspDiagnostics for backward compatibility
hi default link LspDiagnosticsDefaultHint DiagnosticHint
hi default link LspDiagnosticsVirtualTextHint DiagnosticVirtualTextHint
hi default link LspDiagnosticsFloatingHint DiagnosticFloatingHint
hi default link LspDiagnosticsSignHint DiagnosticSignHint
hi default link LspDiagnosticsDefaultError DiagnosticError
hi default link LspDiagnosticsVirtualTextError DiagnosticVirtualTextError
hi default link LspDiagnosticsFloatingError DiagnosticFloatingError
hi default link LspDiagnosticsSignError DiagnosticSignError
hi default link LspDiagnosticsDefaultWarning DiagnosticWarn
hi default link LspDiagnosticsVirtualTextWarning DiagnosticVirtualTextWarn
hi default link LspDiagnosticsFloatingWarning DiagnosticFloatingWarn
hi default link LspDiagnosticsSignWarning DiagnosticSignWarn
hi default link LspDiagnosticsDefaultInformation DiagnosticInfo
hi default link LspDiagnosticsVirtualTextInformation DiagnosticVirtualTextInfo
hi default link LspDiagnosticsFloatingInformation DiagnosticFloatingInfo
hi default link LspDiagnosticsSignInformation DiagnosticSignInfo
hi default link LspDiagnosticsUnderlineError DiagnosticUnderlineError
hi default link LspDiagnosticsUnderlineWarning DiagnosticUnderlineWarn
hi default link LspDiagnosticsUnderlineInformation DiagnosticUnderlineInfo
hi default link LspDiagnosticsUnderlineHint DiagnosticUnderlineHint
28 changes: 0 additions & 28 deletions test/functional/plugin/lsp/diagnostic_spec.lua
@@ -1,6 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)

local command = helpers.command
local clear = helpers.clear
local exec_lua = helpers.exec_lua
local eq = helpers.eq
Expand Down Expand Up @@ -945,31 +944,4 @@ describe('vim.lsp.diagnostic', function()
assert(loc_list[1].lnum < loc_list[2].lnum)
end)
end)

it('highlight groups', function()
command('runtime plugin/diagnostic.vim')
eq({
'LspDiagnosticsDefaultError',
'LspDiagnosticsDefaultHint',
'LspDiagnosticsDefaultInformation',
'LspDiagnosticsDefaultWarning',
'LspDiagnosticsFloatingError',
'LspDiagnosticsFloatingHint',
'LspDiagnosticsFloatingInformation',
'LspDiagnosticsFloatingWarning',
'LspDiagnosticsSignError',
'LspDiagnosticsSignHint',
'LspDiagnosticsSignInformation',
'LspDiagnosticsSignWarning',
'LspDiagnosticsUnderlineError',
'LspDiagnosticsUnderlineHint',
'LspDiagnosticsUnderlineInformation',
'LspDiagnosticsUnderlineWarning',
'LspDiagnosticsVirtualTextError',
'LspDiagnosticsVirtualTextHint',
'LspDiagnosticsVirtualTextInformation',
'LspDiagnosticsVirtualTextWarning',
}, exec_lua([[return vim.fn.getcompletion('Lsp', 'highlight')]]))
end)

end)

0 comments on commit c13242c

Please sign in to comment.