In-editor code generation
Generate code in the editor using prompts
Generate code and use inline AI prompts right in the editor.
To generate code in the editor, do one of the following:
Place the caret anywhere in the editor and press Ctrl+\. Write your prompt in the input field and press Enter.
Right-click anywhere in the editor to open the context menu, select AI Actions, and then Generate Code. Write your prompt in the input field and press Enter.
Type your prompt right in the editor where you want to make adjustments and press Tab.
Wait for the generation to complete. The generated code will be shown in the same editor tab where you have written your prompt.
If you want to improve the generated code, write a follow-up message with the new requirements in the input field on top of the editor and press Enter.
AI Assistant will regenerate the code while taking into account the new specifications.
If you want to regenerate the answer, click
Regenerate or press Ctrl+F5.
Click Accept All to insert the generated fragment.
If you want to revert some of the suggested changes, in the gutter, click
Revert.
To discard all the suggested changes, click Discard All.
Get help with name suggestions
Not available in: DataGrip, DataSpell
When you rename (Shift+F6) a symbol inline, AI Assistant suggests name options for it based on its contents.

This feature is enabled by default. To switch it on and off, check the AI Assistant settings.
Press Ctrl+Alt+S to open settings and then select
.Use the Provide AI-generated name suggestions checkbox.
Add Python type annotations
Only available in: PyCharm, DataSpell
While AI Assistant lets you add type hints via intention actions, AI Assistant further extends this functionality by suggesting types based on the context.
Right-click a function or method definition to open the context menu.
Alternatively, place the caret on it and press Alt+Enter.
Select AI Actions and then Add Type Annotations.
Type annotations are added to the function definition.