mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 12:50:04 +08:00
fix(lsp): fix neovim lsp compatibility
close https://github.com/SpaceVim/SpaceVim/issues/4574
This commit is contained in:
parent
43674200ef
commit
5ccbb5c6a2
@ -79,10 +79,10 @@ function! SpaceVim#layers#lsp#setup() abort
|
||||
-- buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
-- buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
-- buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
-- buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
-- buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
-- buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
-- buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
-- buf_set_keymap('n', '<space>e', '<cmd>lua require("spacevim.diagnostic").show_line_diagnostics()<CR>', opts)
|
||||
-- buf_set_keymap('n', '[d', '<cmd>lua require("spacevim.diagnostic").goto_prev()<CR>', opts)
|
||||
-- buf_set_keymap('n', ']d', '<cmd>lua require("spacevim.diagnostic").goto_next()<CR>', opts)
|
||||
-- buf_set_keymap('n', '<space>q', '<cmd>lua require("spacevim.diagnostic").set_loclist()<CR>', opts)
|
||||
-- buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
|
||||
end
|
||||
|
@ -67,16 +67,16 @@ if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version()) || has('nvim-0.6.0
|
||||
return v:lua.vim.lsp.buf.server_ready()
|
||||
endfunction
|
||||
function! SpaceVim#lsp#diagnostic_set_loclist() abort
|
||||
lua vim.lsp.diagnostic.set_loclist()
|
||||
lua require('spacevim.diagnostic').set_loclist()
|
||||
endfunction
|
||||
function! SpaceVim#lsp#diagnostic_goto_next() abort
|
||||
lua vim.lsp.diagnostic.goto_next()
|
||||
lua require("spacevim.diagnostic").goto_next()
|
||||
endfunction
|
||||
function! SpaceVim#lsp#diagnostic_goto_prev() abort
|
||||
lua vim.lsp.diagnostic.goto_prev()
|
||||
lua require("spacevim.diagnostic").goto_prev()
|
||||
endfunction
|
||||
function! SpaceVim#lsp#diagnostic_clear() abort
|
||||
lua vim.lsp.diagnostic.clear(0)
|
||||
lua require("spacevim.diagnostic").hide()
|
||||
endfunction
|
||||
elseif SpaceVim#layers#isLoaded('autocomplete') && get(g:, 'spacevim_autocomplete_method') ==# 'coc'
|
||||
" use coc.nvim
|
||||
|
@ -58,10 +58,10 @@ _G.load_config = function()
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>e', '<cmd>lua require("spacevim.diagnostic").show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua require("spacevim.diagnostic").goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua require("spacevim.diagnostic").goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua require("spacevim.diagnostic").set_loclist()<CR>', opts)
|
||||
end
|
||||
|
||||
-- Add the server that troubles you here
|
||||
|
@ -15,4 +15,42 @@ function M.open_float()
|
||||
end
|
||||
|
||||
|
||||
-- *vim.lsp.diagnostic.set_loclist()* Use |vim.diagnostic.setloclist()| instead.
|
||||
-- *vim.lsp.diagnostic.set_qflist()* Use |vim.diagnostic.setqflist()| instead.
|
||||
|
||||
function M.set_loclist()
|
||||
if vim.diagnostic ~= nil then
|
||||
vim.diagnostic.setloclist()
|
||||
else
|
||||
vim.lsp.diagnostic.set_loclist()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M.goto_next()
|
||||
if vim.diagnostic ~= nil then
|
||||
vim.diagnostic.goto_next()
|
||||
else
|
||||
vim.lsp.diagnostic.goto_next()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M.goto_prev()
|
||||
if vim.diagnostic ~= nil then
|
||||
vim.diagnostic.goto_prev()
|
||||
else
|
||||
vim.lsp.diagnostic.goto_prev()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M.hide()
|
||||
if vim.diagnostic ~= nil then
|
||||
vim.diagnostic.hide()
|
||||
else
|
||||
vim.lsp.diagnostic.clear()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
Loading…
Reference in New Issue
Block a user