This commit is contained in:
Nicole Dresselhaus 2024-02-07 18:29:23 +01:00
parent 4240a67dff
commit 7ca96c831f

View File

@ -133,6 +133,11 @@ set hidden
let g:loaded_perl_provider = 0 let g:loaded_perl_provider = 0
" Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
endif
" Remember cursor position between vim sessions " Remember cursor position between vim sessions
autocmd BufReadPost * autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") | \ if line("'\"") > 0 && line ("'\"") <= line("$") |
@ -159,6 +164,37 @@ lua <<EOF
require("mason").setup() require("mason").setup()
require("mason-lspconfig").setup() require("mason-lspconfig").setup()
require("mason-lspconfig").setup_handlers {
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
function (server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {}
end,
-- Next, you can provide a dedicated handler for specific servers.
-- For example, a handler override for the `rust_analyzer`:
-- ["rust_analyzer"] = function ()
-- require("rust-tools").setup {}
-- end
require("lspconfig").gopls.setup {
cmd = {'gopls'},
-- on_attach = on_attach,
capabilities = capabilities,
settings = {
gopls = {
experimentalPostfixCompletions = true,
analyses = {
unusedparams = true,
shadow = true,
},
staticcheck = true,
},
},
init_options = {
usePlaceholders = true,
}
}
}
local has_words_before = function() local has_words_before = function()
unpack = unpack or table.unpack unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = unpack(vim.api.nvim_win_get_cursor(0))
@ -272,29 +308,11 @@ lua <<EOF
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
end end
require("lspconfig").gopls.setup { -- require("lspconfig").eslint.setup {}
cmd = {'gopls'}, -- require("lspconfig").jsonls.setup {}
-- on_attach = on_attach, -- require("lspconfig").tsserver.setup {}
capabilities = capabilities, -- require("lspconfig").ast_grep.setup {}
settings = { -- require("lspconfig").golangci_lint_ls.setup {}
gopls = {
experimentalPostfixCompletions = true,
analyses = {
unusedparams = true,
shadow = true,
},
staticcheck = true,
},
},
init_options = {
usePlaceholders = true,
}
}
require("lspconfig").eslint.setup {}
require("lspconfig").jsonls.setup {}
require("lspconfig").tsserver.setup {}
require("lspconfig").ast_grep.setup {}
require("lspconfig").golangci_lint_ls.setup {}
function swallow_output(callback, ...) function swallow_output(callback, ...)
local old_print = print local old_print = print