summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-12-30 22:15:27 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-12-30 22:15:27 +0800
commitd5433249e920969365f7cc16f1fffb6b42383d29 (patch)
treeef9a5b58008e8af4a654dfd652a2d6da8e79971d /script
parentf5116cd44bec44e765a02b61bce478071fa048a7 (diff)
downloadlua-language-server-d5433249e920969365f7cc16f1fffb6b42383d29.zip
update
Diffstat (limited to 'script')
-rw-r--r--script/config/config.lua14
-rw-r--r--script/service/service.lua2
-rw-r--r--script/service/telemetry.lua2
3 files changed, 13 insertions, 5 deletions
diff --git a/script/config/config.lua b/script/config/config.lua
index 42af9ea1..81ab4b81 100644
--- a/script/config/config.lua
+++ b/script/config/config.lua
@@ -229,8 +229,12 @@ local function update(scp, key, nowValue, rawValue)
local now = scp:get 'config.now'
local raw = scp:get 'config.raw'
+ local oldValue = now[key]
+
now[key] = nowValue
raw[key] = rawValue
+
+ m.event(scp.uri, key, nowValue, oldValue)
end
---@param uri uri
@@ -359,8 +363,9 @@ end
---@param null any
function m.update(scp, new, null)
local oldConfig = scp:get 'config.now'
+ local newConfig = {}
- scp:set('config.now', {})
+ scp:set('config.now', newConfig)
scp:set('config.raw', {})
local function expand(t, left)
@@ -386,7 +391,9 @@ function m.update(scp, new, null)
-- compare then fire event
if oldConfig then
-
+ for key, oldValue in pairs(oldConfig) do
+ m.event(scp.uri, key, oldValue, newConfig[key])
+ end
end
end
@@ -403,12 +410,13 @@ function m.event(uri, key, value, oldValue)
m.delay = nil
for _, info in ipairs(delay) do
for _, callback in ipairs(m.watchList) do
- callback(uri, info.key, info.value, info.oldValue)
+ callback(info.uri, info.key, info.value, info.oldValue)
end
end
end)
end
m.delay[#m.delay+1] = {
+ uri = uri,
key = key,
value = value,
oldValue = oldValue,
diff --git a/script/service/service.lua b/script/service/service.lua
index 4594b9aa..087ee85e 100644
--- a/script/service/service.lua
+++ b/script/service/service.lua
@@ -197,7 +197,7 @@ function m.reportStatus()
end
info.tooltip = lang.script('WINDOW_LUA_STATUS', {
- ws = table.concat(roots, '/'),
+ ws = table.concat(roots, ';'),
ast = files.astCount,
max = files.fileCount,
mem = collectgarbage('count') / 1000,
diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua
index 3093d49f..d20719b0 100644
--- a/script/service/telemetry.lua
+++ b/script/service/telemetry.lua
@@ -106,7 +106,7 @@ end)
local m = {}
function m.updateConfig(uri, value)
- validMap[uri] = value
+ validMap[uri or ''] = value
isValid = config.get(nil, 'Lua.telemetry.enable')
if isValid == false then
return