Browse Source

feat: start migration to `vim.diagnostic` and providing backward compatibility with Neovim 0.5 (this will be dropped as soon as Neovim 0.7 gets released)

my-config
NTBBloodbath 3 years ago
parent
commit
c28fc45002
No known key found for this signature in database GPG Key ID: 18D6730BC846AAC5
  1. 6
      lua/doom/extras/autocmds/init.lua
  2. 2
      lua/doom/extras/keybindings/completion.lua

6
lua/doom/extras/autocmds/init.lua

@ -166,10 +166,14 @@ end
-- Show line diagnostics on hover
if not config.doom.enable_lsp_virtual_text then
local show_diagnostics_function = 'vim.diagnostic.open_float(nil, { focus = false })'
if utils.nvim_is_05 then
show_diagnostics_function = 'vim.lsp.diagnostic.show_line_diagnostics({ focusable = false, border = "single" })'
end
table.insert(autocmds["doom_extras"], {
"CursorHold,CursorHoldI",
"<buffer>",
'lua vim.lsp.diagnostic.show_line_diagnostics({ focusable = false, border = "single" })',
string.format("lua %s", show_diagnostics_function),
})
end

2
lua/doom/extras/keybindings/completion.lua

@ -59,6 +59,7 @@ mappings.map(
"Hover documentation"
)
-- Control+p: Jump to previous diagnostic
-- TODO: Find the equivalent for the new vim.diagnostic api
mappings.map(
"n",
"<C-p>",
@ -69,6 +70,7 @@ mappings.map(
"Jump to previous diagnostic"
)
-- Control+n: Jump to next diagnostic
-- TODO: Find the equivalent for the new vim.diagnostic api
mappings.map(
"n",
"<C-n>",

Loading…
Cancel
Save