summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-15 18:03:11 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-15 18:03:11 +0800
commitbd754b0691994a9868de83c145ef234bb659e13c (patch)
treeb1baada1992f79f8eedd90e40737808ee7ed256f /script
parentd3ba148c2d77c99b033b87eb4301f8c36cc9cf39 (diff)
downloadlua-language-server-bd754b0691994a9868de83c145ef234bb659e13c.zip
fix #294
Diffstat (limited to 'script')
-rw-r--r--script/parser/guide.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 40404f70..a6b11744 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -2312,9 +2312,13 @@ function m.pushResult(status, mode, ref, simple)
or ref.type == 'getmethod' then
results[#results+1] = ref
elseif ref.type == 'setindex'
- or ref.type == 'getindex'
or ref.type == 'tableindex' then
results[#results+1] = ref
+ elseif ref.type == 'getindex' then
+ -- do not trust `t[1]`
+ if ref.index.type == 'string' then
+ results[#results+1] = ref
+ end
elseif ref.type == 'setglobal'
or ref.type == 'getglobal' then
results[#results+1] = ref
@@ -2440,12 +2444,17 @@ function m.searchSameFields(status, simple, mode)
}
end
local max = 0
- local lock = {}
+ local locks = {}
for i = 1, 1e6 do
local data = queue[i]
if not data then
return
end
+ local lock = locks[data.start]
+ if not lock then
+ lock = {}
+ locks[data.start] = lock
+ end
if not lock[data.obj] then
lock[data.obj] = true
max = max + 1