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>
diff --git a/internal/lsp/cache/parse.go b/internal/lsp/cache/parse.go
index 04a78bd..eeeccbc 100644
--- a/internal/lsp/cache/parse.go
+++ b/internal/lsp/cache/parse.go
@@ -24,7 +24,7 @@
 
 // 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 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{} {