AI Assistant Help

Explain code with AI

Use pre-written prompts to explain your code. JetBrains IDEs provide project-specific context, such as the languages and technologies used in your project.

Explain code

  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 Explain Code.

    AI Assistant actions - Explain Code

    The AI Assistant tool window will open to provide you with an explanation.

    AI Assistant explains code

    Click Attached elements to see the list of files that provided the necessary context for generating the answer.

    Attached files that were analyzed to generate the answer

    AI Assistant can also detect and explain injected language fragments like regular expressions, SQL, or cron expressions. The detected fragment type is indicated in the context menu option (Explain RegExp fragment for regular expressions and so on).

    Explain RegExp option in the context menu

Explain runtime error

Not available in: GoLand, Rider, RustRover

JetBrains IDEs provide you with AI explanations for errors that occur when running commands, queries, and files, Java and Python code, PHP scripts, and unit tests.

  1. Click Explain with AI in the console.

    Alternatively, select the error message, right-click it, and then select Explain Error Message with AI from the context menu.

    Explain with AI option in console
    Explain with AI option in console
    Explain with AI option in console
    Explain  error message with AI
    Explain with AI option in console
    Explain with AI option in console
    Explain with AI option in console
    Explain with AI option in console
    Explain with AI option in console
    Explain with AI option in console

    The AI Assistant tool window will open to give you an explanation of the error and suggest a fix.

    Runtime error explanation
  2. If you want to use the suggested fix, click Insert Snippet at Caret in the field with the refactored code to put the AI-generated code into the editor.

    Insert the corrected code in the editor

Explain log errors

Only available in: PhpStorm

AI Assistant allows you to get AI explanations for the errors in log files when you open such files in the editor.

  • Click Explain with AI in the editor next to the log line with an error.

    The AI Assistant tool window will open to give you an explanation of the error and suggest a fix.

    Explain logs with AI in the editor

Explain CMake errors

Only available in: CLion

AI Assistant can help you investigate CMake execution problems.

  1. Click Explain with AI in the CMake tool window next to the error message:

    Explain with AI for CMake errors
  2. The AI Assistant will explain the error for you and suggest how to fix it:

    The AI Assistant explanation of a CMake error

Explain build errors and warnings

Only available in: Rider

If you have any warnings or errors in the Build tool window Alt+0, you can select any message, right-click it and choose Explain error message with AI:

Explain build warning with AI

Explain compilation errors

Only available in: RustRover

AI Assistant can also help you analyze build error messages.

  • In the console, locate the error message and click Explain with AI.

    Explain compilation error with AI

The AI Assistant tool window will open to provide you with an explanation.

AI Assistant tool window with an explanation of the compilation error

Explain SQL code

This feature can require attaching the database schema to suggest proper explanations.

For any problems higher than weak warning, the assistant suggests an explanation. 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 Explain SQL problem under caret.

AI Assistant will provide its explanation in chat.

AI Assistant explains problems in the selected SQL code
Last modified: 14 April 2025