diff options
-rw-r--r-- | server/src/method/workspace/didChangeConfiguration.lua | 30 | ||||
-rw-r--r-- | server/src/service.lua | 15 |
2 files changed, 30 insertions, 15 deletions
diff --git a/server/src/method/workspace/didChangeConfiguration.lua b/server/src/method/workspace/didChangeConfiguration.lua index 2052c84c..c3b701be 100644 --- a/server/src/method/workspace/didChangeConfiguration.lua +++ b/server/src/method/workspace/didChangeConfiguration.lua @@ -1,5 +1,33 @@ local rpc = require 'rpc' -local config =require 'config' +local config = require 'config' + +local EXISTS = {} + +local function eq(a, b) + if a == EXISTS and b ~= nil then + return true + end + local tp1, tp2 = type(a), type(b) + if tp1 ~= tp2 then + return false + end + if tp1 == 'table' then + local mark = {} + for k in pairs(a) do + if not eq(a[k], b[k]) then + return false + end + mark[k] = true + end + for k in pairs(b) do + if not mark[k] then + return false + end + end + return true + end + return a == b +end return function (lsp) -- 请求配置 diff --git a/server/src/service.lua b/server/src/service.lua index 21998595..1aa13417 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -242,21 +242,9 @@ function mt:removeText(uri) obj.version = -1 end -function mt:open(uri) - self._opening[uri] = true -end - -function mt:close(uri) - self._opening[uri] = nil -end - -function mt:isOpen(uri) - return self._opening[uri] == true -end - function mt:reCompile() local compiled = {} - for uri in pairs(self._opening) do + for uri in pairs(self._file) do self:needCompile(uri, compiled) end @@ -477,7 +465,6 @@ return function () _file = {}, _needCompile = {}, _needDiagnostics = {}, - _opening = {}, _clock = -100, _version = 0, }, mt) |