summaryrefslogtreecommitdiff
path: root/server/src/method/textDocument
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-27 14:57:09 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-27 14:57:09 +0800
commit6e45ee26d151b10a6896ff5a151175075cb57550 (patch)
tree0303f4d9c0ac56c36176c59e057a521fd521c9ca /server/src/method/textDocument
parentff8e98d0e4824a96b93ccde1a40779a83e4405ae (diff)
downloadlua-language-server-6e45ee26d151b10a6896ff5a151175075cb57550.zip
整理代码
Diffstat (limited to 'server/src/method/textDocument')
-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