Skip to content

Commit 3166d26

Browse files
1 parent 6cf129d commit 3166d26

File tree

3 files changed

+12
-21
lines changed

3 files changed

+12
-21
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.9.0
19-
github.com/bufbuild/protocompile v0.14.2-0.20260225215724-b8c2e2d4ce33
19+
github.com/bufbuild/protocompile v0.14.2-0.20260303192457-6802ddf78c43
2020
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1
2121
github.com/cli/browser v1.3.0
2222
github.com/docker/docker v28.5.2+incompatible

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ github.com/bmatcuk/doublestar/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6
4242
github.com/bmatcuk/doublestar/v4 v4.10.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
4343
github.com/brianvoe/gofakeit/v6 v6.28.0 h1:Xib46XXuQfmlLS2EXRuJpqcw8St6qSZz75OUo0tgAW4=
4444
github.com/brianvoe/gofakeit/v6 v6.28.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs=
45-
github.com/bufbuild/protocompile v0.14.2-0.20260225215724-b8c2e2d4ce33 h1:dyIXDSlRi5GYc+sAuasCGnmFOZS09rAShVnMiw+2c3E=
46-
github.com/bufbuild/protocompile v0.14.2-0.20260225215724-b8c2e2d4ce33/go.mod h1:cxhE8h+14t0Yxq2H9MV/UggzQ1L0gh0t2tJobITWsBE=
45+
github.com/bufbuild/protocompile v0.14.2-0.20260303192457-6802ddf78c43 h1:uI2QIsBGmJ2iTqH0x5kY+dpm+hbSw/9O1LDardylU/0=
46+
github.com/bufbuild/protocompile v0.14.2-0.20260303192457-6802ddf78c43/go.mod h1:cxhE8h+14t0Yxq2H9MV/UggzQ1L0gh0t2tJobITWsBE=
4747
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1 h1:V1xulAoqLqVg44rY97xOR+mQpD2N+GzhMHVwJ030WEU=
4848
github.com/bufbuild/protoplugin v0.0.0-20250218205857-750e09ce93e1/go.mod h1:c5D8gWRIZ2HLWO3gXYTtUfw/hbJyD8xikv2ooPxnklQ=
4949
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=

private/buf/buflsp/file.go

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ func (f *file) RefreshIR(ctx context.Context) {
234234
// Opener creates a cached view of all files in the workspace.
235235
pathToFiles := f.workspace.PathToFile()
236236
files := make([]*file, 0, len(pathToFiles))
237+
paths := make([]string, 0, len(pathToFiles))
237238
var evictQueryKeys []any
238239

239240
openerMap := f.lsp.opener.Get()
@@ -249,6 +250,7 @@ func (f *file) RefreshIR(ctx context.Context) {
249250
}
250251
}
251252
files = append(files, file)
253+
paths = append(paths, path)
252254
}
253255
// Remove paths that are no longer in the current workspace and evict stale query keys.
254256
for path := range openerMap {
@@ -258,14 +260,14 @@ func (f *file) RefreshIR(ctx context.Context) {
258260
}
259261
f.lsp.queryExecutor.Evict(evictQueryKeys...)
260262

261-
queries := xslices.Map(files, func(file *file) incremental.Query[*ir.File] {
262-
return file.queryIR()
263-
})
264-
265263
results, diagnosticReport, err := incremental.Run(
266264
ctx,
267265
f.lsp.queryExecutor,
268-
queries...,
266+
queries.Workspace{
267+
Opener: f.lsp.opener,
268+
Session: f.lsp.irSession,
269+
Workspace: source.NewWorkspace(paths),
270+
},
269271
)
270272
if err != nil {
271273
f.lsp.logger.Error(
@@ -276,8 +278,9 @@ func (f *file) RefreshIR(ctx context.Context) {
276278
)
277279
return
278280
}
281+
irFiles := results[0].Value
279282
for i, file := range files {
280-
file.ir = results[i].Value
283+
file.ir = irFiles[i]
281284
if f != file {
282285
// Update symbols for imports.
283286
file.IndexSymbols(ctx)
@@ -298,18 +301,6 @@ func (f *file) RefreshIR(ctx context.Context) {
298301
)
299302
}
300303

301-
// queryIR returns the [queries.IR] for the current file.
302-
func (f *file) queryIR() incremental.Query[*ir.File] {
303-
if f.objectInfo == nil {
304-
return nil
305-
}
306-
return queries.IR{
307-
Opener: f.lsp.opener,
308-
Path: f.objectInfo.Path(),
309-
Session: f.lsp.irSession,
310-
}
311-
}
312-
313304
// queryFileKeys returns the keys for [queries.File] with ReportError set to true and false.
314305
// This is because [queries.AST] depends on ReportError set to true and [queries.IR] depends
315306
// on ReportError set to false, so we need both keys when evicting cached [queries.File]

0 commit comments

Comments
 (0)