@@ -61,7 +61,7 @@ type file struct {
6161 objectInfo storage.ObjectInfo // Info in the context of the workspace.
6262
6363 ir * ir.File
64- referenceableSymbols map [report. Span ]* symbol
64+ referenceableSymbols map [ir. FullName ]* symbol
6565 referenceSymbols []* symbol
6666 symbols []* symbol
6767 diagnostics []protocol.Diagnostic
@@ -293,7 +293,7 @@ func (f *file) IndexSymbols(ctx context.Context) {
293293 // this file depends on a file that has since been modified, we may need to update references.
294294 f .symbols = nil
295295 f .referenceSymbols = nil
296- f .referenceableSymbols = make (map [report. Span ]* symbol )
296+ f .referenceableSymbols = make (map [ir. FullName ]* symbol )
297297
298298 // Process all imports as symbols
299299 for imp := range seq .Values (f .ir .Imports ()) {
@@ -307,11 +307,11 @@ func (f *file) IndexSymbols(ctx context.Context) {
307307
308308 // Index all referenceable symbols
309309 for _ , sym := range resolved {
310- def , ok := sym .kind .(* referenceable )
310+ _ , ok := sym .kind .(* referenceable )
311311 if ! ok {
312312 continue
313313 }
314- f .referenceableSymbols [def . ast . Name (). Span ()] = sym
314+ f .referenceableSymbols [sym . ir . FullName ()] = sym
315315 }
316316
317317 // TODO: this could use a refactor, probably.
@@ -338,7 +338,7 @@ func (f *file) IndexSymbols(ctx context.Context) {
338338 }
339339 file = f
340340 }
341- def , ok := file .referenceableSymbols [ref .def . Name (). Span () ]
341+ def , ok := file .referenceableSymbols [ref .fullName ]
342342 if ! ok {
343343 // This could happen in the case where we are in the cache for example, and we do not
344344 // have access to a buildable workspace.
@@ -377,7 +377,7 @@ func (f *file) IndexSymbols(ctx context.Context) {
377377 if ref .def .Span ().Path () != f .objectInfo .Path () {
378378 continue
379379 }
380- def , ok := f .referenceableSymbols [ref .def . Name (). Span () ]
380+ def , ok := f .referenceableSymbols [ref .fullName ]
381381 if ! ok {
382382 // This shouldn't happen, if a symbol is pointing at this file, all definitions
383383 // should be resolved, logging a warning
@@ -575,7 +575,8 @@ func (f *file) irToSymbols(irSymbol ir.Symbol) ([]*symbol, []*symbol) {
575575 file : f ,
576576 span : irSymbol .AsMethod ().AST ().AsMethod ().Signature .Inputs ().Span (),
577577 kind : & reference {
578- def : input .AST (), // Only messages can be method inputs and outputs
578+ def : input .AST (), // Only messages can be method inputs and outputs
579+ fullName : input .FullName (),
579580 },
580581 }
581582 unresolved = append (unresolved , inputSym )
@@ -586,7 +587,8 @@ func (f *file) irToSymbols(irSymbol ir.Symbol) ([]*symbol, []*symbol) {
586587 file : f ,
587588 span : irSymbol .AsMethod ().AST ().AsMethod ().Signature .Outputs ().Span (),
588589 kind : & reference {
589- def : output .AST (), // Only messages can be method inputs and outputs
590+ def : output .AST (), // Only messages can be method inputs and outputs
591+ fullName : output .FullName (),
590592 },
591593 }
592594 unresolved = append (unresolved , outputSym )
@@ -604,7 +606,8 @@ func getKindForMember(member ir.Member) (kind, bool) {
604606 }, false
605607 }
606608 return & reference {
607- def : member .Element ().AST (),
609+ def : member .Element ().AST (),
610+ fullName : member .Element ().FullName (),
608611 }, true
609612}
610613
@@ -632,7 +635,8 @@ func (f *file) messageToSymbols(msg ir.MessageValue) []*symbol {
632635 file : f ,
633636 span : span ,
634637 kind : & reference {
635- def : element .Field ().AST (),
638+ def : element .Field ().AST (),
639+ fullName : element .Field ().FullName (),
636640 },
637641 isOption : true ,
638642 }
0 commit comments