62 lines
1.3 KiB
Lua
62 lines
1.3 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" },
|
|
}
|