135 lines
2.9 KiB
Lua
135 lines
2.9 KiB
Lua
-- load defaults i.e lua_lsp
|
|
require("nvchad.configs.lspconfig").defaults()
|
|
|
|
local nvlsp = require("nvchad.configs.lspconfig")
|
|
local lspconfig_util = require("lspconfig.util")
|
|
local root_pattern = lspconfig_util.root_pattern
|
|
|
|
local servers = {
|
|
{ name = "buf_ls" },
|
|
{ name = "html" },
|
|
{ name = "cucumber-language-server" },
|
|
{ name = "nilaway", config = { filetypes = { "go" } } },
|
|
{ name = "api-linter" },
|
|
{ name = "graphql" },
|
|
{ name = "vacuum", config = { filetypes = { "api.yaml" } } },
|
|
{ name = "tilt_ls", config = { filetypes = { "starlark" } } },
|
|
{ name = "cssls" },
|
|
{ name = "eslint" },
|
|
{
|
|
name = "gopls",
|
|
config = {
|
|
on_attach = nvlsp.on_attach,
|
|
capabilities = nvlsp.capabilities,
|
|
cmd = { "gopls" },
|
|
filetypes = { "go", "gomod", "gowork", "gotmpl" },
|
|
settings = {
|
|
completeUnimported = true,
|
|
usePlaceholders = true,
|
|
analyses = {
|
|
unusedparams = true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name = "ts_ls",
|
|
config = {
|
|
on_attach = nvlsp.on_attach,
|
|
capabilities = nvlsp.capabilities,
|
|
init_options = {
|
|
preferences = {
|
|
disableSuggestions = true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name = "tailwindcss",
|
|
config = {
|
|
on_attach = nvlsp.on_attach,
|
|
capabilities = nvlsp.capabilities,
|
|
},
|
|
},
|
|
{
|
|
name = "pyright",
|
|
config = {
|
|
on_attach = nvlsp.on_attach,
|
|
capabilities = nvlsp.capabilities,
|
|
filetypes = { "python" },
|
|
cmd = { "pipenv", "run", "pyright-langserver", "--stdio" },
|
|
},
|
|
},
|
|
{
|
|
name = "golangcilsp",
|
|
config = {
|
|
default_config = {
|
|
cmd = { "golangci-lint-langserver" },
|
|
root_dir = root_pattern(".git", "go.mod"),
|
|
init_options = {
|
|
command = {
|
|
"golangci-lint",
|
|
"run",
|
|
"--output.json.path",
|
|
"stdout",
|
|
"--show-stats=false",
|
|
"--issues-exit-code=1",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name = "golangci_lint_ls",
|
|
config = {
|
|
filetypes = { "go", "gomod" },
|
|
},
|
|
},
|
|
{
|
|
name = "clangd",
|
|
config = {
|
|
filetypes = { "c" },
|
|
on_attach = function(client, _)
|
|
if client.server_capabilities.documentFormattingProvider then
|
|
client.server_capabilities.documentFormattingProvider = false
|
|
end
|
|
|
|
if client.server_capabilities.documentRangeFormattingProvider then
|
|
client.server_capabilities.documentRangeFormattingProvider = false
|
|
end
|
|
end,
|
|
},
|
|
},
|
|
}
|
|
|
|
-- lsps with default config
|
|
for _, lsp in ipairs(servers) do
|
|
vim.lsp.config(lsp.name, lsp.config or {})
|
|
vim.lsp.enable(lsp.name)
|
|
end
|
|
|
|
require("sonarlint").setup({
|
|
server = {
|
|
cmd = {
|
|
"sonarlint-language-server",
|
|
-- Ensure that sonarlint-language-server uses stdio channel
|
|
"-stdio",
|
|
"-analyzers",
|
|
vim.fn.expand("$MASON/share/nvim/mason/share/sonarlint-analyzers/sonargo.jar"),
|
|
vim.fn.expand("$MASON/share/sonarlint-analyzers/sonarpython.jar"),
|
|
vim.fn.expand("$MASON/share/sonarlint-analyzers/sonarjs.jar"),
|
|
},
|
|
settings = {
|
|
sonarlint = {
|
|
test = "test",
|
|
},
|
|
},
|
|
},
|
|
filetypes = {
|
|
"python",
|
|
"go",
|
|
"javascript",
|
|
"typescript",
|
|
},
|
|
})
|