summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-10-20 16:32:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-10-20 16:32:48 +0800
commit5b5ffd799bf613c97fa65f83c50018bf942876b0 (patch)
treea38ce7b1a3a87bac0471e4c4a153fbf5a7543c5b
parent12ca56af1b403b1473472d547c377493780e7844 (diff)
downloadlua-language-server-5b5ffd799bf613c97fa65f83c50018bf942876b0.zip
fix diagnostic refresh
syntax errors dose not refresh after reload workspace by change config or `Lua.runtime.XXX`
-rw-r--r--script/files.lua3
-rw-r--r--script/workspace/workspace.lua4
2 files changed, 6 insertions, 1 deletions
diff --git a/script/files.lua b/script/files.lua
index 8dcbdb8c..e645cd83 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -283,6 +283,9 @@ end
function m.resetText(uri)
local file = m.fileMap[uri]
+ if not file then
+ return
+ end
local originText = file.originText
file.originText = nil
m.setText(uri, originText, file.trusted)
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 45fd6595..272ceb0e 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -558,7 +558,9 @@ config.watch(function (uri, key, value, oldValue)
or key:find '^Lua.type'
or key:find '^files' then
if value ~= oldValue then
- m.reload(scope.getScope(uri))
+ local scp = scope.getScope(uri)
+ m.reload(scp)
+ m.resetFiles(scp)
end
end
end)