Project IDX boosts your productivity with AI-assisted code suggestions from Gemini in IDX. Before you use any of the inline assistance from Gemini in IDX, make sure you add Gemini to your workspace.
To learn more, see Generative Code Assistance.
Get code suggestions from Gemini in IDX
Gemini in IDX generates complete blocks of possible code inline. To use the Gemini inline code assistance, follow these steps:
Open your IDX workspace. If you haven't already, add Gemini to your workspace.
Go to the file or line of code you want help with and press Cmd + I (on MacOS) or Ctrl + I (on Windows/ChromeOS/Linux).
Enter a description of what you want and Gemini in IDX generates a suggestion. You can also use actions as shortcuts to guide the suggestions. For example, enter /fixError for help fixing errors in inline code.
To keep the generated code, click Accept. To paste the suggestion somewhere else or move it to a new file, select the corresponding option from the drop-down menu on the Discard button. To generate a new suggestion, click the Regenerate icon. To remove the suggestion completely, click Discard.
View Gemini commands inline
To view Gemini in IDX commands inline, for specific code, select and right-click the code you want help with.
Select Gemini from the menu and then select the action you want to perform.
Use Gemini suggested code completion
To help you write code, IDX provides AI-enabled suggested code completion that predicts and autofills code in any open file as soon as you begin to type. Suggested code completion is turned on by default.
To accept a code suggestion, press Tab. To ignore the suggestion, just keep typing.
To toggle code completion on or off, adjust your code completion settings.
Open the Settings window by clicking the gear icon or pressing Ctrl + , (on Windows/Linux/ChromeOS) or Cmd + , (on MacOS).
Search for the IDX > AI > Enable Inline Completion setting in the Workspace settings.
To turn off code completion, deselect the Enable inline code completion as you type option. You have to update code completion settings for each of your workspaces.
If you use a
settings.json
file, set"IDX.aI.enableInlineCompletion": false
.
You can adjust this option under both the Workspace and User settings, but adjusting it in the Workspace settings ensures that the setting persists if the VM your workspace is connected to restarts. In IDX, User settings don't apply across your workspaces.
Once you've turned suggested code completion on, Gemini provides AI-assisted code suggestions. To accept a code suggestion, press Tab. To ignore the suggestion, just keep typing.