@@ -44,7 +44,6 @@ import (
4444 "github.com/bufbuild/protocompile/experimental/incremental"
4545 "github.com/bufbuild/protocompile/experimental/incremental/queries"
4646 "github.com/bufbuild/protocompile/experimental/ir"
47- "github.com/bufbuild/protocompile/experimental/report"
4847 "github.com/bufbuild/protocompile/experimental/seq"
4948 "github.com/bufbuild/protocompile/experimental/source"
5049 "go.lsp.dev/protocol"
@@ -656,7 +655,7 @@ func (f *file) irToSymbols(irSymbol ir.Symbol) ([]*symbol, []*symbol) {
656655 }
657656 msg .def = msg
658657 resolved = append (resolved , msg )
659- unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsType ().Options (), report. Span {} )... )
658+ unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsType ().Options ())... )
660659 case ir .SymbolKindEnum :
661660 enum := & symbol {
662661 ir : irSymbol ,
@@ -668,7 +667,7 @@ func (f *file) irToSymbols(irSymbol ir.Symbol) ([]*symbol, []*symbol) {
668667 }
669668 enum .def = enum
670669 resolved = append (resolved , enum )
671- unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsType ().Options (), report. Span {} )... )
670+ unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsType ().Options ())... )
672671 case ir .SymbolKindEnumValue :
673672 name := & symbol {
674673 ir : irSymbol ,
@@ -689,7 +688,7 @@ func (f *file) irToSymbols(irSymbol ir.Symbol) ([]*symbol, []*symbol) {
689688 }
690689 tag .def = tag
691690 resolved = append (resolved , tag )
692- unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsMember ().Options (), report. Span {} )... )
691+ unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsMember ().Options ())... )
693692 case ir .SymbolKindField :
694693 typ := & symbol {
695694 ir : irSymbol ,
@@ -723,7 +722,7 @@ func (f *file) irToSymbols(irSymbol ir.Symbol) ([]*symbol, []*symbol) {
723722 }
724723 tag .def = tag
725724 resolved = append (resolved , tag )
726- unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsMember ().Options (), report. Span {} )... )
725+ unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsMember ().Options ())... )
727726 case ir .SymbolKindExtension :
728727 // TODO: we should figure out if we need to do any resolution here.
729728 ext := & symbol {
@@ -735,7 +734,7 @@ func (f *file) irToSymbols(irSymbol ir.Symbol) ([]*symbol, []*symbol) {
735734 },
736735 }
737736 resolved = append (resolved , ext )
738- unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsMember ().Options (), report. Span {} )... )
737+ unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsMember ().Options ())... )
739738 case ir .SymbolKindOneof :
740739 oneof := & symbol {
741740 ir : irSymbol ,
@@ -747,7 +746,7 @@ func (f *file) irToSymbols(irSymbol ir.Symbol) ([]*symbol, []*symbol) {
747746 }
748747 oneof .def = oneof
749748 resolved = append (resolved , oneof )
750- unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsOneof ().Options (), report. Span {} )... )
749+ unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsOneof ().Options ())... )
751750 case ir .SymbolKindService :
752751 service := & symbol {
753752 ir : irSymbol ,
@@ -759,7 +758,7 @@ func (f *file) irToSymbols(irSymbol ir.Symbol) ([]*symbol, []*symbol) {
759758 }
760759 service .def = service
761760 resolved = append (resolved , service )
762- unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsService ().Options (), report. Span {} )... )
761+ unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsService ().Options ())... )
763762 case ir .SymbolKindMethod :
764763 method := & symbol {
765764 ir : irSymbol ,
@@ -793,7 +792,7 @@ func (f *file) irToSymbols(irSymbol ir.Symbol) ([]*symbol, []*symbol) {
793792 },
794793 }
795794 unresolved = append (unresolved , outputSym )
796- unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsMethod ().Options (), report. Span {} )... )
795+ unresolved = append (unresolved , f .messageToSymbols (irSymbol .AsMethod ().Options ())... )
797796 }
798797 return resolved , unresolved
799798}
@@ -822,19 +821,14 @@ func (f *file) importToSymbol(imp ir.Import) *symbol {
822821 }
823822}
824823
825- func (f * file ) messageToSymbols (msg ir.MessageValue , prefix report. Span ) []* symbol {
824+ func (f * file ) messageToSymbols (msg ir.MessageValue ) []* symbol {
826825 var symbols []* symbol
827826 for field := range msg .Fields () {
828827 if field .ValueAST ().IsZero () {
829828 continue
830829 }
831830 for element := range seq .Values (field .Elements ()) {
832831 span := element .Value ().KeyASTs ().At (element .ValueNodeIndex ()).Span ()
833- // We only want the subset of the option path that applies specifically to this element,
834- // and we trim the prefix.
835- if ! prefix .IsZero () {
836- span .Start = prefix .End
837- }
838832 elem := & symbol {
839833 // NOTE: no [ir.Symbol] for option elements
840834 file : f ,
@@ -846,7 +840,7 @@ func (f *file) messageToSymbols(msg ir.MessageValue, prefix report.Span) []*symb
846840 }
847841 symbols = append (symbols , elem )
848842 if ! element .AsMessage ().IsZero () {
849- symbols = append (symbols , f .messageToSymbols (element .AsMessage (), span )... )
843+ symbols = append (symbols , f .messageToSymbols (element .AsMessage ())... )
850844 }
851845 }
852846 }
@@ -869,8 +863,8 @@ func (f *file) SymbolAt(ctx context.Context, cursor protocol.Position) *symbol {
869863 }
870864 symbol := f .symbols [idx ]
871865 f .lsp .logger .DebugContext (ctx , "found symbol" , slog .Any ("symbol" , symbol ))
872- // Check that cursor is before the end of the symbol.
873- if comparePositions (symbol .Range ().End , cursor ) <= 0 {
866+ // Check that cursor is before the end of the symbol. Range is half-open [Start, End).
867+ if comparePositions (symbol .Range ().End , cursor ) < 0 {
874868 return nil
875869 }
876870
0 commit comments