@@ -3,7 +3,6 @@ using CSTParser
33handle (" gotosymbol" ) do data
44 @destruct [
55 word,
6- fullWord,
76 path || nothing ,
87 # local context
98 column || 1 ,
@@ -16,35 +15,35 @@ handle("gotosymbol") do data
1615 text || " " ,
1716 ] = data
1817 gotosymbol (
19- word, fullWord, path,
18+ word, path,
2019 column, row, startRow, context, onlyGlobal,
2120 mod, text
2221 )
2322end
2423
2524function gotosymbol (
26- word, fullword, path = nothing ,
25+ word, path = nothing ,
2726 column = 1 , row = 1 , startrow = 0 , context = " " , onlyglobal = false ,
2827 mod = " Main" , text = " "
2928)
3029 try
3130 # local goto
3231 if ! onlyglobal
33- localitems = localgotoitem (fullword , path, column, row, startrow, context)
32+ localitems = localgotoitem (word , path, column, row, startrow, context)
3433 isempty (localitems) || return Dict (
3534 :error => false ,
36- :items => map (Dict, localitems),
37- :local => true
35+ :items => map (Dict, localitems)
3836 )
3937 end
4038
4139 # global goto
42- globalitems = globalgotoitems (word, fullword, mod, text, path)
40+ globalitems = globalgotoitems (word, mod, text, path)
4341 isempty (globalitems) || return Dict (
4442 :error => false ,
4543 :items => map (Dict, globalitems),
4644 )
4745 catch err
46+ @error err
4847 return Dict (:error => true )
4948 end
5049
@@ -67,8 +66,8 @@ Dict(gotoitem::GotoItem) = Dict(
6766
6867# ## local goto
6968
70- function localgotoitem (fullword , path, column, row, startrow, context)
71- word = first (split (fullword , ' .' )) # always ignore dot accessors
69+ function localgotoitem (word , path, column, row, startrow, context)
70+ word = first (split (word , ' .' )) # always ignore dot accessors
7271 position = row - startrow
7372 ls = locals (context, position, column)
7473 filter! (ls) do l
@@ -85,14 +84,12 @@ localgotoitem(word, ::Nothing, column, row, startrow, context) = [] # when `path
8584
8685# ## global goto - bundles toplevel gotos & method gotos
8786
88- function globalgotoitems (word, fullword, mod, text, path)
87+ function globalgotoitems (word, mod, text, path)
8988 mod = getmodule (mod)
9089
9190 moduleitems = modulegotoitems (word, mod)
9291 isempty (moduleitems) || return moduleitems
9392
94- word = striptrailingdots (word, fullword)
95-
9693 toplevelitems = toplevelgotoitems (word, mod, text, path)
9794
9895 # only append methods that are not caught by `toplevelgotoitems`
@@ -126,12 +123,11 @@ const SYMBOLSCACHE = Dict{String, PathItemsMaps}()
126123function toplevelgotoitems (word, mod, text, path)
127124 # strip a dot-accessed module if exists
128125 identifiers = split (word, ' .' )
129- head = identifiers[1 ]
130- if head ≠ word && (val = getfield′ (mod, string ( head)) ) isa Module
126+ head = string ( identifiers[1 ])
127+ if head ≠ word && getfield′ (mod, head) isa Module
131128 # if `head` is a module, update `word` and `mod`
132129 nextword = join (identifiers[2 : end ], ' .' )
133- nextmod = val
134- return toplevelgotoitems (nextword, nextmod, text, path)
130+ return globalgotoitems (nextword, head, text, path)
135131 end
136132
137133 key = string (mod)
0 commit comments