nvim: lspconfig updates
This commit is contained in:
parent
5697225533
commit
03fd58499e
1 changed files with 12 additions and 23 deletions
|
@ -10,19 +10,7 @@ end -- <<<
|
|||
|
||||
-- lspinstall >>>
|
||||
M.lspinstall = function() --
|
||||
local function setup_servers()
|
||||
require'lspinstall'.setup()
|
||||
local servers = require'lspinstall'.installed_servers()
|
||||
for _, server in pairs(servers) do
|
||||
require'lspconfig'[server].setup{}
|
||||
end
|
||||
end
|
||||
setup_servers()
|
||||
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
|
||||
require'lspinstall'.post_install_hook = function ()
|
||||
setup_servers() -- reload installed servers
|
||||
vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
|
||||
end
|
||||
require("nvim-lsp-installer").setup()
|
||||
end -- <<<
|
||||
|
||||
-- treesitter >>>
|
||||
|
@ -255,23 +243,24 @@ M.lspconfig = function()
|
|||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
local lsp_servers = {
|
||||
-- <lsp_name> = '<lsp_executable_name>', (needs to be in path)
|
||||
clangd = 'clangd',
|
||||
html = 'vscode-html-language-server',
|
||||
bashls = 'bash-language-server',
|
||||
rust_analyzer = 'rust-analyzer',
|
||||
dockerls = 'docker-langserver',
|
||||
yamlls = 'yaml-language-server',
|
||||
-- 'lsp_name',
|
||||
'clangd',
|
||||
'bashls',
|
||||
'rust_analyzer',
|
||||
'dockerls',
|
||||
'yamlls',
|
||||
'html',
|
||||
'cssls',
|
||||
'eslint',
|
||||
'jsonls',
|
||||
}
|
||||
for lsp, exe in pairs(lsp_servers) do
|
||||
if (vim.fn.executable(exe) == 1) then
|
||||
for _, lsp in pairs(lsp_servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
-- <<<
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue