summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-21 16:42:15 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-21 16:42:15 +0800
commit3573568a50627ccf1b87ec5ebce585b4207b1826 (patch)
treedde03528c4e66ca126ced6a6224c6bb6237b4b79 /server/src
parent13893b080f155eb232d31c6f32ae14b5a3ab2166 (diff)
downloadlua-language-server-3573568a50627ccf1b87ec5ebce585b4207b1826.zip
修正有时诊断不刷新的BUG
Diffstat (limited to 'server/src')
-rw-r--r--server/src/service.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/server/src/service.lua b/server/src/service.lua
index a183cc0d..4174c54c 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -257,6 +257,8 @@ function mt:compileVM(uri)
obj.lines = parser:lines(obj.text, 'utf8')
obj.lineCost = os.clock() - clock
+ self._needDiagnostics[uri] = true
+
if not obj.vm then
return obj
end
@@ -267,6 +269,10 @@ function mt:compileVM(uri)
end
function mt:doDiagnostics(uri)
+ if not self._needDiagnostics[uri] then
+ return
+ end
+ self._needDiagnostics[uri] = nil
local name = 'textDocument/publishDiagnostics'
local vm, lines = self:getVM(uri)
if not vm then
@@ -341,13 +347,15 @@ function mt:checkWorkSpaceComplete()
end
function mt:_createCompileTask()
- local uri = self._needCompile[1]
- if not uri then
- return nil
- end
self._compileTask = coroutine.create(function ()
- self:compileVM(uri)
- self:doDiagnostics(uri)
+ local uri = self._needCompile[1]
+ if uri then
+ self:compileVM(uri)
+ end
+ local uri = next(self._needDiagnostics)
+ if uri then
+ self:doDiagnostics(uri)
+ end
end)
end
@@ -428,6 +436,7 @@ return function ()
local session = setmetatable({
_file = {},
_needCompile = {},
+ _needDiagnostics = {},
_clock = -100,
_version = 0,
}, mt)