summaryrefslogtreecommitdiff
path: root/server/src/method
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/method')
-rw-r--r--server/src/method/textDocument/publishDiagnostics.lua14
1 files changed, 5 insertions, 9 deletions
diff --git a/server/src/method/textDocument/publishDiagnostics.lua b/server/src/method/textDocument/publishDiagnostics.lua
index b006932e..5f71d475 100644
--- a/server/src/method/textDocument/publishDiagnostics.lua
+++ b/server/src/method/textDocument/publishDiagnostics.lua
@@ -80,16 +80,12 @@ return function (lsp, params)
local lines = params.lines
local uri = params.uri
- local datas = matcher.diagnostics(vm, lines, uri)
-
- if not datas then
- -- 返回空表以清空之前的结果
- return {}
- end
-
local diagnostics = {}
- for i, data in ipairs(datas) do
- diagnostics[i] = createInfo(data, lines)
+ if vm then
+ local datas = matcher.diagnostics(vm, lines, uri)
+ for _, data in ipairs(datas) do
+ diagnostics[#diagnostics+1] = createInfo(data, lines)
+ end
end
return diagnostics