diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-25 10:07:43 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-25 10:07:43 +0800 |
commit | 3aaa5b8e0f0d94247f8155c3802515bcc3292619 (patch) | |
tree | 68d232191c05fbdf657e919b00d2689aab051e7c /server/src | |
parent | 4820afbfec7a79b71267f8403980b18ed6b813e2 (diff) | |
parent | 21e3a0f6e980293a72c6ba9d70b408d6dc6a43ff (diff) | |
download | lua-language-server-3aaa5b8e0f0d94247f8155c3802515bcc3292619.zip |
Merge branch 'master' into global
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/core/vm.lua | 6 | ||||
-rw-r--r-- | server/src/parser/ast.lua | 18 | ||||
-rw-r--r-- | server/src/service.lua | 11 |
3 files changed, 24 insertions, 11 deletions
diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua index 4eeb43c1..a0f82458 100644 --- a/server/src/core/vm.lua +++ b/server/src/core/vm.lua @@ -1426,7 +1426,11 @@ function mt:doActions(actions) for _, action in ipairs(actions) do self:doAction(action) if coroutine.isyieldable() then - coroutine.yield() + if self.lsp:isNeedCompile(self.uri) then + coroutine.yield() + else + coroutine.yield('stop') + end end end end diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua index db0dabd1..48d9eb3b 100644 --- a/server/src/parser/ast.lua +++ b/server/src/parser/ast.lua @@ -751,15 +751,15 @@ local Defs = { local labels = State.Label[#State.Label] local str = name[1] if labels[str] then - pushError { - type = 'REDEFINE_LABEL', - start = name.start, - finish = name.finish, - info = { - label = str, - related = {labels[str].start, labels[str].finish}, - } - } + --pushError { + -- type = 'REDEFINE_LABEL', + -- start = name.start, + -- finish = name.finish, + -- info = { + -- label = str, + -- related = {labels[str].start, labels[str].finish}, + -- } + --} else labels[str] = name end diff --git a/server/src/service.lua b/server/src/service.lua index 59996733..0eb62121 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -122,6 +122,10 @@ function mt:needCompile(uri, compiled) table.insert(self._needCompile, 1, uri) end +function mt:isNeedCompile(uri) + return self._needCompile[uri] +end + function mt:isWaitingCompile() if self._needCompile[1] then return true @@ -467,7 +471,12 @@ function mt:_doCompileTask() while true do local suc, res = coroutine.resume(self._compileTask) if not suc then - break + self._compileTask = nil + return + end + if res == 'stop' then + self._compileTask = nil + return end if coroutine.status(self._compileTask) == 'suspended' then self:_loadProto() |