nvim/lua/custom/configs/lspconfig.lua

25 lines
632 B
Lua

local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
local util = require "lspconfig/util"
lspconfig.gopls.setup{
on_attach = on_attach,
capabilities = capabilities,
cmd = {"gopls"},
filetypes = {"go", "gomod", "gowork", "gotmpl"},
root_dir = util.root_pattern("go.mod", "go.work", ".git"),
settings = {
gopls = {
completeUnimported = true,
usePlaceholders = true,
staticcheck = true,
gofumpt = true,
analyses = {
unusedparams = true,
}
}
}
}