DataGrip 2024.2 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).

Ask AI Assistant to generate code or start a chat

Generate code using prompts right in the editor or start a chat with AI Assistant.

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 Ask AI Assistant.

  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.

    If you want to improve the generated code, click Specify, add 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.

    To discard all the suggested changes, click Discard.

AI generated SQL code in the editor

You can use the input field the same way as the AI Assistant chat to ask programming-related questions, invoke the /explain and /refactor commands, or reference a particular database schema or file in your query with # to provide more context.

For more information about the AI Assistant chat features, refer to Chat with AI.

Last modified: 22 August 2024