AI Assistant Help

Find and fix problems with AI

Find problems

  1. Select a code fragment and right-click it to open the context menu.

    Alternatively, select a code fragment and press Alt+Enter.

  2. Select AI Actions and then Find Problems.

    The AI chat will open to show the potential issues you may want to look into.

    AI Assistant finds potential problems in the selected code

Suggest refactoring

  1. Select a code fragment and right-click it to open the context menu.

    Alternatively, select a code fragment and press Alt+Enter.

  2. Select AI Actions and then Suggest Refactoring.

    The AI chat will open to offer you refactoring suggestions.

    AI Assistant: AI Assistant suggests refactoring
  3. 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.

    Diff tab with refactored code
  4. 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.

  1. Place the caret at a highlighted error in the editor. Then click the red light bulb icon the Quick-fix icon or press Alt+Enter to open the list of suggestions.

  2. Click Fix with AI (in DataGrip, Fix with AI Assistant).

    Fix with AI

    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

  1. Select a code fragment and right-click it to open the context menu.

    Alternatively, select a code fragment and press Alt+Enter.

  2. Select AI Actions and choose the Django intention.

    Choosing 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.

    AI Assistant suggests Django intentions
    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.

    AI Assistant suggests Django intentions with context

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:

  1. In the editor, invoke the intention actions by placing the caret at the highlighted code and pressing Alt+Enter, then select AI Actions.

  2. In the AI Actions dialog, select Fix SQL problem under caret.

AI Assistant suggests a fix for the problems of selected SQL code

AI Assistant will provide its fix in editor.

AI Assistant suggests a fix for the problems of selected SQL code

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 suggests a fix for the syntax errors of selected SQL code

AI Assistant will provide its fix in editor.

AI Assistant suggests a fix for the syntax errors of selected SQL code
Last modified: 31 March 2025