summaryrefslogtreecommitdiff
path: root/server/src/method/workspace/didChangeConfiguration.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/method/workspace/didChangeConfiguration.lua')
-rw-r--r--server/src/method/workspace/didChangeConfiguration.lua23
1 files changed, 22 insertions, 1 deletions
diff --git a/server/src/method/workspace/didChangeConfiguration.lua b/server/src/method/workspace/didChangeConfiguration.lua
index c3b701be..7a00676d 100644
--- a/server/src/method/workspace/didChangeConfiguration.lua
+++ b/server/src/method/workspace/didChangeConfiguration.lua
@@ -29,6 +29,18 @@ local function eq(a, b)
return a == b
end
+local function copyTable(a)
+ local t = {}
+ for k, v in pairs(a) do
+ if type(v) == 'table' then
+ t[k] = copyTable(v)
+ else
+ t[k] = v
+ end
+ end
+ return t
+end
+
return function (lsp)
-- 请求配置
rpc:request('workspace/configuration', {
@@ -38,7 +50,16 @@ return function (lsp)
},
},
}, function (configs)
+ local oldConfig = copyTable(config.config)
config:setConfig(configs[1])
- lsp:reCompile()
+ local newConfig = config.config
+ if not eq(oldConfig.diagnostics, newConfig.diagnostics) then
+ log.debug('reDiagnostic')
+ lsp:reDiagnostic()
+ end
+ if not eq(oldConfig.workspace, newConfig.workspace) then
+ lsp:ClearAllFiles()
+ lsp.workspace:scanFiles()
+ end
end)
end