This project leverages Google's Gemini Code Assist. Learn more about writing code with Gemini from the official documentation.
A Flutter project demonstrating how to add custom context or rules to Google's Gemini Code Assist to tailor its code generation and assistance within your development workflow.
To use this project effectively or apply these concepts, you first need to install Gemini Code Assist in your IDE.
- Open your IDE: This will likely be Visual Studio Code (VS Code) or Android Studio/IntelliJ IDEA.
- Navigate to Extensions/Plugins:
- VS Code: Click the Extensions icon in the Activity Bar (usually on the left, looks like square blocks) or press
Ctrl+Shift+X
(Cmd+Shift+X
on macOS). - Android Studio/IntelliJ: Go to
File
>Settings
(orAndroid Studio
>Preferences
on macOS), then selectPlugins
. Make sure you're on theMarketplace
tab.
- VS Code: Click the Extensions icon in the Activity Bar (usually on the left, looks like square blocks) or press
- Search for Gemini: Type
Gemini Code Assist
orGoogle Gemini
in the search bar. - Install: Find the official extension/plugin by Google and click "Install".
- Reload/Restart (if needed): Your IDE might prompt you to reload or restart.
- Sign In: After installation, follow the prompts to sign in with your Google account to activate Gemini Code Assist.
Once installed and activated, Gemini is ready to help!
You can guide Gemini's behavior by providing persistent instructions or "rules" that it will consider for every request you make. This helps ensure consistency and adherence to your project's specific standards or your personal preferences.
Here's how to add custom rules (steps shown for VS Code, may vary slightly in other IDEs):
-
Open the Command Palette: Press
Ctrl+Shift+P
(Windows/Linux) orCmd+Shift+P
(macOS). -
Access Settings: In the Command Palette, type
Preferences: Open Settings (UI)
and select it from the list. -
Find the Rules Setting: In the Settings UI search bar, enter
Gemini Code Assist: Rules
(or similar, depending on the exact extension naming). -
Add Your Rule(s): In the text input field provided for the rules, enter your instructions. You can add multiple rules, often one per line.
Example Rule:
Always generate unit tests when creating a new function.
After adding rules in the Rules settings, Gemini Code Assist considers the rule for every prompt or request you make.
To remove the rule, delete the content from the Gemini Code Assist: Rules.
For detailed coding and project guidelines, please refer to the Gemini Code Assist Rules.