Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
buf.build/go/standard v0.1.0
connectrpc.com/connect v1.19.1
connectrpc.com/otelconnect v0.8.0
github.com/bufbuild/protocompile v0.14.2-0.20251223142729-db46c1b9d34e
github.com/bufbuild/protocompile v0.14.2-0.20260105175043-4d8d90b1c6b8
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1
github.com/cli/browser v1.3.0
github.com/docker/docker v28.5.2+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/
github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/brianvoe/gofakeit/v6 v6.28.0 h1:Xib46XXuQfmlLS2EXRuJpqcw8St6qSZz75OUo0tgAW4=
github.com/brianvoe/gofakeit/v6 v6.28.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs=
github.com/bufbuild/protocompile v0.14.2-0.20251223142729-db46c1b9d34e h1:LQA+1MyiPkolGHJGC2GMDC5Xu+0RDVH6jGMKech7Exs=
github.com/bufbuild/protocompile v0.14.2-0.20251223142729-db46c1b9d34e/go.mod h1:5UUj46Eu+U+C59C5N6YilaMI7WWfP2bW9xGcOkme2DI=
github.com/bufbuild/protocompile v0.14.2-0.20260105175043-4d8d90b1c6b8 h1:cQYwUyAzyMmYr7AyJU1C6pVCpUrJJBkmx7UunZosxxs=
github.com/bufbuild/protocompile v0.14.2-0.20260105175043-4d8d90b1c6b8/go.mod h1:5UUj46Eu+U+C59C5N6YilaMI7WWfP2bW9xGcOkme2DI=
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1 h1:V1xulAoqLqVg44rY97xOR+mQpD2N+GzhMHVwJ030WEU=
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1/go.mod h1:c5D8gWRIZ2HLWO3gXYTtUfw/hbJyD8xikv2ooPxnklQ=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
Expand Down
2 changes: 1 addition & 1 deletion private/buf/buflsp/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ func offsetInSpan(offset int, span source.Span) int {
if offset < span.Start {
return -1
} else if offset > span.End {
// End is inclusive for completions _
// End is inclusive for completions
return 1
}
return 0
Expand Down
32 changes: 18 additions & 14 deletions private/buf/buflsp/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type file struct {

ir *ir.File
irQuery queries.IR
fileQuery queries.File
evictQueryKeys []any
referenceableSymbols map[ir.FullName]*symbol
referenceSymbols []*symbol
symbols []*symbol
Expand Down Expand Up @@ -101,9 +101,7 @@ func (f *file) Reset(ctx context.Context) {
}
// Evict the query key if there is a query cached on the file. We cache the [queries.File]
// query since this allows the executor to evict all dependent queries, e.g. AST and IR.
if f.fileQuery.Path != "" {
f.lsp.queryExecutor.Evict(f.fileQuery.Key())
}
f.lsp.queryExecutor.Evict(f.evictQueryKeys...)
// Clear the file as nothing should use it after reset. This asserts that.
*f = file{}
}
Expand Down Expand Up @@ -245,16 +243,22 @@ func (f *file) RefreshIR(ctx context.Context) {
// update the opener and set a new query.
if current == nil || current.Text() != file.file.Text() {
openerMap[path] = file.file
// Add the query key for eviction if there is a query cached on the file. We cache
// the [queries.File] query since this allows the executor to evict all dependent
// queries, e.g. AST and IR.
if file.fileQuery.Path != "" {
evictQueryKeys = append(evictQueryKeys, file.fileQuery.Key())
}
file.fileQuery = queries.File{
Opener: file.lsp.opener,
Path: path,
ReportError: true, // [queries.AST] sets this to be true.
evictQueryKeys = append(evictQueryKeys, file.evictQueryKeys...)

// Set new queries on the file. We must evict [queries.File] with ReportError set to
// both true and false, since [queries.AST] depends on ReportError set to true, and
// [queries.IR] depends on ReportError set to false.
file.evictQueryKeys = []any{
queries.File{
Opener: file.lsp.opener,
Path: path,
ReportError: true,
}.Key(),
queries.File{
Opener: file.lsp.opener,
Path: path,
ReportError: false,
}.Key(),
}
file.irQuery = queries.IR{
Opener: file.lsp.opener,
Expand Down