From a465b35d5eefc11c1daf3c29b41ce95ee098a782 Mon Sep 17 00:00:00 2001 From: Arcanox Date: Sat, 25 Sep 2021 00:20:02 -0500 Subject: Fix the config setting not updating editors when it's changed --- script/core/semantic-tokens.lua | 4 ++-- script/provider/semantic-tokens.lua | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua index d34899ad..3ff4f418 100644 --- a/script/core/semantic-tokens.lua +++ b/script/core/semantic-tokens.lua @@ -142,7 +142,7 @@ Care['getlocal'] = function (source, results) -- search all defs for _, def in ipairs(vm.getDefs(source)) do if def.bindDocs then - for i, doc in ipairs(def.bindDocs) do + for _, doc in ipairs(def.bindDocs) do if doc.type == "doc.class" and doc.bindSources then for _, src in ipairs(doc.bindSources) do if src == def then @@ -368,7 +368,7 @@ local function buildTokens(uri, results) return tokens end -config.watch(function (key, value, oldValue) +config.watch(function (key, value) if key == 'Lua.color.mode' then isEnhanced = value == 'SemanticEnhanced' end diff --git a/script/provider/semantic-tokens.lua b/script/provider/semantic-tokens.lua index 0c28b8b8..023c9e7e 100644 --- a/script/provider/semantic-tokens.lua +++ b/script/provider/semantic-tokens.lua @@ -42,7 +42,7 @@ local function enable() tokenModifiers = toArray(define.TokenModifiers), }, range = true, - full = false, + full = true, }, }, } @@ -106,10 +106,10 @@ local function refresh() proto.request('workspace/semanticTokens/refresh', json.null) end -config.watch(function (key, value) +config.watch(function (key, value, oldValue) if key == 'Lua.color.mode' then if value == 'Semantic' or value == 'SemanticEnhanced' then - if isEnable then + if isEnable and value ~= oldValue then refresh() else enable() -- cgit v1.2.3