mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-07-29 15:15:07 +02:00
new language servers and smart document highlighting
This commit is contained in:
parent
3266955359
commit
6ed2437edb
15 changed files with 68 additions and 9 deletions
|
@ -30,8 +30,7 @@ vim.cmd('nnoremap <silent> K :Lspsaga hover_doc<CR>')
|
|||
vim.cmd('nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>')
|
||||
vim.cmd('nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>')
|
||||
-- scroll down hover doc or scroll in definition preview
|
||||
vim.cmd(
|
||||
'nnoremap <silent> <C-f> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(1)<CR>')
|
||||
vim.cmd('nnoremap <silent> <C-f> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(1)<CR>')
|
||||
-- scroll up hover doc
|
||||
vim.cmd(
|
||||
'nnoremap <silent> <C-b> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(-1)<CR>')
|
||||
|
@ -42,3 +41,28 @@ autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100)
|
|||
autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]]
|
||||
-- Java
|
||||
-- autocmd FileType java nnoremap ca <Cmd>lua require('jdtls').code_action()<CR>
|
||||
|
||||
local lsp_config = {}
|
||||
|
||||
function lsp_config.common_on_attach(client, bufnr)
|
||||
|
||||
-- Set autocommands conditional on server_capabilities
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
vim.api.nvim_exec([[
|
||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646
|
||||
hi LspReferenceText cterm=bold ctermbg=red guibg=#464646
|
||||
hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646
|
||||
augroup lsp_document_highlight
|
||||
autocmd! * <buffer>
|
||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
||||
augroup END
|
||||
]], false)
|
||||
end
|
||||
end
|
||||
|
||||
-- Use a loop to conveniently both setup defined servers
|
||||
-- and map buffer local keybindings when the language server attaches
|
||||
-- local servers = {"pyright", "tsserver"}
|
||||
-- for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup {on_attach = on_attach} end
|
||||
return lsp_config
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue