80 lines
1.6 KiB
Lua
80 lines
1.6 KiB
Lua
local config = require("plugins.configs.lspconfig")
|
|
local on_attach = config.on_attach
|
|
local capabilities = config.capabilities
|
|
local lspconfig = require("lspconfig")
|
|
|
|
local function organize_imports()
|
|
local params = {
|
|
command = "_typescript.organizeImports",
|
|
arguments = { vim.api.nvim_buf_get_name(0) },
|
|
}
|
|
vim.lsp.buf.execute_command(params)
|
|
end
|
|
|
|
lspconfig.ts_ls.setup {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
init_options = {
|
|
preferences = {
|
|
disablesuggestions = true,
|
|
}
|
|
},
|
|
commands = {
|
|
OrganizeImports = {
|
|
organize_imports,
|
|
description = "Organize Imports",
|
|
},
|
|
}
|
|
}
|
|
|
|
lspconfig.terraformls.setup {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
}
|
|
|
|
lspconfig.tflint.setup {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
}
|
|
|
|
lspconfig.gopls.setup {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
cmd = { "gopls" },
|
|
filetypes = { "go", "gomod", "gowork", "gotempl" },
|
|
root_dir = lspconfig.util.root_pattern("go.mod", "go.work"),
|
|
settings = {
|
|
gopls = {
|
|
completeUnimported = true,
|
|
usePlaceholders = true,
|
|
analyses = {
|
|
unusedparams = true,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
lspconfig.pyright.setup {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
filetypes = { "python" },
|
|
}
|
|
|
|
lspconfig.gleam.setup({})
|
|
|
|
lspconfig.nil_ls.setup {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
autostart = true,
|
|
cmd = { "nil" },
|
|
filetypes = { "nix" },
|
|
settings = {
|
|
['nil'] = {
|
|
testSetting = 42,
|
|
formatting = {
|
|
command = { "alejandra" },
|
|
},
|
|
},
|
|
},
|
|
}
|