Invalidate inspection results after parsing #4695
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR closes #2023
This PR introduces the base framework for inspection result invalidation. Each inspection result now has a member
ChangedInvalidateResult
taking the modified modules and returning whether the result got invalidated by the changes.The base implementation checks whether the module on the inspection result got modified. If not, it asks the inspection whether it thinks that the result is stale.
DeclarationInspectionResults
andIdentifierInspectionResults
also take the module of the corresponding declaraion into account.AggregateInspectionResults
are always considered stale as there is no information about the contents.For the inspections, the check whether a result is stale defaults to true. If anything else is desired, the corresponding virtual method on
InspectionBase
has to be overriden. (This effectively deems all results stale at the moment.)In the
InspectionViewModel
now all reults deemed atale get removed after a parse, provided the inspections do not run; running the inspections removes all results anyway. Consequently, when automatically running the inspections is deactivated, the stale results no longer remain in the view. This prevents the execution of quickfixes on stale data.Currently, all existing modules are considered modified. To change that, the parsed modules would have to find their way into the state changed handler somehow. (This will not be part of this PR.)