Skip to content

Commit 5c352bb

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
1 parent a4b4a67 commit 5c352bb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/lsp/text_synchronization.go

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

0 commit comments

Comments
 (0)