make lsp look nicer

This commit is contained in:
Anish Lakhwara 2022-12-20 15:50:16 +10:00
parent 3b5e19ec12
commit 68d40b380a

View file

@ -345,10 +345,16 @@ in
nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR> nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR>
nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR> nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR>
nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR> nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR>
nnoremap <leader>vsd :lua rim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR> nnoremap <leader>vsd :lua vim.lsp.util.show_line_diagnostics()<CR>
nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR> nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR>
nnoremap <leader>vll :call LspLocationList()<CR>
nnoremap <leader>va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor())<cr> nnoremap <leader>va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor())<cr>
" lspsaga stuff doesn't work
" nnoremap <leader>vd :call Lspsaga peek_definition<CR>
" nnoremap <leader>vrn :call Lspsaga rename<CR><CR>
" nnoremap <leader>vh :call Lspsaga hover_doc<CR>
" nnoremap <leader>vca :call Lspsaga code_action<CR>
" nnoremap <leader>vsd :call Lspsaga show_line_diagnostics<CR>
" nnoremap <leader>vn :call Lspsaga diagnostic_jump_prev<CR>
" dashboard " dashboard
let g:dashboard_custom_header = [ let g:dashboard_custom_header = [
@ -431,6 +437,33 @@ in
end end
end end
vim.diagnostic.config({
signs = true,
update_in_insert = false,
underline = false,
severity_sort = true,
float = {
focusable = false,
style = 'minimal',
border = 'rounded',
source = 'always',
},
})
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover,
{
border = 'rounded',
}
)
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help,
{
border = 'rounded',
}
)
vim.api.nvim_set_keymap('n', '<leader>vt', ':call v:lua.toggle_diagnostics()<CR>', {noremap = true, silent = true}) vim.api.nvim_set_keymap('n', '<leader>vt', ':call v:lua.toggle_diagnostics()<CR>', {noremap = true, silent = true})
-- autopairs -- autopairs
@ -534,11 +567,11 @@ in
null_ls.setup({ null_ls.setup({
sources = { sources = {
null_ls.builtins.diagnostics.shellcheck, null_ls.builtins.diagnostics.shellcheck,
null_ls.builtins.diagnostics.proselint.with({ filetypes = { "vimwiki", "mail", }, }),
-- null_ls.builtins.code_actions.statix, -- null_ls.builtins.code_actions.statix,
-- null_ls.builtins.diagnostics.clj_kondo, -- null_ls.builtins.diagnostics.clj_kondo,
-- null_ls.builtins.formatting.isort, -- null_ls.builtins.formatting.isort,
-- null_ls.builtins.formatting.black, -- null_ls.builtins.formatting.black,
-- null_ls.builtins.code_actions.proselint,
}, },
}) })
@ -548,11 +581,25 @@ in
local format = require("lsp-format") local format = require("lsp-format")
local navic = require("nvim-navic") local navic = require("nvim-navic")
-- lspsaga, code_action lightbulb is annoying
-- local saga = require('lspsaga')
-- saga.init_lsp_saga({
-- code_action_lightbulb = {
-- enable = true,
-- enable_in_insert = true,
-- cache_code_action = true,
-- sign = true,
-- update_time = 150,
-- sign_priority = 4,
-- virtual_text = false,
-- },
-- })
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
local lspconfig = require('lspconfig') local lspconfig = require('lspconfig')
local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver' } local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'sumneko_lua' }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
lspconfig[lsp].setup { lspconfig[lsp].setup {
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
@ -768,6 +815,7 @@ in
python-with-my-packages python-with-my-packages
nodejs nodejs
clojure-lsp clojure-lsp
clojure
rnix-lsp rnix-lsp
terraform-lsp terraform-lsp
rust-analyzer rust-analyzer
@ -780,6 +828,7 @@ in
statix statix
nodePackages.typescript nodePackages.typescript
nodePackages.typescript-language-server nodePackages.typescript-language-server
sumneko-lua-language-server
]; ];
plugins = with pkgs.vimPlugins // customPlugins; [ plugins = with pkgs.vimPlugins // customPlugins; [
@ -795,7 +844,7 @@ in
undotree undotree
telescope-nvim telescope-nvim
plenary-nvim plenary-nvim
nvim-gps nvim-navic
nvim-treesitter nvim-treesitter
nvim-treesitter-context nvim-treesitter-context
my-fterm my-fterm
@ -806,6 +855,7 @@ in
nvim-peekup nvim-peekup
zen-mode-nvim zen-mode-nvim
twilight-nvim twilight-nvim
lspsaga-nvim
# language # language
vim-nix vim-nix
@ -854,7 +904,6 @@ in
vim-tidal vim-tidal
# experimental # experimental
nvim-luapad nvim-luapad
nvim-navic
scnvim scnvim
leap leap
vim-beancount vim-beancount