Add basedpyright and disable pyright when it is available
This commit is contained in:
parent
cdca15c909
commit
536f95a454
1 changed files with 23 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ local servers = {
|
||||||
java_language_server = { cmd = {"java-language-server"} },
|
java_language_server = { cmd = {"java-language-server"} },
|
||||||
ocamllsp = {},
|
ocamllsp = {},
|
||||||
pyright = {},
|
pyright = {},
|
||||||
|
basedpyright = {},
|
||||||
lua_ls = {},
|
lua_ls = {},
|
||||||
clangd = {},
|
clangd = {},
|
||||||
ccls = {},
|
ccls = {},
|
||||||
|
|
@ -42,6 +43,8 @@ local servers = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local enabled = {}
|
||||||
|
|
||||||
for server, config in pairs(servers) do
|
for server, config in pairs(servers) do
|
||||||
local lsp = require("lspconfig")[server]
|
local lsp = require("lspconfig")[server]
|
||||||
|
|
||||||
|
|
@ -49,11 +52,30 @@ 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
|
||||||
lsp.setup(config)
|
table.insert(enabled, server)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- disable pyright if besedpyright is enabled
|
||||||
|
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 config = servers[server]
|
||||||
|
lsp.setup(config)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
-- signs = true,
|
-- signs = true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue