Find and fix problems with AI
Find problems
Select a code fragment and right-click it to open the context menu.
Alternatively, select a code fragment and press Alt+Enter.
Select AI Actions and then Find Problems.
The AI chat will open to show the potential issues you may want to look into.
Suggest refactoring
Select a code fragment and right-click it to open the context menu.
Alternatively, select a code fragment and press Alt+Enter.
Select AI Actions and then Suggest Refactoring.
The AI chat will open to offer you refactoring suggestions.
In the field with the refactored code, click Show Diff to open the diff viewer. To skip the diff viewing step, expand the list next to Show Diff and select Apply Immediately.
In the diff viewer, use Unified or Two-Side view to review the suggested changes.
If you like the result, click
Accept in the gutter to move the selected AI-generated code snippets to the source file, or click Accept all to fully replace the originally selected code fragment. Otherwise, close the diff viewer to skip the suggested refactoring.
Fix errors with AI
When JetBrains IDE detects code that produces errors, it suggests a quick-fix directly within the editor.
AI Assistant can suggest more precise fixes applicable to your specific case due to its context awareness.
Place the caret at a highlighted error in the editor. Then click the red light bulb icon
or press Alt+Enter to open the list of suggestions.
Click Fix with AI (in DataGrip, Fix with AI Assistant).
AI Assistant sends the entire file together with related files (in DataGrip, with database schema) as context to the LLM to determine which fix would be most suitable in this particular case.
The code is then updated directly in the editor.
Suggest Django intentions
Only available in: PyCharm
Select a code fragment and right-click it to open the context menu.
Alternatively, select a code fragment and press Alt+Enter.
Select AI Actions and choose the Django intention.
- Create Django View For Model
AI Assistant suggests the code of a class-based view for the selected model along with the steps required to implement it in your project.
This action is available only for Django models.
- Custom Django Intention
AI Assistant provides the possible actions for the selected entity.
- Create Django Admin For Model
AI Assistant suggests the code required to register the selected model in the Django admin interface along with other necessary steps.
- Create Django Serializer For Model
AI Assistant suggests the code of a
Serializer
class along with other necessary steps.- Custom Django Smart Chat Intention
AI Assistant provides the possible actions for the selected entity taking into account the context of your project provided as attached elements in the chat.
Fix SQL code
This feature can require attaching the database schema to suggest proper fixes.
For any problems higher than weak warning, the assistant suggests a fix. To use it, do the following:
In the editor, invoke the intention actions by placing the caret at the highlighted code and pressing Alt+Enter, then select AI Actions.
In the AI Actions dialog, select Fix SQL problem under caret.

AI Assistant will provide its fix in editor.

AI Assistant can also suggest fixes for syntax errors. To use them, do the following:
In the editor, invoke the intention actions by placing the caret at the highlighted code and pressing Alt+Enter, then select Fix with AI Assistant.

AI Assistant will provide its fix in editor.
