fix(vscode): maintain focus in terminal when closing diff editor - #22331
fix(vscode): maintain focus in terminal when closing diff editor#22331gjuggler wants to merge 4 commits into
Conversation
Summary of ChangesHello, 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 addresses a user experience issue in the VS Code extension where the terminal would lose focus after a diff editor was closed. The core change involves a small but critical modification to the Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new VS Code integration testing framework for the vscode-ide-companion package, including a shared vscode-mock utility for unit tests and a dedicated script (run-integration-tests.js) to execute end-to-end tests using @vscode/test-electron. The changes also include a new integration test (focus.test.ts) to verify that terminal focus is maintained after accepting a diff, which is supported by a modification in diff-manager.ts to close diff tabs with preserveFocus=true. Additionally, a new gemini.diff.open command was added to facilitate opening diffs programmatically for testing purposes. A high-severity review comment highlighted that this test-specific command should be conditionally registered to prevent security risks and unnecessary API surface area in production builds.
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383). We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'. This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community! |
Adopts fix from google-gemini#22331 - sets preserveFocus: true in tabGroups.close() to maintain terminal focus after closing diff tabs in VS Code.
Summary
Makes a one-line change to diff-manager to set
preserveFocustotruewhen callingvscode.window.tabGroups.close.See https://code.visualstudio.com/api/references/vscode-api#TabGroups.close for docs.
This PR also adds unit tests and integration tests. I'll leave it up to repo maintainers whether the enforced verification is worth the added complexity.
Other details
Everything aside from the diff-manager change was an attempt to produce robust testing for the fix:
preserveFocusparam is called.Related Issues
Fixes #22193
How to Validate
From the
packages/vscode-ide-companiondirectory, runnpm run test:integration. The system will download vscode files to the.vscode-testdirectory, then it will open a new VS Code window while the test is run.Follow instructions to run the vscode extension locally in dev mode. Ask Gemini to edit a few files. You can now hit "enter" repeatedly to approve edits without clicking every time.
Pre-Merge Checklist
(Since this is a vscode-specific issue and fix, I did not run extensive manual platform validation.)