diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-12-02 23:02:50 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-12-02 23:02:50 +0100 |
commit | 8213801b89e9d2a27c6b1df50881b8476679b870 (patch) | |
tree | ecd4a1e2489cff11c4e3c703dc80111d26b97a7a /.config/nvim/lua/lsp/manager.lua | |
parent | a3690ed8ca90823787fbaddb72f0a1874f1e999d (diff) |
LunarVim updates
Diffstat (limited to '.config/nvim/lua/lsp/manager.lua')
-rw-r--r-- | .config/nvim/lua/lsp/manager.lua | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/.config/nvim/lua/lsp/manager.lua b/.config/nvim/lua/lsp/manager.lua index 24fb6e3..268e90d 100644 --- a/.config/nvim/lua/lsp/manager.lua +++ b/.config/nvim/lua/lsp/manager.lua @@ -54,42 +54,42 @@ function M.setup(server_name, user_config) if lsp_utils.is_client_active(server_name) then return end - local servers = require "nvim-lsp-installer.servers" local config = resolve_config(server_name, user_config) + local servers = require "nvim-lsp-installer.servers" local server_available, requested_server = servers.get_server(server_name) - if server_available then - local install_notification = false - - if not requested_server:is_installed() then - if options.lsp.automatic_servers_installation then - Log:debug "Automatic server installation detected" - requested_server:install() - install_notification = true - else - Log:debug(requested_server.name .. " is not managed by the automatic installer") - end - end - - requested_server:on_ready(function() - if install_notification then - vim.notify( - string.format("Installation complete for [%s] server", requested_server.name), - vim.log.levels.INFO - ) - end - install_notification = false - requested_server:setup(config) - end) - else - -- since it may not be installed, don't attempt to configure the LSP unless there is a custom provider - local has_custom_provider, _ = pcall(require, "lsp/providers/" .. server_name) - if has_custom_provider then + local is_overridden = vim.tbl_contains(options.lsp.override, server_name) + if not server_available or is_overridden then + pcall(function() require("lspconfig")[server_name].setup(config) buf_try_add(server_name) + end) + return + end + + local install_notification = false + + if not requested_server:is_installed() then + if options.lsp.automatic_servers_installation then + Log:debug "Automatic server installation detected" + requested_server:install() + install_notification = true + else + Log:debug(requested_server.name .. " is not managed by the automatic installer") end end + + requested_server:on_ready(function() + if install_notification then + vim.notify( + string.format("Installation complete for [%s] server", requested_server.name), + vim.log.levels.INFO + ) + end + install_notification = false + requested_server:setup(config) + end) end return M |