Skip to content

Commit

Permalink
fix: properly check if given server is part of lspconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Sep 11, 2022
1 parent f5400aa commit d970db0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lua/settings/plugins/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function M.setup()
Util.on_config({
name = "settings/plugins/lspconfig",
on_config = M.on_new_config,
root_dir = settings_root
root_dir = settings_root,
})
end

Expand Down Expand Up @@ -52,11 +52,11 @@ function M.on_update(fname)
local old_config = vim.deepcopy(client.config.settings)

-- retrieve new settings only
local new_config = vim.deepcopy(client.config.original_config)
local new_config = vim.deepcopy(client.config.original_config or {})

local _, document_config = pcall(function()
return require("lspconfig")[client.name].document_config
end)
local available = require("lspconfig.util").available_servers()
available = vim.tbl_contains(available, client.name)
local document_config = available and require("lspconfig")[client.name].document_config

-- re-apply config from any other plugins that were overriding on_new_config
if document_config and document_config.on_new_config then
Expand All @@ -67,7 +67,7 @@ function M.on_update(fname)
end

-- only keep the settings
client.config.settings = new_config.settings
client.config.settings = new_config.settings or {}

-- only send update when confiuration actually changed
if not vim.deep_equal(old_config, client.config.settings) then
Expand Down

0 comments on commit d970db0

Please sign in to comment.