Addition note about intention and quick-fixes execution in UI thread
This commit is contained in:
@@ -39,6 +39,11 @@ function when descriptor is absent.
|
|||||||
invalidated by the moment of the actual quick fix execution. Avoid the code that can throw exceptions because of that. Re-checks with early
|
invalidated by the moment of the actual quick fix execution. Avoid the code that can throw exceptions because of that. Re-checks with early
|
||||||
exit from the quick fix can be used to workaround it.
|
exit from the quick fix can be used to workaround it.
|
||||||
|
|
||||||
|
- Intentions and quick fixes execution happens in the UI thread so do not call long operations such as usages search or resolve to avoid
|
||||||
|
freezes. `PSI` elements obtained from resolve during the applicability check can be stored in `SmartPsiElementPointer` for the postponed
|
||||||
|
modification in quick-fixes. All complex searches should be executed in a background thread under a progress indicator. Some tests
|
||||||
|
already assert that resolve operations are not called from UI thread while applying fixes.
|
||||||
|
|
||||||
- There shouldn't be PSI elements stored in QuickFix classes (`val psi: PsiElement`) as such elements might be invalidated and can lead
|
- There shouldn't be PSI elements stored in QuickFix classes (`val psi: PsiElement`) as such elements might be invalidated and can lead
|
||||||
to memory leaks. Smart pointer (check `SmartPsiElementPointer` class and `createSmartPointer()` function) can be used when such storage
|
to memory leaks. Smart pointer (check `SmartPsiElementPointer` class and `createSmartPointer()` function) can be used when such storage
|
||||||
is absolutely necessary.
|
is absolutely necessary.
|
||||||
|
|||||||
Reference in New Issue
Block a user