AI Assistant Help

Code completion

Not available in: DataGrip

Cloud completion powered by AI Assistant can autocomplete single lines, blocks of code, and even entire functions in real time based on the project context. The generated code is similar to how you would write code, matching your style and naming conventions.

Work with cloud completion in the editor

  1. The suggestions are shown in the editor as you type.

    You can also trigger the code completion by pressing Alt+Shift+\.

    AI-generated code suggestion
  2. To apply the suggestion:

    • Press Tab to accept the entire suggestion. You can configure a different shortcut for this action.

    • Press Ctrl+Right to accept a suggestion word by word.

    • Press End to accept a suggestion line by line.

    To reject the suggestion, press Escape. Alternatively, just continue to write your own code or change the caret position either with the arrow keys or by a mouse click.

Configure cloud completion

The cloud completion option is enabled by default. To configure the way it works, press Ctrl+Alt+S to open the settings and go to Editor | General | Inline Completion.

Enable the necessary options to personalize your experience with code completion.

Item

Description

Enable cloud completion suggestions

Enable cloud code completion and select the languages that you want to use cloud completion with.

Completion policy

Select the number of code suggestions you want to get: a brief Focused mode, the default Balanced mode, or a more verbose Creative mode.

Code completion policy can also be set from the JetBrains AI widget.

Completion policy settings

Enable code completion indicator

This option colors the caret in purple to indicate that code completion is invoked

Purple caret

Enable syntax highlighting in completion suggestions

This option turns on the code highlighting for the suggested code. If disabled, the suggested code is shown in gray font.

Enable multi-line suggestions

Clear this checkbox to leave only single-line suggestions

Synchronize inline and popup completions

Select this option to see suggestions listed in a popup that appears in the editor while you type. This way, you can avoid shortcut conflicts.

Inline and popup completions combined

To disable cloud code completion, clear the Enable cloud completion suggestions checkbox on the same settings page or in Settings | Tools | AI Assistant.

Change the cloud completion shortcut

You can change the default cloud completion shortcut that you use to accept suggestions.

  1. Hover over the suggestion.

  2. In the popup that appears, click and select the key that you want to use for accepting suggestions.

    To assign your own shortcut, select Custom.

    Code completion popup%

You can also change any code completion shortcuts in the Settings | Keymap anytime.

Last modified: 15 April 2025