59 lines
1.4 KiB
Lua
59 lines
1.4 KiB
Lua
local on_attach = require("plugins.configs.lspconfig").on_attach
|
|
local capabilities = require("plugins.configs.lspconfig").capabilities
|
|
|
|
local lspconfig = require("lspconfig")
|
|
local util = require "lspconfig/util"
|
|
|
|
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.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 = {
|
|
unusedparams = true,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
lspconfig.pyright.setup({
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
filetypes = {"python"},
|
|
})
|
|
lspconfig.powershell_es.setup({
|
|
bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services/",
|
|
settings = { powershell = { codeFormatting = { Preset = 'OTBS' } } }
|
|
})
|
|
|
|
lspconfig.bashls.setup({})
|
|
|
|
lspconfig.tsserver.setup {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
init_options = {
|
|
preferences = {
|
|
disableSuggestions = true,
|
|
}
|
|
},
|
|
commands = {
|
|
OrganizeImports = {
|
|
organize_imports,
|
|
description = "Organize Imports",
|
|
}
|
|
}
|
|
}
|