Skip to content

Commit f4c26a6

Browse files
authored
Upgrade deps (#4168)
1 parent 331fb31 commit f4c26a6

File tree

7 files changed

+74
-56
lines changed

7 files changed

+74
-56
lines changed

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ go 1.24.0
55
require (
66
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.10-20250718181942-e35f9b667443.1
77
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1
8-
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.19.1-20250924144421-cb55f06efbd2.2
9-
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.10-20250924144421-cb55f06efbd2.1
8+
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.19.1-20251027152159-f1066ce064ca.2
9+
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.10-20251027152159-f1066ce064ca.1
1010
buf.build/go/app v0.2.0
1111
buf.build/go/bufplugin v0.9.0
1212
buf.build/go/bufprivateusage v0.1.0
@@ -16,7 +16,7 @@ require (
1616
buf.build/go/standard v0.1.0
1717
connectrpc.com/connect v1.19.1
1818
connectrpc.com/otelconnect v0.8.0
19-
github.com/bufbuild/protocompile v0.14.2-0.20251105181640-1a16185708f1
19+
github.com/bufbuild/protocompile v0.14.2-0.20251112213711-9afd4296dfe2
2020
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1
2121
github.com/docker/docker v28.5.1+incompatible
2222
github.com/go-chi/chi/v5 v5.2.3
@@ -31,7 +31,7 @@ require (
3131
github.com/klauspost/pgzip v1.2.6
3232
github.com/mattn/go-colorable v0.1.14
3333
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
34-
github.com/quic-go/quic-go v0.55.0
34+
github.com/quic-go/quic-go v0.56.0
3535
github.com/rs/cors v1.11.1
3636
github.com/spf13/cobra v1.10.1
3737
github.com/spf13/pflag v1.0.10
@@ -43,7 +43,7 @@ require (
4343
go.uber.org/zap v1.27.0
4444
golang.org/x/crypto v0.43.0
4545
golang.org/x/mod v0.29.0
46-
golang.org/x/sync v0.17.0
46+
golang.org/x/sync v0.18.0
4747
golang.org/x/term v0.36.0
4848
golang.org/x/tools v0.38.0
4949
google.golang.org/protobuf v1.36.10

go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ buf.build/gen/go/bufbuild/protodescriptor/protocolbuffers/go v1.36.10-2025010916
44
buf.build/gen/go/bufbuild/protodescriptor/protocolbuffers/go v1.36.10-20250109164928-1da0de137947.1/go.mod h1:/AouMCAeQ+kB7+RRFpdUlZe3503p18VoUNcU2AFqZXM=
55
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1 h1:31on4W/yPcV4nZHL4+UCiCvLPsMqe/vJcNg8Rci0scc=
66
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1/go.mod h1:fUl8CEN/6ZAMk6bP8ahBJPUJw7rbp+j4x+wCcYi2IG4=
7-
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.19.1-20250924144421-cb55f06efbd2.2 h1:hLW3Bta/Nplz6v//utPUmIqAWIIXFOMH0hWXJv9cWLQ=
8-
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.19.1-20250924144421-cb55f06efbd2.2/go.mod h1:YCi7xtUe0lVPR0IGmMHRgI1017VEayU6yS5VM1Sj1ms=
9-
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.10-20250924144421-cb55f06efbd2.1 h1:4ZcqdlWZF5tQUyHBeLyOwFjRwZ/93X/W5GfOZX9dJZo=
10-
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.10-20250924144421-cb55f06efbd2.1/go.mod h1:AaYXXeRvnOc151wEuupAmn58Mh9bccKce2kk3QKMIrQ=
7+
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.19.1-20251027152159-f1066ce064ca.2 h1:Dbh4Edwy5qHlz1/boPAQ7T5Q7ZDMgEuQlEbXa94+JEo=
8+
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.19.1-20251027152159-f1066ce064ca.2/go.mod h1:SqqTA3aiYVDkpDINxgbxDT6QBjkVjdqUXtbiz6DiWIg=
9+
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.10-20251027152159-f1066ce064ca.1 h1:5tUFlRgcC+N2JJtjwlwyb2J4bBk/bJYLXk50zlewtzk=
10+
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.10-20251027152159-f1066ce064ca.1/go.mod h1:AaYXXeRvnOc151wEuupAmn58Mh9bccKce2kk3QKMIrQ=
1111
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.10-20241007202033-cf42259fcbfc.1 h1:CzM0kZcoaIr8+R4i8QVorUNRM/CqMr87i3j+w2pdpCc=
1212
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.10-20241007202033-cf42259fcbfc.1/go.mod h1:bG+Fa7tcA+4pW0JdOh4h7iKjleyZIKhfVzVS10qfrnk=
1313
buf.build/go/app v0.2.0 h1:NYaH13A+RzPb7M5vO8uZYZ2maBZI5+MS9A9tQm66fy8=
@@ -40,8 +40,8 @@ github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYW
4040
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
4141
github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE=
4242
github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
43-
github.com/bufbuild/protocompile v0.14.2-0.20251105181640-1a16185708f1 h1:ZHKztgOoelyVqVeOnh6FUHeMlk5L9KoJcLSHfZXV22k=
44-
github.com/bufbuild/protocompile v0.14.2-0.20251105181640-1a16185708f1/go.mod h1:HKN246DRQwavs64sr2xYmSL+RFOFxmLti+WGCZ2jh9U=
43+
github.com/bufbuild/protocompile v0.14.2-0.20251112213711-9afd4296dfe2 h1:PpGm1S0XcJuNCrbwlktT1pM4hTgu6n0Gdsw5diq6p6k=
44+
github.com/bufbuild/protocompile v0.14.2-0.20251112213711-9afd4296dfe2/go.mod h1:HKN246DRQwavs64sr2xYmSL+RFOFxmLti+WGCZ2jh9U=
4545
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1 h1:V1xulAoqLqVg44rY97xOR+mQpD2N+GzhMHVwJ030WEU=
4646
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1/go.mod h1:c5D8gWRIZ2HLWO3gXYTtUfw/hbJyD8xikv2ooPxnklQ=
4747
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
@@ -144,8 +144,8 @@ github.com/protocolbuffers/protoscope v0.0.0-20221109213918-8e7a6aafa2c9 h1:arwj
144144
github.com/protocolbuffers/protoscope v0.0.0-20221109213918-8e7a6aafa2c9/go.mod h1:SKZx6stCn03JN3BOWTwvVIO2ajMkb/zQdTceXYhKw/4=
145145
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
146146
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
147-
github.com/quic-go/quic-go v0.55.0 h1:zccPQIqYCXDt5NmcEabyYvOnomjs8Tlwl7tISjJh9Mk=
148-
github.com/quic-go/quic-go v0.55.0/go.mod h1:DR51ilwU1uE164KuWXhinFcKWGlEjzys2l8zUl5Ss1U=
147+
github.com/quic-go/quic-go v0.56.0 h1:q/TW+OLismmXAehgFLczhCDTYB3bFmua4D9lsNBWxvY=
148+
github.com/quic-go/quic-go v0.56.0/go.mod h1:9gx5KsFQtw2oZ6GZTyh+7YEvOxWCL9WZAepnHxgAo6c=
149149
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
150150
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
151151
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
@@ -226,8 +226,8 @@ golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
226226
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
227227
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
228228
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
229-
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
230-
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
229+
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
230+
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
231231
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
232232
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
233233
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -238,8 +238,8 @@ golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q=
238238
golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss=
239239
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
240240
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
241-
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs=
242-
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
241+
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
242+
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
243243
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
244244
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
245245
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

private/buf/buflsp/completion.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import (
3030
"github.com/bufbuild/protocompile/experimental/ast/syntax"
3131
"github.com/bufbuild/protocompile/experimental/id"
3232
"github.com/bufbuild/protocompile/experimental/ir"
33-
"github.com/bufbuild/protocompile/experimental/report"
3433
"github.com/bufbuild/protocompile/experimental/seq"
34+
"github.com/bufbuild/protocompile/experimental/source"
3535
"github.com/bufbuild/protocompile/experimental/token"
3636
"github.com/bufbuild/protocompile/experimental/token/keyword"
3737
"go.lsp.dev/protocol"
@@ -842,7 +842,7 @@ func optionKeywords() iter.Seq[keyword.Keyword] {
842842
func keywordToCompletionItem(
843843
keywords iter.Seq[keyword.Keyword],
844844
kind protocol.CompletionItemKind,
845-
span report.Span,
845+
span source.Span,
846846
offset int,
847847
) iter.Seq[protocol.CompletionItem] {
848848
return func(yield func(protocol.CompletionItem) bool) {
@@ -871,7 +871,7 @@ func keywordToCompletionItem(
871871
func typeReferencesToCompletionItems(
872872
current *file,
873873
parentFullName ir.FullName,
874-
span report.Span,
874+
span source.Span,
875875
offset int,
876876
allowEnums bool,
877877
) iter.Seq[protocol.CompletionItem] {
@@ -976,7 +976,7 @@ func typeReferencesToCompletionItems(
976976
// optionToCompletionItems returns completion items for options.
977977
func optionToCompletionItems(
978978
current *file,
979-
span report.Span,
979+
span source.Span,
980980
offset int,
981981
optionsType ir.Type,
982982
targetKind ir.OptionTarget,
@@ -1036,7 +1036,7 @@ func optionToCompletionItems(
10361036
// extensionToCompletionItems returns completion items for options from extensions.
10371037
func extensionToCompletionItems(
10381038
current *file,
1039-
span report.Span,
1039+
span source.Span,
10401040
offset int,
10411041
optionsType ir.Type,
10421042
targetKind ir.OptionTarget,
@@ -1107,7 +1107,7 @@ func extensionToCompletionItems(
11071107
// It walks through the path segments to find the current message type and suggests valid fields.
11081108
func optionNamesToCompletionItems(
11091109
current *file,
1110-
pathSpans []report.Span,
1110+
pathSpans []source.Span,
11111111
offset int,
11121112
optionType ir.Type,
11131113
targetKind ir.OptionTarget,
@@ -1218,7 +1218,7 @@ func optionNamesToCompletionItems(
12181218
func messageFieldCompletionItems(
12191219
current *file,
12201220
messageType ir.Type,
1221-
tokenSpan report.Span,
1221+
tokenSpan source.Span,
12221222
offset int,
12231223
isValueType bool,
12241224
) iter.Seq[protocol.CompletionItem] {
@@ -1347,7 +1347,7 @@ func getDeclForOffsetHelper(body ast.DeclBody, offset int, path []ast.DeclAny) [
13471347
// parseOptionSpan returns the span associated with the option declaration and
13481348
// the fields up until the offset. This handles invalid declarations from
13491349
// partial syntax.
1350-
func parseOptionSpan(file *file, offset int) (report.Span, []report.Span) {
1350+
func parseOptionSpan(file *file, offset int) (source.Span, []source.Span) {
13511351
hasStart, hasGap := false, false
13521352
var tokens []token.Token
13531353
typeSpan := extractAroundOffset(
@@ -1373,12 +1373,12 @@ func parseOptionSpan(file *file, offset int) (report.Span, []report.Span) {
13731373
isTokenType,
13741374
)
13751375
if !hasStart {
1376-
return report.Span{}, nil
1376+
return source.Span{}, nil
13771377
}
13781378
// If no tokens were found, return an empty span at the offset.
13791379
if len(tokens) == 0 {
1380-
emptySpan := report.Span{File: file.file, Start: offset, End: offset}
1381-
return emptySpan, []report.Span{emptySpan}
1380+
emptySpan := source.Span{File: file.file, Start: offset, End: offset}
1381+
return emptySpan, []source.Span{emptySpan}
13821382
}
13831383
slices.Reverse(tokens)
13841384
if typeSpan.Start > 0 && file.file.Text()[typeSpan.Start-1] == '(' {
@@ -1389,14 +1389,14 @@ func parseOptionSpan(file *file, offset int) (report.Span, []report.Span) {
13891389
if strings.HasPrefix(file.file.Text()[typeSpan.End:], ")") {
13901390
typeSpan.End += 1
13911391
}
1392-
return typeSpan, []report.Span{typeSpan}
1392+
return typeSpan, []source.Span{typeSpan}
13931393
}
1394-
pathSpans := []report.Span{tokens[0].Span()}
1394+
pathSpans := []source.Span{tokens[0].Span()}
13951395
for i := 1; i < len(tokens)-1; i += 2 {
13961396
dotToken := tokens[i]
13971397
identToken := tokens[i+1]
13981398
if dotToken.Text() != "." || identToken.Kind() != token.Ident {
1399-
return report.Span{}, nil
1399+
return source.Span{}, nil
14001400
}
14011401
pathSpans = append(pathSpans, identToken.Span())
14021402
}
@@ -1520,20 +1520,20 @@ func isTokenTypeDelimiter(tok token.Token) bool {
15201520
}
15211521

15221522
// extractAroundOffset extracts the value around the offset by querying the token stream.
1523-
func extractAroundOffset(file *file, offset int, isTokenBefore, isTokenAfter func(token.Token) bool) report.Span {
1523+
func extractAroundOffset(file *file, offset int, isTokenBefore, isTokenAfter func(token.Token) bool) source.Span {
15241524
if file.ir.AST() == nil {
1525-
return report.Span{}
1525+
return source.Span{}
15261526
}
15271527
stream := file.ir.AST().Stream()
15281528
if stream == nil {
1529-
return report.Span{}
1529+
return source.Span{}
15301530
}
15311531
before, after := stream.Around(offset)
15321532
if before.IsZero() && after.IsZero() {
1533-
return report.Span{}
1533+
return source.Span{}
15341534
}
15351535

1536-
span := report.Span{
1536+
span := source.Span{
15371537
File: file.file,
15381538
Start: offset,
15391539
End: offset,
@@ -1557,7 +1557,7 @@ func extractAroundOffset(file *file, offset int, isTokenBefore, isTokenAfter fun
15571557
return span
15581558
}
15591559

1560-
func splitSpan(span report.Span, offset int) (prefix string, suffix string) {
1560+
func splitSpan(span source.Span, offset int) (prefix string, suffix string) {
15611561
if offsetInSpan(offset, span) != 0 {
15621562
return "", ""
15631563
}
@@ -1566,7 +1566,7 @@ func splitSpan(span report.Span, offset int) (prefix string, suffix string) {
15661566
return text[:index], text[index:]
15671567
}
15681568

1569-
func offsetInSpan(offset int, span report.Span) int {
1569+
func offsetInSpan(offset int, span source.Span) int {
15701570
if offset < span.Start {
15711571
return -1
15721572
} else if offset > span.End {

private/buf/buflsp/diagnostic.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ import (
2121
"strings"
2222

2323
"github.com/bufbuild/protocompile/experimental/report"
24+
"github.com/bufbuild/protocompile/experimental/source/length"
2425
"go.lsp.dev/protocol"
2526
)
2627

2728
// UTF-16 is the default per LSP spec. Position encoding negotiation is not yet
2829
// supported by the go.lsp.dev/protocol library.
2930
// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position
30-
const positionalEncoding = report.UTF16Length
31+
const positionalEncoding = length.UTF16
3132

3233
// diagnosticData is a structure to hold the [report.Diagnostic] notes, help, and debug
3334
// messages, to marshal into JSON for the [protocol.Diagnostic].Data field.

private/buf/buflsp/file.go

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type file struct {
5151
lsp *lsp
5252
uri protocol.URI
5353

54-
file *report.File
54+
file *source.File
5555
// Version is an opaque version identifier given to us by the LSP client. This
5656
// is used in the protocol to disambiguate which version of a file e.g. publishing
5757
// diagnostics or symbols an operating refers to.
@@ -150,7 +150,7 @@ func (f *file) ReadFromWorkspace(ctx context.Context) (err error) {
150150
text := builder.String()
151151

152152
f.version = -1
153-
f.file = report.NewFile(fileName, text)
153+
f.file = source.NewFile(fileName, text)
154154
f.hasText = true
155155
return nil
156156
}
@@ -160,7 +160,7 @@ func (f *file) ReadFromWorkspace(ctx context.Context) (err error) {
160160
func (f *file) Update(ctx context.Context, version int32, text string) {
161161
f.lsp.logger.InfoContext(ctx, "file updated", slog.String("uri", f.uri.Filename()), slog.Int("old_version", int(f.version)), slog.Int("new_version", int(version)))
162162
f.version = version
163-
f.file = report.NewFile(f.uri.Filename(), text)
163+
f.file = source.NewFile(f.uri.Filename(), text)
164164
f.hasText = true
165165

166166
f.CancelChecks(ctx)
@@ -221,9 +221,9 @@ func (f *file) RefreshIR(ctx context.Context) {
221221
// Opener creates a cached view of all files in the workspace.
222222
pathToFiles := f.workspace.PathToFile()
223223
files := make([]*file, 0, len(pathToFiles))
224-
openerMap := make(map[string]string, len(pathToFiles))
224+
openerMap := make(map[string]*source.File, len(pathToFiles))
225225
for path, file := range pathToFiles {
226-
openerMap[path] = file.file.Text()
226+
openerMap[path] = file.file
227227
files = append(files, file)
228228
}
229229
opener := source.NewMap(openerMap)
@@ -375,12 +375,12 @@ func (f *file) IndexSymbols(ctx context.Context) {
375375
var fullName ir.FullName
376376
switch kind := sym.kind.(type) {
377377
case *reference:
378-
if kind.def.Span().Path() != f.objectInfo.Path() {
378+
if kind.def.Span().Path() != f.objectInfo.LocalPath() {
379379
continue
380380
}
381381
fullName = kind.fullName
382382
case *option:
383-
if kind.def.Span().Path() != f.objectInfo.Path() {
383+
if kind.def.Span().Path() != f.objectInfo.LocalPath() {
384384
continue
385385
}
386386
fullName = kind.defFullName
@@ -690,7 +690,7 @@ func (f *file) messageToSymbolsHelper(msg ir.MessageValue, index int, parents []
690690
for element := range seq.Values(field.Elements()) {
691691
key := field.KeyASTs().At(element.ValueNodeIndex())
692692
components := slices.Collect(key.AsPath().Components)
693-
var span report.Span
693+
var span source.Span
694694
// This covers the first case in the example above where the path is relative,
695695
// e.g. field_a is a relative path within { } for (option).message.
696696
if index > len(components)-1 {
@@ -757,7 +757,24 @@ func (f *file) messageToSymbolsHelper(msg ir.MessageValue, index int, parents []
757757
// resolveASTDefinition is a helper for resolving the [ast.DeclDef] to the *[symbol], if
758758
// there is a matching indexed *[symbol].
759759
func (f *file) resolveASTDefinition(def ast.DeclDef, defName ir.FullName) *symbol {
760-
file, ok := f.workspace.PathToFile()[def.Span().Path()]
760+
// No workspace, we cannot resolve the AST definition
761+
if f.workspace == nil {
762+
return nil
763+
}
764+
// We resolve the import path of the span of the AST definition and search for it in our
765+
// workspace.
766+
fileInfo, ok := f.workspace.fileNameToFileInfo[def.Span().Path()]
767+
if !ok {
768+
// Unable to resolve an importable path for the file in our workspace, log a debug
769+
// statement and return no definition.
770+
f.lsp.logger.Debug(
771+
"unable to resolve an importable file path for local path",
772+
slog.String("file", f.uri.Filename()),
773+
slog.String("local path", def.Span().Path()),
774+
)
775+
return nil
776+
}
777+
file, ok := f.workspace.PathToFile()[fileInfo.Path()]
761778
if !ok {
762779
// Check current file
763780
if def.Span().Path() != f.objectInfo.Path() {

private/buf/buflsp/image.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"buf.build/go/standard/xslices"
2727
"github.com/bufbuild/buf/private/bufpkg/bufimage"
2828
"github.com/bufbuild/protocompile"
29-
"github.com/bufbuild/protocompile/experimental/report"
29+
"github.com/bufbuild/protocompile/experimental/source"
3030
"github.com/bufbuild/protocompile/linker"
3131
"github.com/bufbuild/protocompile/parser"
3232
"github.com/bufbuild/protocompile/protoutil"
@@ -200,7 +200,7 @@ func newDiagnostic(err reporter.ErrorWithPos, isWarning bool, opener fileOpener,
200200
// TODO: this is a temporary workaround for old diagnostic errors.
201201
// When using the new compiler these conversions will be already handled.
202202
if text, ok := opener[filename]; ok {
203-
file := report.NewFile(filename, text)
203+
file := source.NewFile(filename, text)
204204
loc := file.Location(position.Offset, positionalEncoding)
205205
utf16Col = loc.Column - 1
206206
} else {

0 commit comments

Comments
 (0)