fix: pre-load @file references from external editor prompts#20963
fix: pre-load @file references from external editor prompts#20963scidomino merged 2 commits intogoogle-gemini:mainfrom
Conversation
Signed-off-by: Kartik Angiras <angiraskartik@gmail.com>
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 refactors 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 addresses a bug where @ commands were not correctly detected unless they were at the start of a line or preceded by whitespace. The isAtCommand function is updated to use a shared regular expression from the atCommandProcessor, centralizing the definition of an @ command for improved consistency and maintainability. No specific security vulnerabilities were identified in these changes. The implementation is sound, and the comprehensive tests validate the new, more flexible behavior, effectively resolving the described issue.
|
@kartikangiras I'll go ahead and review this but in the future make sure you are assigned to a help-wanted issue before sending us a PR. |
|
@scidomino someone was already assigned on that issue and was not actively working on it. |
Signed-off-by: Kartik Angiras <angiraskartik@gmail.com>
…emini#20963) Signed-off-by: Kartik Angiras <angiraskartik@gmail.com>
…emini#20963) Signed-off-by: Kartik Angiras <angiraskartik@gmail.com>
…emini#20963) Signed-off-by: Kartik Angiras <angiraskartik@gmail.com>
Summary
The isAtCommand function in commandUtils.ts used an overly restrictive regex. As a result, handleAtCommand was never invoked, the files were not pre-loaded into the prompt, and the LLM had to read them itself using its read_file tool.
Details
Updated isAtCommand to import and reuse AT_COMMAND_PATH_REGEX_SOURCE from [atCommandProcessor.ts] the exact same regex that parseAllAtCommands uses internally. This guarantees that isAtCommand returns true whenever the at-command processor would find a valid @ pattern, regardless of what character precedes @:
Related Issues
fixes #14919
How to Validate
I have updated the tests related to it and they pass succesfully.
Pre-Merge Checklist