IntelliJ Platform Plugin SDK
 
IntelliJ Platform Explorer

Intention Action Preview

Edit pageLast modified: 30 July 2024

The IntelliJ Platform can show a preview for IntentionAction and LocalQuickFix. That means when the user shows available context actions, an additional small popup highlights the differences between the current code and the code after executing the intention.

Under the hood, this preview is created using a copy of the current file inside a separate, headless editor where the intention is applied to get the result. The difference between this result and the original code is used to build the preview where changes that are about to happen are highlighted.

The IntelliJ Platform has a default implementation for the preview, which works out of the box when existing intentions fulfill specific requirements, make only localized changes to the code, and require no further user input.

However, in specific cases, plugin authors will need to adapt their intentions to prepare them for the correct display of the preview. In the following, plugin authors can learn the requirements for intention previews in detail and the alternative options for previews the IntelliJ Platform provides.