debloat config | remove lspinstall

This commit is contained in:
siduck76 2021-09-10 15:40:54 +05:30
parent 14f0460317
commit 4c025cd1bf
5 changed files with 31 additions and 62 deletions

View file

@ -1,7 +1,6 @@
local present1, lspconfig = pcall(require, "lspconfig")
local present2, lspinstall = pcall(require, "lspinstall")
local present1, nvim_lsp = pcall(require, "lspconfig")
if not (present1 or present2) then
if not present1 then
return
end
@ -57,63 +56,24 @@ capabilities.textDocument.completion.completionItem.resolveSupport = {
},
}
-- lspInstall + lspconfig stuff
local servers = require("core.utils").load_config().plugins.lspconfig.servers
local function setup_servers()
lspinstall.setup()
local servers = lspinstall.installed_servers()
for _, lang in pairs(servers) do
if lang ~= "lua" then
lspconfig[lang].setup {
on_attach = on_attach,
capabilities = capabilities,
flags = {
debounce_text_changes = 500,
},
-- root_dir = vim.loop.cwd,
}
elseif lang == "lua" then
lspconfig[lang].setup {
on_attach = on_attach,
capabilities = capabilities,
flags = {
debounce_text_changes = 500,
},
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
telemetry = {
enable = false,
},
},
},
}
end
end
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
-- root_dir = vim.loop.cwd,
flags = {
debounce_text_changes = 150,
},
}
end
setup_servers()
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
lspinstall.post_install_hook = function()
setup_servers() -- reload installed servers
vim.cmd "bufdo e"
end
-- require("anyfile").setup_luaLsp(on_attach, capabilities) -- this will be removed soon after the custom hooks PR
-- replace the default lsp diagnostic symbols
local function lspSymbol(name, icon)
vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefaul" .. name })
vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefault" .. name })
end
lspSymbol("Error", "")