Skip to content

Commit 59e2469

Browse files
committed
internal/lsp/cache: use snapshot ID and view folder in ModTidyHandle key
Just to be safe, the snapshot ID and view's folder should be enough to uniquely identify the ModTidyHandle. Change-Id: Ie3a0dc64bf16bcc8e4eb75af107481c07de81967 Reviewed-on: https://go-review.googlesource.com/c/tools/+/217657 Run-TryBot: Rebecca Stambler <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
1 parent cf5ba95 commit 59e2469

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

internal/lsp/cache/mod_tidy.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ const ModTidyError = "go mod tidy"
2929
const SyntaxError = "syntax"
3030

3131
type parseModKey struct {
32-
snapshot source.Snapshot
33-
cfg string
32+
view string
33+
snapshotID uint64
34+
cfg string
3435
}
3536

3637
type modTidyHandle struct {
@@ -96,8 +97,9 @@ func (s *snapshot) ModTidyHandle(ctx context.Context, realfh source.FileHandle)
9697
folder := s.View().Folder().Filename()
9798

9899
key := parseModKey{
99-
snapshot: s,
100-
cfg: hashConfig(cfg),
100+
view: folder,
101+
snapshotID: s.ID(),
102+
cfg: hashConfig(cfg),
101103
}
102104
h := s.view.session.cache.store.Bind(key, func(ctx context.Context) interface{} {
103105
data := &modTidyData{}

0 commit comments

Comments
 (0)