mirror of
https://github.com/golang/go
synced 2024-11-18 19:14:40 -07:00
internal/lsp: only reload orphaned files that belong to the workspace
We were reloading all known files, which resulted in modifications to user's go.mod files. Change-Id: I14e86af896d1e75f3fdaaa00b9af8d7fb1d1e9e5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/216542 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
7736277c76
commit
0ac6790fc6
12
internal/lsp/cache/snapshot.go
vendored
12
internal/lsp/cache/snapshot.go
vendored
@ -616,15 +616,8 @@ func (s *snapshot) reloadOrphanedFiles(ctx context.Context) error {
|
||||
s.mu.Unlock()
|
||||
}
|
||||
for _, m := range m {
|
||||
// If a package's files belong to this view, it is a workspace package
|
||||
// and should be added to the set of workspace packages.
|
||||
for _, uri := range m.compiledGoFiles {
|
||||
if !contains(s.view.session.viewsOf(uri), s.view) {
|
||||
continue
|
||||
}
|
||||
s.setWorkspacePackage(ctx, m)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -638,6 +631,11 @@ func (s *snapshot) orphanedFileScopes() []interface{} {
|
||||
if fh.Identity().Kind != source.Go {
|
||||
continue
|
||||
}
|
||||
// If the URI doesn't belong to this view, then it's not in a workspace
|
||||
// package and should not be reloaded directly.
|
||||
if !contains(s.view.session.viewsOf(uri), s.view) {
|
||||
continue
|
||||
}
|
||||
// Don't reload metadata for files we've already deemed unloadable.
|
||||
if _, ok := s.unloadableFiles[uri]; ok {
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user