From fd5aaac3348907ac2618f84e013ab0902cfc20dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 1 Jul 2022 16:28:00 +0800 Subject: cleanup --- script/core/diagnostics/spell-check.lua | 2 +- script/provider/diagnostic.lua | 3 ++- script/provider/spell.lua | 6 ------ script/workspace/workspace.lua | 1 + 4 files changed, 4 insertions(+), 8 deletions(-) (limited to 'script') diff --git a/script/core/diagnostics/spell-check.lua b/script/core/diagnostics/spell-check.lua index ebdb0245..7369a235 100644 --- a/script/core/diagnostics/spell-check.lua +++ b/script/core/diagnostics/spell-check.lua @@ -6,7 +6,7 @@ local spell = require 'provider.spell' ---@async return function(uri, callback) - local text = files.getText(uri) + local text = files.getOriginText(uri) if not text then return end diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index a5a1b527..c3822087 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -594,7 +594,8 @@ files.watch(function (ev, uri) ---@async end) config.watch(function (uri, key, value, oldValue) - if key:find 'Lua.diagnostics' then + if util.stringStartWith(key, 'Lua.diagnostics') + or util.stringStartWith(key, 'Lua.spell') then if value ~= oldValue then m.diagnosticsScope(uri) m.refreshClient() diff --git a/script/provider/spell.lua b/script/provider/spell.lua index 3909ddd2..6647bbad 100644 --- a/script/provider/spell.lua +++ b/script/provider/spell.lua @@ -50,10 +50,4 @@ function m.initDictionary() pformatting.updateNonStandardSymbols(config.get(nil, "Lua.runtime.nonstandardSymbol")) end -config.watch(function (uri, key, value, oldValue) - if key == 'Lua.spell.dict' and uri ~= nil then - diagnostics.refresh(uri) - end -end) - return m diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 9620f8a8..74e16096 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -518,6 +518,7 @@ end config.watch(function (uri, key, value, oldValue) if key:find '^Lua.runtime' or key:find '^Lua.workspace' + or key:find '^Lua.type' or key:find '^files' then if value ~= oldValue then m.reload(scope.getScope(uri)) -- cgit v1.2.3