From 2230ca808a3a88c17d5285721a9e6f17d42ff9ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Wed, 13 Sep 2023 16:35:53 +0200 Subject: [PATCH] general_threading_rules.md: minor, add info about DevKit inspections --- .../general_threading_rules.md | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/topics/basics/architectural_overview/general_threading_rules.md b/topics/basics/architectural_overview/general_threading_rules.md index 9cb5cffcb..358097b0b 100644 --- a/topics/basics/architectural_overview/general_threading_rules.md +++ b/topics/basics/architectural_overview/general_threading_rules.md @@ -1,6 +1,8 @@ +# General Threading Rules + -# General Threading Rules + Threading rules for reading and writing to IntelliJ Platform data models, running and canceling background processes, and avoiding UI freezes. @@ -12,8 +14,8 @@ In general, code-related data structures in the IntelliJ Platform are covered by You must not access the model outside a read or write action for the following subsystems: -- [Program Structure Interface](psi.md) (PSI) -- [Virtual File System](virtual_file_system.md) (VFS) +- [](psi.md) (PSI) +- [](virtual_file_system.md) (VFS) - [Project root model](project_structure.md). ### Read Access @@ -77,17 +79,32 @@ This call throws a special unchecked [`ProcessCanceledException`](%gh-ic%/platfo All code working with PSI, or in other kinds of background processes, must be prepared for [`ProcessCanceledException`](%gh-ic%/platform/util/base/src/com/intellij/openapi/progress/ProcessCanceledException.java) being thrown from any point. This exception should never be logged but rethrown, and it'll be handled in the infrastructure that started the process. +Use inspection Plugin DevKit | Code | 'ProcessCanceledException' handled incorrectly (2023.3). The `checkCanceled()` should be called often enough to guarantee the process's smooth cancellation. PSI internals have a lot of `checkCanceled()` calls inside. If a process does lengthy non-PSI activity, insert explicit `checkCanceled()` calls so that it happens frequently, e.g., on each _Nth_ loop iteration. +Use inspection Plugin DevKit | Code | Cancellation check in loops (2023.1). -> Throwing `ProcessCanceledException` from `checkCanceled()` can be disabled for development (e.g. while debugging the code) by invoking: -> -> - _2023.2+_ Tools | Internal Actions | Skip Window Deactivation Events -> - _earlier versions_ Tools | Internal Actions | Disable ProcessCanceledException -> -> These actions are available only if [Internal Mode is enabled](enabling_internal.md). +### Disabling ProcessCanceledException + +Throwing `ProcessCanceledException` from `ProgressIndicator.checkCanceled()` can be disabled for development (e.g., while debugging the code) by invoking: + + + + +Tools | Internal Actions | Skip Window Deactivation Events + + + + + +Tools | Internal Actions | Disable ProcessCanceledException + + + + +These actions are available only if [Internal Mode is enabled](enabling_internal.md). ## Read Action Cancellability