feat: add go lsp and formatting
This commit is contained in:
@@ -5,6 +5,7 @@ local capabilities = require("nvchad.configs.lspconfig").capabilities
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
local servers = { "html", "cssls", "clangd" }
|
||||
local util = require "lspconfig/util"
|
||||
|
||||
-- lsps with default config
|
||||
for _, lsp in ipairs(servers) do
|
||||
@@ -35,6 +36,23 @@ lspconfig.basedpyright.setup{
|
||||
}
|
||||
}
|
||||
|
||||
lspconfig.gopls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
cmd = {"gopls"},
|
||||
filetypes = { "go", "gomod", "gowork", "gotmpl" },
|
||||
root_dir = util.root_pattern("go.work", "go.mod", ".git"),
|
||||
settings = {
|
||||
gopls = {
|
||||
completeUnimported = true,
|
||||
usePlaceholders = true,
|
||||
analyses = {
|
||||
unusedParameters = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
---- ruff_lsp and pyright compatibility
|
||||
local on_attach = function(client, bufnr)
|
||||
if client.name == 'ruff_lsp' then
|
||||
|
||||
Reference in New Issue
Block a user