@@ -26,19 +26,6 @@ simpleSwitch = util.switch()
2626 end
2727 end
2828 end )
29- : case ' doc.alias.name'
30- : call (function (source , pushResult )
31- local global = vm .getGlobal (' type' , source [1 ])
32- if not global then
33- return
34- end
35- for _ , get in ipairs (global :getGets (guide .getUri (source ))) do
36- pushResult (get )
37- end
38- for _ , set in ipairs (global :getSets (guide .getUri (source ))) do
39- pushResult (set )
40- end
41- end )
4229
4330--- @async
4431local function searchInAllFiles (suri , searcher , notify )
@@ -229,18 +216,23 @@ function searchByParentNode(source, pushResult, defMap, fileNotify)
229216 nodeSwitch (source .type , source , pushResult , defMap , fileNotify )
230217end
231218
232- local function searchByNode (source , pushResult )
233- local node = vm .compileNode (source )
219+ local function searchByGlobal (source , pushResult )
220+ if source .type == ' field'
221+ or source .type == ' method'
222+ or source .type == ' doc.class.name'
223+ or source .type == ' doc.alias.name' then
224+ source = source .parent
225+ end
226+ local node = vm .getGlobalNode (source )
234227 if not node then
235228 return
236229 end
237230 local uri = guide .getUri (source )
238- for n in node :eachObject () do
239- if n .type == ' global' then
240- for _ , get in ipairs (n :getGets (uri )) do
241- pushResult (get )
242- end
243- end
231+ for _ , set in ipairs (node :getSets (uri )) do
232+ pushResult (set )
233+ end
234+ for _ , get in ipairs (node :getGets (uri )) do
235+ pushResult (get )
244236 end
245237end
246238
@@ -292,7 +284,7 @@ function vm.getRefs(source, fileNotify)
292284
293285 searchBySimple (source , pushResult )
294286 searchByLocalID (source , pushResult )
295- searchByNode (source , pushResult )
287+ searchByGlobal (source , pushResult )
296288 local defMap = searchByDef (source , pushResult )
297289 searchByParentNode (source , pushResult , defMap , fileNotify )
298290
0 commit comments