1
0
mirror of https://github.com/golang/go synced 2024-10-01 05:18:33 -06:00
go/internal/lsp/cache
Rohan Challa d6a4d55695 internal/lsp/cache: attach ModTidyHandle to snapshot instance
This change attaches a modTidyHandle to the snapshot instance and tries to reuse it as often as possible. It also modifies the modTidyKey to include the files that have not yet been saved. This was necessary because `go mod tidy` only runs using contents on disk.

So, if a user decides to add an import that is not in their modcache, we run diagnostics as normal and the ModTidyKey's imports field gets updated with the new import, we run `go mod tidy` but since the file was not saved yet, nothing changes. Then when the user eventually saves their file, we do not rerun `go mod tidy` because the imports hash has not changed from the time the file was in overlay to the time the file was saved on disk. To be able to account for this, we need the invalidate the ModTidyKey when imports change between saves.

Change-Id: I9e210a15cf009d222cecd7824c2a1a927957483b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/219477
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-03-04 14:31:13 +00:00
..
analysis.go internal/lsp/cache: hardcode parse modes instead of guessing them 2020-02-07 20:00:15 +00:00
cache.go internal/lsp: move the debug.Instance onto the Context 2020-03-03 22:54:53 +00:00
check.go internal/lsp: add a test for internal imports handling 2020-02-25 18:38:19 +00:00
debug.go internal/lsp/lsprpc: add a handshake between forwarder and remote 2020-02-24 22:51:04 +00:00
error_test.go internal/lsp: refactor error handling code in type-checking 2019-10-21 18:57:46 +00:00
errors.go internal/span,lsp: disambiguate URIs, DocumentURIs, and paths 2020-02-14 22:51:03 +00:00
external.go internal/lsp: check that a file handle is unmodified before read 2020-01-23 20:52:07 +00:00
load.go internal/lsp: add module versions from "go list" to pkg.go.dev links 2020-02-19 19:55:21 +00:00
mod.go internal/lsp/cache: attach ModTidyHandle to snapshot instance 2020-03-04 14:31:13 +00:00
parse.go internal/lsp/cache: return concrete types where possible 2020-02-19 18:42:16 +00:00
pkg.go internal/lsp: add module versions from "go list" to pkg.go.dev links 2020-02-19 19:55:21 +00:00
session.go internal/lsp: move the debug.Instance onto the Context 2020-03-03 22:54:53 +00:00
snapshot.go internal/lsp/cache: attach ModTidyHandle to snapshot instance 2020-03-04 14:31:13 +00:00
view.go internal/lsp: move the debug.Instance onto the Context 2020-03-03 22:54:53 +00:00