From 302526e4311cb7f54b327d7bdd999a2e60f89eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 1 Mar 2019 15:51:22 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=BD=AC=E5=88=B0=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/definition.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'server/src/core') diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua index 60964676..6685f00d 100644 --- a/server/src/core/definition.lua +++ b/server/src/core/definition.lua @@ -131,6 +131,9 @@ local function parseLocal(vm, loc, lsp) loc.source.start, loc.source.finish, } + if #positions == 0 then + return nil + end return positions end @@ -144,6 +147,32 @@ local function parseValue(vm, value, lsp) } end end) + if #positions == 0 then + return nil + end + return positions +end + +local function parseValueSimily(vm, source, lsp) + local key = source[1] + if not key then + return nil + end + local positions = {} + for _, other in ipairs(vm.sources) do + if other == source then + break + end + if other[1] == key and not other:bindLocal() and other:bindValue() and other:action() == 'set' then + positions[#positions+1] = { + other.start, + other.finish, + } + end + end + if #positions == 0 then + return nil + end return positions end @@ -156,5 +185,6 @@ return function (vm, source, lsp) end if source:bindValue() then return parseValue(vm, source:bindValue(), lsp) + or parseValueSimily(vm, source, lsp) end end -- cgit v1.2.3