internal/lsp: stop returning errors when we can't find a snapshot

Change-Id: I319021a3339971809b6096b3271aa6b0d94ae336
Reviewed-on: https://go-review.googlesource.com/c/tools/+/216139
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
Rebecca Stambler 2020-01-23 17:05:44 -05:00
parent a4b4a6733a
commit 5c352bb417
1 changed files with 4 additions and 1 deletions

View File

@ -132,8 +132,11 @@ func (s *Server) didModifyFiles(ctx context.Context, modifications []source.File
snapshot = s
}
}
// If the file isn't in any known views (for example, if it's in a dependency),
// we may not have a snapshot to map it to. As a result, we won't try to
// diagnose it. TODO(rstambler): Figure out how to handle this better.
if snapshot == nil {
return nil, errors.Errorf("no snapshot for %s", uri)
continue
}
snapshotByURI[uri] = snapshot
snapshotSet[snapshot] = append(snapshotSet[snapshot], uri)