mirror of https://github.com/golang/go.git
internal/lsp/cache: delete KnownMetadata.PkgFilesChanged
It is no longer needed, now that we don't consider invalid packages to be workspace packages. Change-Id: I6155a2609ab07046b9507dc04717eea7b974f1b6 Reviewed-on: https://go-review.googlesource.com/c/tools/+/421257 gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Suzy Mueller <suzmue@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
01c9ff0536
commit
99fd76f9c0
|
|
@ -644,16 +644,6 @@ func computeWorkspacePackagesLocked(s *snapshot, meta *metadataGraph) map[Packag
|
|||
if !containsPackageLocked(s, m.Metadata) {
|
||||
continue
|
||||
}
|
||||
if m.PkgFilesChanged {
|
||||
// If a package name has changed, it's possible that the package no
|
||||
// longer exists. Leaving it as a workspace package can result in
|
||||
// persistent stale diagnostics.
|
||||
//
|
||||
// If there are still valid files in the package, it will be reloaded.
|
||||
//
|
||||
// There may be more precise heuristics.
|
||||
continue
|
||||
}
|
||||
|
||||
if source.IsCommandLineArguments(string(m.ID)) {
|
||||
// If all the files contained in m have a real package, we don't need to
|
||||
|
|
|
|||
|
|
@ -91,11 +91,4 @@ type KnownMetadata struct {
|
|||
// Valid is true if the given metadata is Valid.
|
||||
// Invalid metadata can still be used if a metadata reload fails.
|
||||
Valid bool
|
||||
|
||||
// PkgFilesChanged reports whether the file set of this metadata has
|
||||
// potentially changed.
|
||||
//
|
||||
// TODO(rfindley): this is used for WorkspacePackages, and looks fishy: we
|
||||
// should probably only consider valid packages to be workspace packages.
|
||||
PkgFilesChanged bool
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1734,10 +1734,9 @@ func (s *snapshot) clone(ctx, bgCtx context.Context, changes map[span.URI]*fileC
|
|||
}
|
||||
|
||||
// Compute invalidations based on file changes.
|
||||
changedPkgFiles := map[PackageID]bool{} // packages whose file set may have changed
|
||||
anyImportDeleted := false // import deletions can resolve cycles
|
||||
anyFileOpenedOrClosed := false // opened files affect workspace packages
|
||||
anyFileAdded := false // adding a file can resolve missing dependencies
|
||||
anyImportDeleted := false // import deletions can resolve cycles
|
||||
anyFileOpenedOrClosed := false // opened files affect workspace packages
|
||||
anyFileAdded := false // adding a file can resolve missing dependencies
|
||||
|
||||
for uri, change := range changes {
|
||||
// The original FileHandle for this URI is cached on the snapshot.
|
||||
|
|
@ -1762,11 +1761,6 @@ func (s *snapshot) clone(ctx, bgCtx context.Context, changes map[span.URI]*fileC
|
|||
|
||||
// Mark all of the package IDs containing the given file.
|
||||
filePackageIDs := invalidatedPackageIDs(uri, s.meta.ids, pkgFileChanged)
|
||||
if pkgFileChanged {
|
||||
for id := range filePackageIDs {
|
||||
changedPkgFiles[id] = true
|
||||
}
|
||||
}
|
||||
for id := range filePackageIDs {
|
||||
directIDs[id] = directIDs[id] || invalidateMetadata
|
||||
}
|
||||
|
|
@ -1953,13 +1947,11 @@ func (s *snapshot) clone(ctx, bgCtx context.Context, changes map[span.URI]*fileC
|
|||
|
||||
// Check if the metadata has changed.
|
||||
valid := v.Valid && !invalidateMetadata
|
||||
pkgFilesChanged := v.PkgFilesChanged || changedPkgFiles[k]
|
||||
if valid != v.Valid || pkgFilesChanged != v.PkgFilesChanged {
|
||||
if valid != v.Valid {
|
||||
// Mark invalidated metadata rather than deleting it outright.
|
||||
metadataUpdates[k] = &KnownMetadata{
|
||||
Metadata: v.Metadata,
|
||||
Valid: valid,
|
||||
PkgFilesChanged: pkgFilesChanged,
|
||||
Metadata: v.Metadata,
|
||||
Valid: valid,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue