diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-25 19:40:19 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-25 19:40:19 +0800 |
commit | 8ab3e8e15ca366db726fc44c8bfacbb322f595aa (patch) | |
tree | c9c5db19c38902a807e06cae1c3ae4d5f6545ea4 /script-beta | |
parent | 788f36ad222c2a734f1fde17f37644dc7d1d1505 (diff) | |
download | lua-language-server-8ab3e8e15ca366db726fc44c8bfacbb322f595aa.zip |
修正一些错误
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/definition.lua | 3 | ||||
-rw-r--r-- | script-beta/core/reference.lua | 2 | ||||
-rw-r--r-- | script-beta/parser/guide.lua | 19 |
3 files changed, 23 insertions, 1 deletions
diff --git a/script-beta/core/definition.lua b/script-beta/core/definition.lua index 0761557d..62643861 100644 --- a/script-beta/core/definition.lua +++ b/script-beta/core/definition.lua @@ -118,6 +118,9 @@ return function (uri, offset) vm.setSearchLevel(10) vm.eachDef(source, function (src) src = src.field or src.method or src.index or src + if src.type == 'table' and src.parent.type ~= 'return' then + return + end results[#results+1] = { target = src, uri = guide.getRoot(src).uri, diff --git a/script-beta/core/reference.lua b/script-beta/core/reference.lua index 4580523f..f1dac9df 100644 --- a/script-beta/core/reference.lua +++ b/script-beta/core/reference.lua @@ -79,6 +79,8 @@ return function (uri, offset) elseif src.type == 'getmethod' or src.type == 'setmethod' then src = src.method + elseif src.type == 'table' and src.parent.type ~= 'return' then + return end results[#results+1] = { target = src, diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 32e2cac5..9bdfd716 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1082,6 +1082,9 @@ function m.getObjectValue(obj) return obj.args[3] end end + if obj.type == 'select' then + return obj + end return nil end @@ -1375,10 +1378,15 @@ function m.searchSameFieldsInValue(status, ref, start, queue, mode) force = true, } end + queue[#queue+1] = { + obj = value, + start = start, + force = true, + } -- 检查形如 a = f() 的分支情况 m.checkSameSimpleInCall(status, value, start, queue, mode) -- 检查自己是字面量表的情况 - m.checkSameSimpleInValueOfTable(status, value, start, queue) + --m.checkSameSimpleInValueOfTable(status, value, start, queue) end function m.checkSameSimpleAsTableField(status, ref, start, queue) @@ -1491,6 +1499,8 @@ function m.pushResult(status, mode, ref, simple) if ref.node.special == 'rawset' then results[#results+1] = ref end + elseif ref.type == 'table' then + results[#results+1] = ref end if ref.parent.type == 'return' then if m.getParentFunction(ref) ~= m.getParentFunction(simple.first) then @@ -1517,6 +1527,8 @@ function m.pushResult(status, mode, ref, simple) results[#results+1] = ref elseif ref.type == 'function' then results[#results+1] = ref + elseif ref.type == 'table' then + results[#results+1] = ref elseif ref.type == 'call' then if ref.node.special == 'rawset' or ref.node.special == 'rawget' then @@ -1544,6 +1556,8 @@ function m.pushResult(status, mode, ref, simple) or ref.type == 'setlocal' or ref.type == 'getlocal' then results[#results+1] = ref + elseif ref.type == 'table' then + results[#results+1] = ref elseif ref.type == 'call' then if ref.node.special == 'rawset' or ref.node.special == 'rawget' then @@ -1557,6 +1571,9 @@ function m.checkSameSimple(status, simple, data, mode, results, queue) local ref = data.obj local start = data.start local force = data.force + if start > #simple then + return + end for i = start, #simple do local sm = simple[i] if sm ~= '*' and not force and m.getSimpleName(ref) ~= sm then |