64 lines
1.7 KiB
Lua
64 lines
1.7 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,
|
|
},
|
|
},
|
|
})
|
|
|
|
lspconfig.clangd.setup{
|
|
on_attach = function (client, bufnr)
|
|
client.server_capabilities.signatureHelpProvider = false
|
|
on_attach(client, bufnr)
|
|
end,
|
|
capabilities = capabilities
|
|
}
|
|
|
|
-- typescript
|
|
-- lspconfig.tsserver.setup {
|
|
-- on_attach = on_attach,
|
|
-- on_init = on_init,
|
|
-- capabilities = capabilities,
|
|
-- }
|