Changed from vim-go to gopls

This commit is contained in:
Marcin Woźniak 2022-05-21 11:44:18 +02:00
parent 1231670cd3
commit d0be239a93
Signed by: y0rune
GPG Key ID: F204C385F57EB348

View File

@ -113,9 +113,6 @@ call plug#begin('~/.config/nvim/plugged')
Plug 'pearofducks/ansible-vim', { 'do': './UltiSnips/generate.sh' } Plug 'pearofducks/ansible-vim', { 'do': './UltiSnips/generate.sh' }
Plug 'Yggdroot/indentLine' Plug 'Yggdroot/indentLine'
" GoLang
Plug 'fatih/vim-go'
" Multiple cursors " Multiple cursors
Plug 'terryma/vim-multiple-cursors' Plug 'terryma/vim-multiple-cursors'
@ -186,7 +183,7 @@ local handlers = {
-- Use a loop to conveniently call 'setup' on multiple servers and -- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches -- map buffer local keybindings when the language server attaches
local servers = { 'pyright', 'bashls', 'ansiblels' } local servers = { 'pyright', 'bashls', 'ansiblels', 'gopls' }
for _, lsp in pairs(servers) do for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup { require('lspconfig')[lsp].setup {
on_attach = on_attach, on_attach = on_attach,
@ -216,6 +213,33 @@ require'lspconfig'.yamlls.setup{
} }
} }
-- Setup GoLang
require'lspconfig'.gopls.setup {
cmd = {"gopls", "serve"},
filetypes = {"go", "gomod"},
on_attach = on_attach,
handlers=handlers,
capabilities = capabilities,
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
linksInHover = false,
codelenses = {
generate = true,
gc_details = true,
regenerate_cgo = true,
tidy = true,
upgrade_depdendency = true,
vendor = true,
},
usePlaceholders = true,
},
},
}
-- luasnip setup -- luasnip setup
local luasnip = require 'luasnip' local luasnip = require 'luasnip'
@ -283,6 +307,9 @@ cmp.setup.cmdline('/', {
} }
}) })
require'nvim-tree'.setup {
}
EOF EOF
" Added popout window to see diagnostic " Added popout window to see diagnostic