mirror of
https://github.com/golang/go
synced 2024-11-18 16:44:43 -07:00
internal/lsp: propagate context.Canceled when type checking
typeCheck() was swallowing context.Canceled errors and leaving the cached package in a bad state. In particular, after two rapid changes to imports I was left in the "no package for file" error mode until I change my imports again. The second change canceled the first change which ended up sticking a skeleton *pkg in the package cache instead of propagating the canceled error. Change-Id: I15b072188c3359d9cd1812bd49e72548ba214250 GitHub-Last-Rev: 240f61718fbb5bfc787bbfaaaae1d38925d7c405 GitHub-Pull-Request: golang/tools#126 Reviewed-on: https://go-review.googlesource.com/c/tools/+/183940 Reviewed-by: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
5d636af2a9
commit
47ea21585c
6
internal/lsp/cache/check.go
vendored
6
internal/lsp/cache/check.go
vendored
@ -142,10 +142,12 @@ func (imp *importer) typeCheck(id packageID) (*pkg, error) {
|
||||
wg.Wait()
|
||||
|
||||
for _, f := range files {
|
||||
if f != nil {
|
||||
pkg.files = append(pkg.files, f)
|
||||
}
|
||||
|
||||
if f.err != nil {
|
||||
if f.err == context.Canceled {
|
||||
return nil, f.err
|
||||
}
|
||||
imp.view.session.cache.appendPkgError(pkg, f.err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user