2024-04-01 10:41:54 +03:00
|
|
|
-- 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"
|
2024-06-05 13:29:33 +03:00
|
|
|
|
|
|
|
|
2024-04-01 10:41:54 +03:00
|
|
|
-- 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
|
2024-06-05 13:29:33 +03:00
|
|
|
|
|
|
|
|
|
|
|
-- 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
|
|
|
|
|
2024-04-01 10:41:54 +03:00
|
|
|
lspconfig.gopls.setup({
|
2024-06-05 13:29:33 +03:00
|
|
|
on_attach = on_attach,
|
|
|
|
on_init = on_init,
|
|
|
|
capabilities = capabilities,
|
2024-04-01 10:41:54 +03:00
|
|
|
settings = {
|
|
|
|
gopls = {
|
|
|
|
analyses = {
|
|
|
|
unusedparams = true,
|
|
|
|
},
|
|
|
|
staticcheck = true,
|
|
|
|
gofumpt = true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2024-08-04 01:43:04 +03:00
|
|
|
lspconfig.clangd.setup{}
|
|
|
|
|
2024-04-01 10:41:54 +03:00
|
|
|
-- typescript
|
|
|
|
-- lspconfig.tsserver.setup {
|
|
|
|
-- on_attach = on_attach,
|
|
|
|
-- on_init = on_init,
|
|
|
|
-- capabilities = capabilities,
|
|
|
|
-- }
|