Use AI in editor
This functionality relies on the AI Assistant plugin that requires an additional license.
For more information about licensing and enabling AI Assistant, refer to JetBrains AI Service licensing and Enable AI Assistant plugin.
This functionality relies on the AI Assistant plugin, which you need to install and enable.
Press to open settings and then select Plugins.
Open the Marketplace tab, find the AI Assistant plugin, and click Install (restart the IDE if prompted).
Generate code using prompts right in the editor or start a chat with AI Assistant.
Select a piece of code that you want to modify or place the caret anywhere in the editor and press .
Alternatively, right-click anywhere in the editor to open the context menu, select AI Actions and then Ask AI Assistant.
note
If you select a piece of code and ask AI Assistant to generate code, it will only suggest changes for the selected piece of code.
If you place the caret anywhere in the editor before asking AI Assistant to generate code, the generated code will be inserted in the editor at the caret.
In the input field, write your prompt and press .
Wait for the generation to complete. The generated code will be shown in the same editor tab where you have invoked the input field.
If you want to improve the generated code, in the same input field, write a follow-up message with the new requirements and press .
If you want to improve the generated code, click Specify, add new requirements, and press .
AI Assistant will regenerate the code while taking into account the new specifications.
If you want to regenerate the answer, click Regenerate or press .
Click Accept to insert the generated fragment.
To discard all the suggested changes, click Discard.

You can use the input field the same way as the AI Assistant chat to ask programming-related questions, invoke the /explain
and /refactor
commands, or reference a particular database schema or file in your query with #
to provide more context.
For more information about the AI Assistant chat features, refer to Chat with AI.