Skip to content

Commit 22774f7

Browse files
committed
internal/lsp/cache: invalidate metadata even without Create
When a new file is opened, the first time we learn about it will be a didOpen event. We need to invalidate the package's metadata in that case too. Fixes #35638. Change-Id: I36c6171e9c959c48ede9e125679e8dd1be7609f4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/210559 Reviewed-by: Rebecca Stambler <[email protected]>
1 parent 115af5e commit 22774f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/lsp/cache/snapshot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ func (v *view) invalidateContent(ctx context.Context, f source.File, kind source
565565
// Make a rough estimate of what metadata to invalidate by finding the package IDs
566566
// of all of the files in the same directory as this one.
567567
// TODO(rstambler): Speed this up by mapping directories to filenames.
568-
if action == source.Create {
568+
if originalFH == nil {
569569
if dirStat, err := os.Stat(dir(f.URI().Filename())); err == nil {
570570
for _, uri := range v.snapshot.getFileURIs() {
571571
if fdirStat, err := os.Stat(dir(uri.Filename())); err == nil {

0 commit comments

Comments
 (0)