137 lines
3.7 KiB
Lua
137 lines
3.7 KiB
Lua
return {
|
|
"neovim/nvim-lspconfig",
|
|
opts = {
|
|
servers = {
|
|
jdtls = {},
|
|
dockerls = {},
|
|
docker_compose_language_service = {},
|
|
terraformls = {},
|
|
pyright = {},
|
|
ruff_lsp = {},
|
|
yamlls = {
|
|
-- Have to add this for yamlls to understand that we support line folding
|
|
capabilities = {
|
|
textDocument = {
|
|
foldingRange = {
|
|
dynamicRegistration = false,
|
|
lineFoldingOnly = true,
|
|
},
|
|
},
|
|
},
|
|
-- lazy-load schemastore when needed
|
|
on_new_config = function(new_config)
|
|
new_config.settings.yaml.schemas = new_config.settings.yaml.schemas or {}
|
|
vim.list_extend(new_config.settings.yaml.schemas, require("schemastore").yaml.schemas())
|
|
end,
|
|
settings = {
|
|
redhat = { telemetry = { enabled = false } },
|
|
yaml = {
|
|
keyOrdering = false,
|
|
format = {
|
|
enable = true,
|
|
},
|
|
validate = true,
|
|
schemaStore = {
|
|
-- Must disable built-in schemaStore support to use
|
|
-- schemas from SchemaStore.nvim plugin
|
|
enable = false,
|
|
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
|
|
url = "",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
jsonls = {
|
|
-- lazy-load schemastore when needed
|
|
on_new_config = function(new_config)
|
|
new_config.settings.json.schemas = new_config.settings.json.schemas or {}
|
|
vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas())
|
|
end,
|
|
settings = {
|
|
json = {
|
|
format = {
|
|
enable = true,
|
|
},
|
|
validate = { enable = true },
|
|
},
|
|
},
|
|
},
|
|
gopls = {
|
|
keys = {
|
|
-- Workaround for the lack of a DAP strategy in neotest-go: https://github.com/nvim-neotest/neotest-go/issues/12
|
|
{ "<leader>td", "<cmd>lua require('dap-go').debug_test()<CR>", desc = "Debug Nearest (Go)" },
|
|
},
|
|
settings = {
|
|
gopls = {
|
|
gofumpt = true,
|
|
codelenses = {
|
|
gc_details = false,
|
|
generate = true,
|
|
regenerate_cgo = true,
|
|
run_govulncheck = true,
|
|
test = true,
|
|
tidy = true,
|
|
upgrade_dependency = true,
|
|
vendor = true,
|
|
},
|
|
hints = {
|
|
assignVariableTypes = true,
|
|
compositeLiteralFields = true,
|
|
compositeLiteralTypes = true,
|
|
constantValues = true,
|
|
functionTypeParameters = true,
|
|
parameterNames = true,
|
|
rangeVariableTypes = true,
|
|
},
|
|
analyses = {
|
|
fieldalignment = true,
|
|
nilness = true,
|
|
unusedparams = true,
|
|
unusedwrite = true,
|
|
useany = true,
|
|
},
|
|
usePlaceholders = true,
|
|
completeUnimported = true,
|
|
staticcheck = true,
|
|
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
|
semanticTokens = true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
setup = {
|
|
gopls = function(_, opts)
|
|
-- workaround for gopls not supporting semanticTokensProvider
|
|
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
|
require("lazyvim.util").on_attach(function(client, _)
|
|
if client.name == "gopls" then
|
|
if not client.server_capabilities.semanticTokensProvider then
|
|
local semantic = client.config.capabilities.textDocument.semanticTokens
|
|
client.server_capabilities.semanticTokensProvider = {
|
|
full = true,
|
|
legend = {
|
|
tokenTypes = semantic.tokenTypes,
|
|
tokenModifiers = semantic.tokenModifiers,
|
|
},
|
|
range = true,
|
|
}
|
|
end
|
|
end
|
|
end)
|
|
-- end workaround
|
|
end,
|
|
jdtls = function()
|
|
return true -- avoid duplicate servers
|
|
end,
|
|
ruff_lsp = function()
|
|
require("lazyvim.util").on_attach(function(client, _)
|
|
if client.name == "ruff_lsp" then
|
|
-- Disable hover in favor of Pyright
|
|
client.server_capabilities.hoverProvider = false
|
|
end
|
|
end)
|
|
end,
|
|
},
|
|
},
|
|
}
|