Open jensjoha opened 1 year ago
@scheglov Sounds like we need to forget that we've run discoverAvailableFiles
so that it will run again.
That would probably be one way to go, but wouldn't it make more sense to not throw everything away?
For instance, wouldn't it be possible to for instance just refresh the deleted file instead? (the signature created has both content and a bool exists
so I'm assuming that's supported). Or even better, invalidate as-if it had been updated, then remove it from whatever maps it's in. Having to actually run discover available files again isn't exactly free.
TL;DR Deleting a file can cause "find all implementations" query to reduce the number of results (and probably other stuff too).
Reproduction (example):
pkg/_fe_analyzer_shared
in an editor.lib/src/parser/listener.dart
.Listener
issue a "Find all implementations" query.19 results in 16 files
, among them results fromfront_end
andanalyzer
.touch pkg/_fe_analyzer_shared/lib/x.dart ; sleep 3; rm pkg/_fe_analyzer_shared/lib/x.dart
Listener
issue a "Find all implementations" query again.9 results in 6 files
, all in_fe_analyzer_shared
.What happens is, that on the initial "Find all implementations" query a
discoverAvailableFiles
task is created which basically "discovers" all files in all paths mentioned in the packages file. This is why it finds results inanalyzer
andfront_end
. When deleting a file it clears "everything" (removeFile
->_clearFiles
infile_state.dart
) among it the previously discovered extra files. Issuing the "Find all implementations" query again thediscoverAvailableFiles
will not do anything as it's already completed, there will thus not be any extra files to search./cc @bwilkerson @scheglov