diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-19 15:46:08 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-19 15:46:08 +0800 |
commit | 399b06f07224bf8666440b7bb83fa32f458b6edf (patch) | |
tree | 55e2d39911f1ce519fe2898942bbd919b3b2b6ff /server/src | |
parent | 46936f5d383d3a1e71c16c4907c7b7eacd3a9f1e (diff) | |
download | lua-language-server-399b06f07224bf8666440b7bb83fa32f458b6edf.zip |
修正一些诊断问题
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/core/diagnostics.lua | 13 | ||||
-rw-r--r-- | server/src/emmy/manager.lua | 3 | ||||
-rw-r--r-- | server/src/method/textDocument/publishDiagnostics.lua | 5 | ||||
-rw-r--r-- | server/src/vm/emmy.lua | 6 |
4 files changed, 18 insertions, 9 deletions
diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua index d6d06880..8d668f04 100644 --- a/server/src/core/diagnostics.lua +++ b/server/src/core/diagnostics.lua @@ -439,10 +439,6 @@ function mt:checkEmmyClass(source, callback) local related = {} local current = class for _ = 1, 10 do - if parent:getName() == class:getName() then - callback(source.start, source.finish, lang.script.DIAG_CYCLIC_EXTENDS, related) - break - end local extends = current.extends if not extends then break @@ -452,11 +448,14 @@ function mt:checkEmmyClass(source, callback) finish = current:getSource().finish, uri = current:getSource().uri, } - current = parent - parent = self.vm.emmyMgr:eachClass(extends, function (parent) + current = self.vm.emmyMgr:eachClass(extends, function (parent) return parent end) - if not parent then + if not current then + break + end + if current:getName() == class:getName() then + callback(source.start, source.finish, lang.script.DIAG_CYCLIC_EXTENDS, related) break end end diff --git a/server/src/emmy/manager.lua b/server/src/emmy/manager.lua index 6ce7e0d2..cd5c97f7 100644 --- a/server/src/emmy/manager.lua +++ b/server/src/emmy/manager.lua @@ -78,6 +78,9 @@ function mt:createType(source) return newType(source) end +function mt:remove() +end + return function () ---@class emmyMgr local self = setmetatable({ diff --git a/server/src/method/textDocument/publishDiagnostics.lua b/server/src/method/textDocument/publishDiagnostics.lua index fbe65bb3..3a4e4658 100644 --- a/server/src/method/textDocument/publishDiagnostics.lua +++ b/server/src/method/textDocument/publishDiagnostics.lua @@ -43,7 +43,7 @@ local function getRange(start, finish, lines) } end -local function createInfo(data, lines) +local function createInfo(lsp, data, lines) local diagnostic = { source = lang.script.DIAG_DIAGNOSTICS, range = getRange(data.start, data.finish, lines), @@ -54,6 +54,7 @@ local function createInfo(data, lines) if data.related then local related = {} for i, info in ipairs(data.related) do + local _, lines = lsp:getVM(info.uri) local message = info.message if not message then local start_line = lines:rowcol(info.start) @@ -144,7 +145,7 @@ return function (lsp, params) if vm then local datas = core.diagnostics(vm, lines, uri) for _, data in ipairs(datas) do - diagnostics[#diagnostics+1] = createInfo(data, lines) + diagnostics[#diagnostics+1] = createInfo(lsp, data, lines) end end if errs then diff --git a/server/src/vm/emmy.lua b/server/src/vm/emmy.lua index 949ffa05..22f72ae6 100644 --- a/server/src/vm/emmy.lua +++ b/server/src/vm/emmy.lua @@ -43,6 +43,9 @@ function mt:doEmmyClass(action) end self._emmy = class action:set('emmy.class', class) + if self.lsp then + self.lsp.global:markSet(self:getUri()) + end end function mt:doEmmyType(action) @@ -55,6 +58,9 @@ function mt:doEmmyType(action) self:instantSource(obj) obj:set('target class', obj[1]) end + if self.lsp then + self.lsp.global:markGet(self:getUri()) + end end function mt:doEmmyIncomplete(action) |