mirror of
https://github.com/golang/go
synced 2024-11-18 15:04:44 -07:00
internal/lsp: include context in go/packages config
Include the context when invoking go/packages.Load so it is cancelable. Otherwise if the user is manually typing an import or otherwise messing around with imports, a big queue of potentially very slow go/packages.Load calls will build up. Fixes golang/go#34414. Change-Id: I80732086b478b908c720739708dd773e81fe2b81 Reviewed-on: https://go-review.googlesource.com/c/tools/+/200058 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
638914d249
commit
59731289e9
1
internal/lsp/cache/view.go
vendored
1
internal/lsp/cache/view.go
vendored
@ -109,6 +109,7 @@ func (v *view) Config(ctx context.Context) *packages.Config {
|
|||||||
// TODO: Should we cache the config and/or overlay somewhere?
|
// TODO: Should we cache the config and/or overlay somewhere?
|
||||||
return &packages.Config{
|
return &packages.Config{
|
||||||
Dir: v.folder.Filename(),
|
Dir: v.folder.Filename(),
|
||||||
|
Context: ctx,
|
||||||
Env: v.options.Env,
|
Env: v.options.Env,
|
||||||
BuildFlags: v.options.BuildFlags,
|
BuildFlags: v.options.BuildFlags,
|
||||||
Mode: packages.NeedName |
|
Mode: packages.NeedName |
|
||||||
|
Loading…
Reference in New Issue
Block a user