@@ -26,19 +26,6 @@ simpleSwitch = util.switch()
26
26
end
27
27
end
28
28
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 )
42
29
43
30
--- @async
44
31
local function searchInAllFiles (suri , searcher , notify )
@@ -229,18 +216,23 @@ function searchByParentNode(source, pushResult, defMap, fileNotify)
229
216
nodeSwitch (source .type , source , pushResult , defMap , fileNotify )
230
217
end
231
218
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 )
234
227
if not node then
235
228
return
236
229
end
237
230
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 )
244
236
end
245
237
end
246
238
@@ -292,7 +284,7 @@ function vm.getRefs(source, fileNotify)
292
284
293
285
searchBySimple (source , pushResult )
294
286
searchByLocalID (source , pushResult )
295
- searchByNode (source , pushResult )
287
+ searchByGlobal (source , pushResult )
296
288
local defMap = searchByDef (source , pushResult )
297
289
searchByParentNode (source , pushResult , defMap , fileNotify )
298
290
0 commit comments