40 lines
1.1 KiB
Lua
40 lines
1.1 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"
|
|
|
|
-- if you just want default config for the servers then put them in a table
|
|
local servers = { "html", "cssls", "tsserver", "clangd", "lua_ls"}
|
|
|
|
for _, lsp in ipairs(servers) do
|
|
lspconfig[lsp].setup {
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
}
|
|
end
|
|
|
|
-- setup gopls manually
|
|
lspconfig.gopls.setup {
|
|
-- use defaults from lspconfig
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
-- server to use
|
|
cmd = {"gopls"},
|
|
-- files to run this server on
|
|
filetypes = {"go", "gomod", "gowork", "gotmpl"},
|
|
-- how to define the root directory
|
|
root_dir = util.root_pattern("go.work", "go.mod", ".git"),
|
|
-- settings
|
|
settings = {
|
|
gopls = {
|
|
-- complete imports automatically
|
|
completeUnimported = true,
|
|
-- use placeholders during autocompletion
|
|
usePlaceholders = true,
|
|
}
|
|
},
|
|
}
|
|
|
|
--
|
|
-- lspconfig.pyright.setup { blabla}
|