Use AI in editor
Generate code in the editor using prompts
Generate code and use prompts right in the editor.
Generate code in editor using prompts
Select a piece of code that you want to modify or place the caret anywhere in the editor and press ⏎.
Alternatively, right-click anywhere in the editor to open the context menu, select AI Actions and then Generate Code.
In the input field, write your prompt and press ⏎.
If you want to improve the generated code, click Modify Prompt, add new requirements, and press ⏎.
AI Assistant will regenerate the code while taking into account the new specifications.
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.
Invoke AI-powered code completion
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
The suggestions are shown in the editor as you type.
You can also trigger the code completion by pressing ⌘ ⇧ ;.
To apply the suggested code, press ⇥.
Acceptance of code autocompletion by pressing ⇥ occurs as follows:
If there is no basic autocompletion popup, pressing ⇥ will accept the entire suggested gray string.
If both the basic JetBrains Fleet autocompletion popup and the gray completion string are present, pressing ⇥ once will accept the first word, and pressing ⇥ again will accept the entire string.
To reject the suggestion, press Esc. Alternatively, just continue to write your own code or change the caret position either with the arrow keys or by a mouse click.
Change the cloud completion shortcut
You can change the default cloud completion shortcut that you use to accept suggestions.
Hover over the suggestion.
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.
You can also change any code completion shortcuts in the
anytime.Hide AI Assistant code completion
To hide code completion suggestions from the AI Assistant, right-click the code and select
.
Disable AI Assistant code completion
To disable code completion suggestions from the AI Assistant, use one of the following options:
Clear the checkbox in the settings: press ⌘ , to open settings and select Code section, find and clear the Show AI completion checkbox. This setting is applied globally for all languages.
. . In theModify settings.json: for more granular, per-language settings, specify the desired configuration in settings.json. Consider the following example:
"[kotlin]": { "aiCompletion.enabled": false }