Project IDX + Gemini: Transforming How You Write Code


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.
Use suggested code with caution. Gemini in IDX is in preview and might give inaccurate responses. Validate all AI-assisted code and adapt it to your needs before using it in a real project.
Additionally, if you don't want your prompts used as training data to improve Gemini in IDX, don't use the chat assistant and turn off code completion in your workspace Settings.
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.
Tip: You can also use Interactive Chat with Gemini to instruct Gemini in natural language to perform actions directly in your workspace on your behalf, like updating code and running commands.
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.
Exclude files from Gemini .aiexclude files
You can control which files from your codebase should be kept hidden from Gemini in IDX by including .aiexclude
files in your project. This lets you granularly control the project context you share with Gemini.
Much like a .gitignore
file, an .aiexclude
file tracks files that shouldn't be shared with Gemini in IDX, including the chat experience as well as AI features that operate in the editor. An .aiexclude
file operates on files at or below the directory that contains it.
Note: Files ignored by .gitignore
files in your repository are automatically excluded, even if they're not listed in .aiexclude
file.
Files covered by .aiexclude
won't be indexed by Gemini when Codebase Indexing is enabled. Additionally, .aiexclude
will affect inline assistance for covered files in the following ways:
Chat assistance: Gemini won't be able to answer questions or offer suggestions about files covered by
.aiexclude
.Code completion: Suggested code completions will not be available when editing covered files.
Inline assistance: You'll be able to generate new code, but not modify existing code when editing covered files.
Other development environments such as Android Studio may also honor .aiexclude
files.
How to write .aiexclude
files
An .aiexclude
file follows the same syntax as a .gitignore
file, with the following differences:
An empty .aiexclude file blocks all files in its directory and all sub-directories. This is the same as a file that contains
**/*
..aiexclude
files don't support negation (prefixing patterns with!
).
Examples
Here are example .aiexclude
file configurations:
Block all files named apikeys.txt
at or below the directory that contains the .aiexclude
file:
apikeys.txt
Block all files with the .key
file extension at or below the directory that contains the .aiexclude
file:
*.key
Block only the apikeys.txt
file at the in the same directory as the .aiexclude
, but not any subdirectories:
/apikeys.txt
Block all files in the directory my/sensitive/dir
and all subdirectories. The path should be relative to the directory that contains the .aiexclude
file:
my/sensitive/dir/
Wrapping Up
Gemini in Project IDX represents a significant advancement in AI-assisted development. By integrating its inline code suggestions, command access, and smart completion features into your workflow, you can dramatically reduce development time while maintaining control over which parts of your codebase the AI can access.
As you explore these capabilities, remember that Gemini is still in preview — always review its suggestions carefully and adapt them to your specific project needs. The power of combining your expertise with AI assistance creates a development experience that's both efficient and flexible.
Try implementing these features in your next Project IDX
session and see how they transform your coding process!
Until next time,
lassiecoder
PS: If you found this article helpful, don't forget to share it with your dev friends and hit that subscribe button!
If you found my work helpful, please consider supporting it through sponsorship.
Subscribe to my newsletter
Read articles from Priyanka Sharma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Priyanka Sharma
Priyanka Sharma
My name is Priyanka Sharma, commonly referred to as lassiecoder within the tech community. With ~5 years of experience as a Software Developer, I specialize in mobile app development and web solutions. My technical expertise includes: – JavaScript, TypeScript, and React ecosystems (React Native, React.js, Next.js) – Backend technologies: Node.js, MongoDB – Cloud and deployment: AWS, Firebase, Fastlane – State management and data fetching: Redux, Rematch, React Query – Real-time communication: Websocket – UI development and testing: Storybook Currently, I'm contributing my skills to The Adecco Group, a leading Swiss company known for innovative solutions.