feat(settings): Add support for settings enum options#7719
feat(settings): Add support for settings enum options#7719richieforeman merged 10 commits intomainfrom
enum options#7719Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @richieforeman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a new capability to define settings with enumerated options, providing a more structured way to manage configuration choices. Alongside this feature, the underlying settings schema access has been refactored to improve modularity and testability, ensuring a more robust and maintainable system.
Highlights
- Enum-based Settings Support: Added comprehensive support for
enumoptions within the settings system, allowing for predefined choices rather than free-form input. This includes new types (SettingsType,SettingsValue), aTOGGLE_TYPESconstant, and anenumValuesproperty inSettingDefinition. - Settings Schema Refactoring: The
SETTINGS_SCHEMAconstant has been refactored into agetSettingsSchema()function. This change improves testability by making the schema easier to mock and manage, and the flattened schema is now memoized for performance. - Enhanced Type Strictness: Significant updates to type annotations across settings-related files (
settingsSchema.ts,settingsUtils.ts, and their respective tests) to enforce stricter type checking and improve code reliability. - Improved Settings Dialog and Utility Tests: The
SettingsDialogUI tests have been enhanced with clearer keypress definitions (TerminalKeysenum) andact()wrappers. New unit tests specifically cover the behavior of enum setting toggling and display, along with updates to reflect the schema refactoring.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces support for enum type settings, which is a great addition. The refactoring of SETTINGS_SCHEMA to be behind a getSettingsSchema() function is a good move for testability. The updates to tests to be more assertive are also valuable. I found one critical issue in the SettingsDialog component where updating enum settings would not work correctly due to incorrect type casting and redundant logic. The fix is included in the review comments.
|
There's also an enum PR in here: Can you compare it to yours? |
|
Hi @cornmander, Thank you for pointing out the other PR. As an AI, I don't have the ability to browse external links or compare pull requests directly. Therefore, I can't provide a direct comparison to the PR you linked. However, I can explain the approach taken in this pull request regarding
I hope this clarifies the scope and implementation of |
|
Hi @richieforeman, I understand your frustration. My previous comment was solely to explain my technical limitations as an AI and not a reflection on the value or necessity of your work. The changes you've introduced, especially the refactoring of |
I've updated my PR in a way that should make an eventual merger much cleaner. I updated my data model to be closer to what they're hoping to land. |
|
That's excellent to hear, @richieforeman! It's great that you've proactively aligned the data model to facilitate a cleaner merger. This kind of forward-thinking adjustment significantly contributes to the overall health and maintainability of the codebase. Thank you for your continued efforts on this pull request! |
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
|
Size Change: +715 B (+0.01%) Total Size: 12.5 MB ℹ️ View Unchanged
|
…port - Remove duplicate SettingOption interface - Use official SettingEnumOption interface from PR google-gemini#7719 - Update EnumSelector to support string | number values - Fix TypeScript type issues in TOGGLE_TYPES
TLDR
Adds support for
enum-based settings options.Dive Deeper
SETTINGS_SCHEMAbeing an exported variable, which made mockingSETTINGS_SCHEMAvery difficult. I updated that to use a functiongetSettingsSchema()so that it could be mocked.Reviewer Test Plan
Testing Matrix
Linked issues / bugs
Related to https://github.com/google-gemini/maintainers-gemini-cli/issues/723 (but does not resolve the issue completely.