nvim: Update for nvim LSP diagnostics
The diagnostic-nvim plugin got merged upstream and as a result the plugin is not required anymore. LSP diagnostic highlight group names were also updated. See the below issues for notes on migration. https://github.com/neovim/neovim/pull/12655 https://github.com/nvim-lua/diagnostic-nvim/issues/73
This commit is contained in:
parent
a25d54afee
commit
50a5d55fe4
4 changed files with 26 additions and 31 deletions
|
@ -181,28 +181,32 @@ local highlight_groups = {
|
||||||
Question = {bg=black, fg=yellow, style='underline'},
|
Question = {bg=black, fg=yellow, style='underline'},
|
||||||
|
|
||||||
--[[ 4.2.11. LSP ]]
|
--[[ 4.2.11. LSP ]]
|
||||||
LspDiagnosticsError = 'Error' ,
|
LspDiagnosticsDefaultError = 'Error' ,
|
||||||
LspDiagnosticsErrorFloating = 'ErrorMsg',
|
LspDiagnosticsFloatingError = 'ErrorMsg',
|
||||||
LspDiagnosticsErrorSign = 'ErrorMsg',
|
LspDiagnosticsSignError = 'ErrorMsg',
|
||||||
|
|
||||||
LspDiagnosticsWarning = 'Warning' ,
|
LspDiagnosticsDefaultWarning = 'Warning' ,
|
||||||
LspDiagnosticsWarningFloating = 'WarningMsg',
|
LspDiagnosticsFloatingWarning = 'WarningMsg',
|
||||||
LspDiagnosticsWarningSign = 'WarningMsg',
|
LspDiagnosticsSignWarning = 'WarningMsg',
|
||||||
|
|
||||||
LspDiagnosticsHint = 'Hint' ,
|
LspDiagnosticsDefaultHint = 'Hint' ,
|
||||||
LspDiagnosticsHintFloating = 'HintMsg',
|
LspDiagnosticsFloatingHint = 'HintMsg',
|
||||||
LspDiagnosticsHintSign = 'HintMsg',
|
LspDiagnosticsSignHint = 'HintMsg',
|
||||||
|
|
||||||
LspDiagnosticsInformation = 'Info' ,
|
LspDiagnosticsDefaultInformation = 'Info' ,
|
||||||
LspDiagnosticsInformationFloating = 'InfoMsg',
|
LspDiagnosticsFloatingInformation = 'InfoMsg',
|
||||||
LspDiagnosticsInformationSign = 'InfoMsg',
|
LspDiagnosticsSignInformation = 'InfoMsg',
|
||||||
|
|
||||||
LspDiagnosticsUnderline = {style={'undercurl', color=white}},
|
|
||||||
LspDiagnosticsUnderlineError = {style={'undercurl', color=red}},
|
LspDiagnosticsUnderlineError = {style={'undercurl', color=red}},
|
||||||
LspDiagnosticsUnderlineHint = {style={'undercurl', color=purple}},
|
LspDiagnosticsUnderlineHint = {style={'undercurl', color=purple}},
|
||||||
LspDiagnosticsUnderlineInfo = {style={'undercurl', color=pink}},
|
LspDiagnosticsUnderlineInformation = {style={'undercurl', color=pink}},
|
||||||
LspDiagnosticsUnderlineWarning = {style={'undercurl', color=red}},
|
LspDiagnosticsUnderlineWarning = {style={'undercurl', color=red}},
|
||||||
|
|
||||||
|
LspDiagnosticsVirtualTextError = {color=red},
|
||||||
|
LspDiagnosticsVirtualTextHint = {color=purple},
|
||||||
|
LspDiagnosticsVirtualTextInformation = {color=pink},
|
||||||
|
LspDiagnosticsVirtualTextWarning = {color=red},
|
||||||
|
|
||||||
--[[ 4.2.12. Cursor ]]
|
--[[ 4.2.12. Cursor ]]
|
||||||
Cursor = {bg=white, fg=black, style='inverse'},
|
Cursor = {bg=white, fg=black, style='inverse'},
|
||||||
CursorIM = 'Cursor',
|
CursorIM = 'Cursor',
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
local nvim_lsp = require('lspconfig')
|
local nvim_lsp = require('lspconfig')
|
||||||
local diagnostic = require('diagnostic')
|
|
||||||
local completion = require('completion')
|
local completion = require('completion')
|
||||||
local lsp_status = require('lsp-status')
|
local lsp_status = require('lsp-status')
|
||||||
|
|
||||||
|
@ -47,7 +46,6 @@ end
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
diagnostic.on_attach(client, bufnr)
|
|
||||||
completion.on_attach(client, bufnr)
|
completion.on_attach(client, bufnr)
|
||||||
lsp_status.on_attach(client, bufnr)
|
lsp_status.on_attach(client, bufnr)
|
||||||
|
|
||||||
|
@ -65,10 +63,11 @@ local on_attach = function(client, bufnr)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<Leader>de', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<Leader>de', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'pd', '<cmd>lua peek_definition()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'pd', '<cmd>lua peek_definition()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d', ':PrevDiagnostic<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev { wrap = false }<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d', ':NextDiagnostic<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next { wrap = false }<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[D', ':PrevDiagnosticCycle<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[D', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']D', ':NextDiagnosticCycle<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']D', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'do', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
local servers = { 'hls', 'rust_analyzer' }
|
local servers = { 'hls', 'rust_analyzer' }
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
vim.g.diagnostic_enable_virtual_text = 0
|
|
||||||
vim.g.diagnostic_show_sign = 1
|
|
||||||
vim.g.diagnostic_auto_popup_while_jump = 1
|
|
||||||
vim.g.diagnostic_insert_delay = 1
|
|
|
@ -122,10 +122,6 @@ local init = function ()
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
config = "require('lsp')",
|
config = "require('lsp')",
|
||||||
}
|
}
|
||||||
use {
|
|
||||||
'nvim-lua/diagnostic-nvim',
|
|
||||||
config = "require('modules.diagnostic')"
|
|
||||||
}
|
|
||||||
use 'nvim-lua/lsp-status.nvim'
|
use 'nvim-lua/lsp-status.nvim'
|
||||||
-- Language support & syntax highlighting
|
-- Language support & syntax highlighting
|
||||||
-- Haskell
|
-- Haskell
|
||||||
|
|
Loading…
Reference in a new issue