Don't trigger code action requests for background views #2108
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.
Servers like typescript trigger
textDocument/publishDiagnostics
for all open files on making any changes. OurDocumentSyncListener
triggered code action request in that case.Changed so that code action request is only made if the view is visible.
Since the code action response can be affected by changed diagnostics, make sure that the code action request is then also made when view is activated later.
We should have been triggering code action request on view activation anyway as otherwise we have relied on
textDocument/publishDiagnostics
triggering it which is not guaranteed.Also made sure that
on_load_async
triggerson_activated_async
which triggers code actions/code lenses/semantic tokens because when file is initially focused the view is not registered yet so we have missed all the logic currently inon_activated_async
.Fixes #2101