| name | actions |
| description | Guidelines for implementing IntelliJ actions (AnAction). Use those rules when you need to create or change an action in the intellij platform. |
Actions
Guidelines for implementing IntelliJ actions (AnAction).
Documentation
Best Practices
- NEVER instantiate Presentation in action constructors - Use no-argument constructors
- Define text, description, and icon in plugin.xml - Not in constructor parameters
- Use AnActionEvent#getCoroutineScope for launching suspending computations -
actionPerformed runs synchronously with event invocation and may freeze the IDE.
- Follow the convention:
- Set the
id attribute for the action in plugin.xml
- Optionally set the
icon attribute if an icon is needed
- Set text and description in the message bundle (e.g., GitBundle.properties):
action.<action-id>.text=Translated Action Text
action.<action-id>.description=Translated Action Description
Good example:
Kotlin:
class MyAction : AnAction()
plugin.xml:
<action id="My.Action.Id"
class="my.package.MyAction"
icon="my.package.MyIcons.ICON"/>
Bundle.properties:
action.My.Action.Id.text=My Action
action.My.Action.Id.description=Description of my action