.dotfiles/nvim/lua/configs/lspconfig.lua

56 lines
1.6 KiB
Lua

-- EXAMPLE
local on_attach = require("nvchad.configs.lspconfig").on_attach
local on_init = require("nvchad.configs.lspconfig").on_init
local capabilities = require("nvchad.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
-- local servers = { "gopls" }
-- lsps with default config
-- for _, lsp in ipairs(servers) do
-- lspconfig[lsp].setup {
-- on_attach = on_attach,
-- on_init = on_init,
-- capabilities = capabilities,
-- }
-- end
-- local gopls_on_attach = function(client, bufnr)
-- if client.supports_method("textDocument/inlayHint") then
-- vim.lsp.inlay_hint.enable(true, {
-- assignVariableTypes = true,
-- compositeLiteralFields = true,
-- compositeLiteralTypes = true,
-- constantValues = true,
-- functionTypeParameters = true,
-- parameterNames = true,
-- rangeVariableTypes = true,
-- })
-- end
-- end
lspconfig.gopls.setup({
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
gofumpt = true,
},
},
})
-- typescript
-- lspconfig.tsserver.setup {
-- on_attach = on_attach,
-- on_init = on_init,
-- capabilities = capabilities,
-- }