Fix lsp
This commit is contained in:
parent
f71d08c214
commit
e9d117b9c3
1 changed files with 4 additions and 32 deletions
|
|
@ -1,24 +1,9 @@
|
||||||
local default = {
|
local default = {
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
require "lsp_signature".on_attach(
|
|
||||||
{
|
|
||||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
|
||||||
handler_opts = {
|
|
||||||
border = "none"
|
|
||||||
},
|
|
||||||
hint_enable = false,
|
|
||||||
doc_lines = 0,
|
|
||||||
floating_window_off_x = 999,
|
|
||||||
floating_window_off_y = 1,
|
|
||||||
-- floating_window = false,
|
|
||||||
}
|
|
||||||
, bufnr) -- Note: add in lsp client on-attach
|
|
||||||
end,
|
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities()
|
capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
}
|
}
|
||||||
|
|
||||||
local servers = {
|
local servers = {
|
||||||
java_language_server = { cmd = {"java-language-server"} },
|
java_language_server = { cmd = { "java-language-server" } },
|
||||||
ocamllsp = {},
|
ocamllsp = {},
|
||||||
pyright = {},
|
pyright = {},
|
||||||
basedpyright = {},
|
basedpyright = {},
|
||||||
|
|
@ -53,26 +38,13 @@ for server, config in pairs(servers) do
|
||||||
local config = vim.tbl_deep_extend("keep", config, default, lsp.document_config.default_config)
|
local config = vim.tbl_deep_extend("keep", config, default, lsp.document_config.default_config)
|
||||||
if config.cmd ~= nil then
|
if config.cmd ~= nil then
|
||||||
if vim.fn.executable(config.cmd[1]) == 1 then
|
if vim.fn.executable(config.cmd[1]) == 1 then
|
||||||
table.insert(enabled, server)
|
enabled[server] = config
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- disable pyright if besedpyright is enabled
|
for server, config in pairs(enabled) do
|
||||||
for _, server in pairs(enabled) do
|
|
||||||
if server == "basedpyright" then
|
|
||||||
for i, s in ipairs(enabled) do
|
|
||||||
if s == "pyright" then
|
|
||||||
table.remove(enabled, i)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, server in pairs(enabled) do
|
|
||||||
local lsp = require("lspconfig")[server]
|
local lsp = require("lspconfig")[server]
|
||||||
local config = servers[server]
|
|
||||||
lsp.setup(config)
|
lsp.setup(config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue