|
|
|
@ -96,10 +96,13 @@ lspconfig.gopls.setup{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- C/C++
|
|
|
|
|
lspconfig.clangd.setup{}
|
|
|
|
|
lspconfig.clangd.setup{
|
|
|
|
|
on_attach = on_attach,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Lua
|
|
|
|
|
lspconfig.lua_ls.setup{
|
|
|
|
|
on_attach = on_attach,
|
|
|
|
|
settings = {
|
|
|
|
|
Lua = {
|
|
|
|
|
diagnostics = {globals = {'vim', 'opts'}},
|
|
|
|
@ -111,13 +114,19 @@ lspconfig.lua_ls.setup{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Rust
|
|
|
|
|
lspconfig.rust_analyzer.setup{}
|
|
|
|
|
lspconfig.rust_analyzer.setup{
|
|
|
|
|
on_attach = on_attach,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Python
|
|
|
|
|
lspconfig.pylsp.setup{}
|
|
|
|
|
lspconfig.pylsp.setup{
|
|
|
|
|
on_attach = on_attach,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- TypeScript
|
|
|
|
|
lspconfig.tsserver.setup{}
|
|
|
|
|
lspconfig.tsserver.setup{
|
|
|
|
|
on_attach = on_attach,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Fix virtual text going off screen
|
|
|
|
|
vim.diagnostic.config({
|
|
|
|
@ -129,19 +138,19 @@ vim.diagnostic.config({
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
|
callback = function(ev)
|
|
|
|
|
local opts = { buffer = ev.buf }
|
|
|
|
|
-- error viewing
|
|
|
|
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
|
|
|
|
|
vim.keymap.set('n', '<leader>[d', vim.diagnostic.goto_prev, opts)
|
|
|
|
|
vim.keymap.set('n', '<leader>]d', vim.diagnostic.goto_next, opts)
|
|
|
|
|
-- def viewing/rename
|
|
|
|
|
vim.keymap.set('n', '<leader>gD', vim.lsp.buf.declaration, opts)
|
|
|
|
|
vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition, opts)
|
|
|
|
|
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
|
|
|
|
vim.keymap.set('n', '<leader>H', vim.lsp.buf.hover, opts)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
-- vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
|
-- callback = function(ev)
|
|
|
|
|
-- local opts = { buffer = ev.buf }
|
|
|
|
|
-- -- error viewing
|
|
|
|
|
-- vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
|
|
|
|
|
-- vim.keymap.set('n', '<leader>[d', vim.diagnostic.goto_prev, opts)
|
|
|
|
|
-- vim.keymap.set('n', '<leader>]d', vim.diagnostic.goto_next, opts)
|
|
|
|
|
-- -- def viewing/rename
|
|
|
|
|
-- vim.keymap.set('n', '<leader>gD', vim.lsp.buf.declaration, opts)
|
|
|
|
|
-- vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition, opts)
|
|
|
|
|
-- vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
|
|
|
|
-- vim.keymap.set('n', '<leader>H', vim.lsp.buf.hover, opts)
|
|
|
|
|
-- end,
|
|
|
|
|
-- })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|