diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-09 02:33:17 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-09 02:33:17 +0800 |
commit | af4e3094bd5592d2e9d6a769ef1d7a1660b3e48e (patch) | |
tree | 2ba0f8c655818ca144354e207a70c5e1589b4a64 /script/vm/ref.lua | |
parent | 52847c66b6cdf310176056617806867eae23571e (diff) | |
download | lua-language-server-af4e3094bd5592d2e9d6a769ef1d7a1660b3e48e.zip |
update
Diffstat (limited to 'script/vm/ref.lua')
-rw-r--r-- | script/vm/ref.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/script/vm/ref.lua b/script/vm/ref.lua index f7f1a6d1..e1bdf81d 100644 --- a/script/vm/ref.lua +++ b/script/vm/ref.lua @@ -135,21 +135,21 @@ local function searchField(source, pushResult, defMap, fileNotify) end ---@async guide.eachSourceType(state.ast, 'getfield', function (src) - if src.field[1] == key then + if src.field and src.field[1] == key then checkDef(src) await.delay() end end) ---@async guide.eachSourceType(state.ast, 'getmethod', function (src) - if src.method[1] == key then + if src.method and src.method[1] == key then checkDef(src) await.delay() end end) ---@async guide.eachSourceType(state.ast, 'getindex', function (src) - if src.index.type == 'string' and src.index[1] == key then + if src.index and src.index.type == 'string' and src.index[1] == key then checkDef(src) await.delay() end @@ -269,11 +269,12 @@ local function searchByNode(source, pushResult) end local function searchByDef(source, pushResult) + local defMap = {} if source.type == 'function' or source.type == 'doc.type.function' then - return + defMap[source] = true + return defMap end - local defMap = {} local defs = vm.getDefs(source) for _, def in ipairs(defs) do pushResult(def) |