1
0
mirror of https://github.com/golang/go synced 2024-11-18 21:14:44 -07:00
go/internal/lsp/cache
Muir Manders 1d0142ba47 internal/lsp: improve error handling while parsing
If the context is canceled (or times out) during parsing, we were
previously caching the package with no *ast.Files. Any further LSP
queries against that package would fail because the package is already
loaded, but none of the files are mapped to the package. Fix by
propagating non-parse errors as "fatal" errors in
parseFiles. typeCheck will propagate these errors and not cache the
package.

I also fixed the package cache to not cache errors loading
packages. If you get an error like "context canceled" then none of the
package's files are mapped to the package. This prevents the package
from ever getting unmapped when its files are updated. I also added a
retry mechanism where if the current request is not canceled but the
package failed to load due to a previous request being canceled, this
request can try loading the package again.

Updates golang/go#32354, golang/go#32360

Change-Id: I466ddb8d336aeecf6e50f9f6d040787a86a60ca0
GitHub-Last-Rev: 5f1e7ef9c883b76a9c1b3636936d91ec0821d922
GitHub-Pull-Request: golang/tools#110
Reviewed-on: https://go-review.googlesource.com/c/tools/+/181317
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-06-11 16:41:26 +00:00
..
cache.go internal/lsp: change file system to allow lazy reads 2019-06-06 01:09:34 +00:00
check.go internal/lsp: improve error handling while parsing 2019-06-11 16:41:26 +00:00
external.go internal/span: change URI.Filename so it just returns the filename 2019-06-10 21:39:43 +00:00
file.go internal/lsp: remove source.FileContent 2019-06-06 05:02:23 +00:00
gofile.go internal/lsp: track missing imports, re-running packages.Load 2019-06-10 18:15:09 +00:00
load.go internal/lsp: improve error handling while parsing 2019-06-11 16:41:26 +00:00
modfile.go internal/lsp: add modfile, sumfile structs, require Go files for diagnostics 2019-05-24 21:02:28 +00:00
parse.go internal/lsp: improve error handling while parsing 2019-06-11 16:41:26 +00:00
pkg.go internal/lsp: fix some issues with trimming ASTs 2019-06-07 20:08:10 +00:00
session.go internal/span: change URI.Filename so it just returns the filename 2019-06-10 21:39:43 +00:00
sumfile.go internal/lsp: add modfile, sumfile structs, require Go files for diagnostics 2019-05-24 21:02:28 +00:00
view.go internal/lsp: stop requiring a .go extension for all Go files 2019-06-11 15:22:25 +00:00
watcher.go internal/lsp: add file watching and use it to trigger invalidations 2019-05-24 14:03:12 +00:00