Clean up lsp servers configuration
parent
d3c792f613
commit
2e52f575be
|
@ -1 +0,0 @@
|
||||||
return require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
|
|
@ -2,9 +2,9 @@
|
||||||
-- - LSP servers common config -
|
-- - LSP servers common config -
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
local M = {}
|
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
|
|
||||||
M.on_attach = function(client, bufnr)
|
local function on_attach(client, bufnr)
|
||||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||||
|
|
||||||
-- Lsp keymaps
|
-- Lsp keymaps
|
||||||
|
@ -29,4 +29,7 @@ M.on_attach = function(client, bufnr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,27 @@
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
local common_config = require("esensar.lsp.server_config")
|
local common_config = require("esensar.lsp.server_config")
|
||||||
local capabilities = require("esensar.lsp.capabilities")
|
|
||||||
|
-- Language specific LSP config overrides
|
||||||
|
local configuration_overrides = {
|
||||||
|
gdscript = {
|
||||||
|
flags = {
|
||||||
|
-- Slow Godot LS
|
||||||
|
debounce_text_changes = 600,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
omnisharp = {
|
||||||
|
cmd = {
|
||||||
|
vim.fn.glob("$HOME") .. "/lsp/dotnet/omnisharp/run",
|
||||||
|
"--languageserver",
|
||||||
|
"--hostPID",
|
||||||
|
tostring(vim.fn.getpid())
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lemminx = {
|
||||||
|
cmd = { 'lemminx' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-- Lsp default language servers
|
-- Lsp default language servers
|
||||||
local servers = {
|
local servers = {
|
||||||
|
@ -15,11 +35,14 @@ local servers = {
|
||||||
"crystalline",
|
"crystalline",
|
||||||
"cucumber_language_server",
|
"cucumber_language_server",
|
||||||
"dockerls",
|
"dockerls",
|
||||||
|
"gdscript",
|
||||||
"gopls",
|
"gopls",
|
||||||
"hls",
|
"hls",
|
||||||
"jsonls",
|
"jsonls",
|
||||||
"kotlin_language_server",
|
"kotlin_language_server",
|
||||||
|
"lemminx",
|
||||||
"mint",
|
"mint",
|
||||||
|
"omnisharp",
|
||||||
"pyright",
|
"pyright",
|
||||||
"rust_analyzer",
|
"rust_analyzer",
|
||||||
"solang",
|
"solang",
|
||||||
|
@ -29,49 +52,16 @@ local servers = {
|
||||||
"zls",
|
"zls",
|
||||||
}
|
}
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
lspconfig[lsp].setup({
|
lspconfig[lsp].setup(vim.tbl_extend('force', common_config, configuration_overrides[lsp] or {}))
|
||||||
on_attach = common_config.on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig["gdscript"].setup({
|
|
||||||
on_attach = common_config.on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
flags = {
|
|
||||||
-- Slow Godot LS
|
|
||||||
debounce_text_changes = 600,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Lua bultin lsp
|
-- Lua bultin lsp
|
||||||
require("nlua.lsp.nvim").setup(lspconfig, {
|
require("nlua.lsp.nvim").setup(lspconfig, vim.tbl_extend('force', common_config, {
|
||||||
on_attach = common_config.on_attach,
|
-- Tell LSP which globals should be considered real
|
||||||
capabilities = capabilities,
|
|
||||||
-- Include globals you want to tell the LSP are real :)
|
|
||||||
globals = {},
|
globals = {},
|
||||||
})
|
}))
|
||||||
|
|
||||||
-- Flutter tools
|
-- Flutter tools
|
||||||
require("flutter-tools").setup({
|
require("flutter-tools").setup({
|
||||||
lsp = {
|
lsp = common_config
|
||||||
on_attach = common_config.on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Dotnet LS
|
|
||||||
local pid = vim.fn.getpid()
|
|
||||||
local omnisharp_bin = vim.fn.glob("$HOME") .. "/lsp/dotnet/omnisharp/run"
|
|
||||||
lspconfig.omnisharp.setup({
|
|
||||||
cmd = { omnisharp_bin, "--languageserver", "--hostPID", tostring(pid) },
|
|
||||||
on_attach = common_config.on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Leminx (XML Language server)
|
|
||||||
lspconfig.lemminx.setup({
|
|
||||||
cmd = { "lemminx" },
|
|
||||||
on_attach = common_config.on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue