aboutsummaryrefslogtreecommitdiff
path: root/internal/lsp/cache/parse.go
diff options
context:
space:
mode:
authorHeschi Kreinick <heschi@google.com>2020-07-21 14:17:53 -0400
committerHeschi Kreinick <heschi@google.com>2020-07-28 17:34:57 +0000
commit4d1d9acccfd63e494cda58054baf5113972ffacb (patch)
treefb18125ab442c2d51736d393faceb8dfeb9a7e22 /internal/lsp/cache/parse.go
parent72051f796149b570577cd7e666ea968b19e0745d (diff)
downloadgolang-x-tools-4d1d9acccfd63e494cda58054baf5113972ffacb.tar.gz
internal/lsp/cache: fix parseKey
The FileIdentity struct mixes information about the file itself (filename, hash) with information about the LSP references to that file (session ID, version). When we create a cache key using it, we only want the former, as returned by the String method. Otherwise we split the cache whenever those irrelevant fields are different. We also use FileIdentity as an element of diagnosticsKey, but I believe that use is appropriate. Change-Id: I094e00d2700e05778da635effbb69d0ebcb6726e Reviewed-on: https://go-review.googlesource.com/c/tools/+/244020 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Diffstat (limited to 'internal/lsp/cache/parse.go')
-rw-r--r--internal/lsp/cache/parse.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/lsp/cache/parse.go b/internal/lsp/cache/parse.go
index 04a78bdfe..eeeccbc97 100644
--- a/internal/lsp/cache/parse.go
+++ b/internal/lsp/cache/parse.go
@@ -24,7 +24,7 @@ import (
// parseKey uniquely identifies a parsed Go file.
type parseKey struct {
- file source.FileIdentity
+ file string // FileIdentity.String()
mode source.ParseMode
}
@@ -62,7 +62,7 @@ func (c *Cache) ParseGoHandle(ctx context.Context, fh source.FileHandle, mode so
func (c *Cache) parseGoHandle(ctx context.Context, fh source.FileHandle, mode source.ParseMode) *parseGoHandle {
key := parseKey{
- file: fh.Identity(),
+ file: fh.Identity().String(),
mode: mode,
}
parseHandle := c.store.Bind(key, func(ctx context.Context, arg memoize.Arg) interface{} {