Skip to content

fix(editor): ensure preferred editor setting updates immediately#12981

Merged
abhipatel12 merged 1 commit into
mainfrom
abhipatel12/fix-editor-choice
Nov 13, 2025
Merged

fix(editor): ensure preferred editor setting updates immediately#12981
abhipatel12 merged 1 commit into
mainfrom
abhipatel12/fix-editor-choice

Conversation

@abhipatel12

@abhipatel12 abhipatel12 commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

Summary

Fixes a bug where changing the preferred editor required a session restart to take effect. This was caused by a mismatch between the setting key used for writing (preferredEditor) and reading (general.preferredEditor).

Details

  • Introduced SettingPaths constant to centralize setting keys and avoid magic strings.
  • Updated useEditorSettings to use SettingPaths.General.PreferredEditor.
  • Updated MIGRATION_MAP in settings.ts to use the same constant, ensuring consistency.
  • This ensures that the setting is written directly to general.preferredEditor, which is where AppContainer reads it from, bypassing the need for a restart-triggered migration.

Related Issues

Fixes the editor preference update delay.

Created #12982 to track a follow-up clean up task

How to Validate

  1. Open the CLI.
  2. Run /editor and select an editor (e.g., vim).
  3. Run a command that triggers an edit (e.g., modify a file). Verify it opens in vim.
  4. Run /editor again and select a different editor (e.g., nano or vscode).
  5. Run a command that triggers an edit.
  6. Expected Result: After choosing modify with edition, the new editor should be used immediately without restarting the CLI.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

Previously, the preferred editor setting was saved to 'preferredEditor' but read from 'general.preferredEditor', requiring a session restart for the migration to run. This change centralizes the setting path to 'general.preferredEditor' to ensure consistency between read and write operations.
@abhipatel12 abhipatel12 requested a review from a team as a code owner November 13, 2025 03:50
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @abhipatel12, 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 resolves a bug where changes to the preferred editor setting in the CLI did not apply until a session restart. The issue stemmed from a mismatch between the setting key used for writing and reading. The fix involves introducing a new SettingPaths constant to centralize setting keys and updating relevant components, including the useEditorSettings hook and the MIGRATION_MAP, to consistently use this new constant. This ensures that the preferred editor setting is correctly applied immediately after being changed, significantly improving the user experience.

Highlights

  • Centralized Setting Keys: A new SettingPaths constant has been introduced to centralize setting keys, replacing hardcoded strings and improving maintainability.
  • Immediate Editor Setting Updates: The useEditorSettings hook now correctly uses the centralized SettingPaths.General.PreferredEditor key, ensuring that changes to the preferred editor setting take effect immediately without requiring a CLI restart.
  • Consistent Setting Migration: The MIGRATION_MAP in settings.ts has been updated to use the new SettingPaths.General.PreferredEditor constant, maintaining consistency across setting management and migration processes.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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

  1. 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively fixes a bug preventing the preferred editor setting from updating immediately. By introducing a SettingPaths constant and using the correct V2 path for writing the setting, you've resolved the issue and improved code maintainability by eliminating a magic string. The changes are solid. I have one suggestion to further enhance consistency by applying this new pattern more broadly.

Comment thread packages/cli/src/config/settings.ts
@github-actions

Copy link
Copy Markdown

Size Change: +200 B (0%)

Total Size: 20.5 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 20.5 MB +200 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@abhipatel12 abhipatel12 added this pull request to the merge queue Nov 13, 2025
Merged via the queue into main with commit 13d8d94 Nov 13, 2025
22 checks passed
@abhipatel12 abhipatel12 deleted the abhipatel12/fix-editor-choice branch November 13, 2025 04:11
thacio added a commit to thacio/auditaria that referenced this pull request Nov 13, 2025
@abhipatel12

Copy link
Copy Markdown
Contributor Author

/patch preview

@github-actions

Copy link
Copy Markdown

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: preview
  • Commit: 13d8d9477cdc560050ba4405a47646ddb56b26f0
  • Workflows Created: 1

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. Review and approve the hotfix PR: #13011
  2. Once merged, the patch release will automatically trigger
  3. You'll receive updates here when the release completes

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch Release Started!

📋 Release Details:

  • Environment: prod
  • Channel: preview → publishing to npm tag preview
  • Version: v0.15.0-preview.4
  • Hotfix PR: Merged ✅
  • Release Branch: release/v0.15.0-preview.4-pr-12981

⏳ Status: The patch release is now running. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

Patch Release Complete!

📦 Release Details:

🎉 Status: Your patch has been successfully released and published to npm!

📝 What's Available:

🔗 Links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s A small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants