DataGrip 2024.3 Help

Use AI in editor

Install the AI Assistant plugin

This functionality relies on the AI Assistant plugin, which you need to install and enable.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Marketplace tab, find the AI Assistant plugin, and click Install (restart the IDE if prompted).

Generate code in the editor using prompts

Generate code and use prompts right in the editor.

Generate code in editor using prompts

  1. Select a piece of code that you want to modify or place the caret anywhere in the editor and press Ctrl+\.

    Alternatively, right-click anywhere in the editor to open the context menu, select AI Actions and then Generate Code.

  2. In the input field, write your prompt and press Enter.

    Input field in the editor
  3. Wait for the generation to complete. The generated code will be shown in the same editor tab where you have invoked the input field.

    Generated SQL code
  4. If you want to improve the generated code, in the same input field, write a follow-up message with the new requirements and press Enter.

    AI Assistant will regenerate the code while taking into account the new specifications.

    New requirements to update the generated code

    If you want to regenerate the answer, click Regenerate or press Ctrl+F5.

  5. Click Accept 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 in the input popup.

AI generated SQL code in the editor

SQL error handling

AI Assistant can explain and fix SQL query execution errors in editor tabs. The corresponding actions are available in the error message area.

Explain SQL errors

AI Assistant can explain the SQL execution error in your code. You can also ask further questions about the error in AI chat.

  1. After running an SQL query and encountering a query execution error, click Explain with AI in the error message area.

    SQL query execution error handling actions
  2. DataGrip opens AI chat with an automatically sent prompt and AI Assistant’s response, providing an explanation of the error.

    SQL query error explained by AI Assistant

Fix SQL errors

AI Assistant can fix the SQL execution error in your code.

  1. After running an SQL query and encountering a query execution error, click Fix with AI in the error message area.

    SQL query execution error handling actions
  2. AI Assistant generates a fix for the query execution error in the editor.

    SQL query error fixed by AI Assistant

Fix errors with AI

When DataGrip detects code that produces pre-compilation 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 the code element that you want to modify. 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.

    AI Assistant sends the entire file together with related files 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.

Last modified: 13 November 2024