fix(workspace): remove caching of file features #2939
Merged
+37
−48
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.
Summary
Closes #2781
The issue was the aggressive caching of
FileFeatureResult
, maybe designed with poor judgement from my side.Here's the issue explained: when a file is opened, the LSP request diagnostics from a certain file. We pull diagnostics using these feature set:
A formatter doesn't have proper diagnostics, so we exclude it from the features. Since the formatter feature isn't requested, the default value is used, which is
Supported
becauseignore
part is checked only on a parameter basis.However, this was then cached inside our workspace.
When calling the formatting, we pull the formatter feature:
Which is flagged as
Supported
because we retrieve the cached value.As for a solution, for now, I removed the cache.
I plan to re-introduce the caching again, but I plan to rewrite the logic is a more pure way.
Test Plan
I manually tested it.