diff --git a/internal/lsp/cache/check.go b/internal/lsp/cache/check.go index fab03645d9..d0ee9753f9 100644 --- a/internal/lsp/cache/check.go +++ b/internal/lsp/cache/check.go @@ -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) - } + 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) } }