refactor(ide ext): Update port file name + switch to 1-based index for characters + remove truncation text#8216
refactor(ide ext): Update port file name + switch to 1-based index for characters + remove truncation text#8216
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @skeshive, 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 refines the IDE extension's interaction with the command-line interface by standardizing communication file generation and data reporting. The changes aim to enhance the robustness of port discovery and improve consistency in how cursor positions and truncated text are handled, aligning the extension's behavior with recent updates in the CLI.
Highlights
- Port File Naming Convention: The extension now generates a single port discovery file, uniquely identified by combining the parent process ID (ppid) and the port number. This ensures uniqueness when multiple VS Code windows are open under the same parent process.
- Cursor Character Indexing: The cursor character position is now reported using a 1-based index instead of a 0-based index, improving consistency with common text editor conventions.
- Selected Text Truncation: The extension no longer appends the "... [TRUNCATED]" suffix to oversized selected text, as this truncation indicator is now handled by the CLI.
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 refactors the IDE server's port discovery mechanism to use a single file, changes the cursor character reporting to be 1-based, and removes the ... [TRUNCATED] suffix from oversized text selections. The changes look good, but I've identified a potential issue with the uniqueness of the port file name when multiple VS Code windows are open. The implementation uses the parent process ID (ppid), which may not be unique across windows, while the tests use the process ID (pid). I've recommended aligning both the implementation and tests to use pid for more robust behavior.
|
Size Change: -2 B (0%) Total Size: 13.2 MB ℹ️ View Unchanged
|
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. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several useful refactorings to the IDE extension, including a more robust port file naming strategy, a switch to 1-based character indexing for consistency, and the removal of redundant text truncation logic. The implementation is generally solid, but I've identified a critical issue where a notification payload mismatches its schema, which would lead to a runtime error. Additionally, the tests for the new port file naming use process.pid instead of the correct process.ppid, which could lead to incorrect test outcomes. Addressing these points will solidify the stability and correctness of these changes.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several refactorings to the VS Code extension. It updates the port discovery mechanism to use a single file keyed by ppid-port, which simplifies the logic and improves uniqueness. It also changes the cursor character reporting to be 1-based for better consistency and removes the ... [TRUNCATED] suffix from oversized selected text, delegating this responsibility to the CLI. The changes are well-implemented and include corresponding updates to the tests, including new tests for error handling during port file creation. I've found one minor issue regarding a log message that is inconsistent with its test case.
TLDR
... [TRUNCATED]suffix on oversized selected text has been removed to since the CLI adds this now.ide/diffClosednotification has been renamed toide/diffRejectedto more accurately reflect the user's action of rejecting a proposed change.Notes: The CLI has already been updated to handle the new port file. Once #8107 is live in the stable release, this PR will be safe to release
Linked issues / bugs
Fixes #4800, #6848