1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:40:03 +08:00

fix(lsp): fix SPC e l key binding

This commit is contained in:
Eric Wong 2024-05-21 12:03:22 +08:00
parent 49e00f00f5
commit 592bf3941a
3 changed files with 13 additions and 1 deletions

View File

@ -206,6 +206,7 @@ function! s:toggle_show_error(...) abort
" if buf_server_ready return false, the language server loclist
" should be cleared.
if get(getloclist(0, {'title': 0}), 'title', '') ==# 'Language Server'
\ || get(getloclist(0, {'title': 0}), 'title', '') ==# 'Diagnostics'
call setloclist(0, [], 'r')
endif
let llist = getloclist(0, {'size' : 1, 'winid' : 1})

View File

@ -66,7 +66,7 @@ if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version()) || has('nvim-0.6.0
lua vim.lsp.buf.remove_workspace_folder()
endfunction
function! SpaceVim#lsp#buf_server_ready() abort
return v:lua.vim.lsp.buf.server_ready()
return luaeval('require("spacevim.lsp").server_ready()')
endfunction
function! SpaceVim#lsp#diagnostic_set_loclist() abort
lua require('spacevim.diagnostic').set_loclist()

View File

@ -1,5 +1,9 @@
local M = {}
function M.server_ready()
return vim.b.lsp_server_ready
end
M.clients = {}
-- store the clients for different filetype
-- which can be called via vim.lsp.start_client()
@ -12,6 +16,13 @@ end
function M.setup(enabled_clients, override_client_cmds) -- {{{
local nvim_lsp = require('lspconfig')
local augroup = vim.api.nvim_create_augroup('spacevim_lsp', { clear = true })
vim.api.nvim_create_autocmd('LspAttach', {
group = augroup,
callback = function(args)
vim.api.nvim_buf_set_var(args.buf, 'lsp_server_ready', true)
end,
})
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer