-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: resolve focus and performance issues with file mentions in first message (#4127) #6180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
MuriloFP
wants to merge
30
commits into
RooCodeInc:main
from
MuriloFP:fix/issue-4127-file-mentions-synthetic-messages
Closed
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
efaaed9
feat: add Issue Fixer Orchestrator mode
MuriloFP 57d3fbe
Merge branch 'RooCodeInc:main' into main
MuriloFP ef61905
Merge branch 'RooCodeInc:main' into main
MuriloFP f5a51c4
Merge branch 'RooCodeInc:main' into main
MuriloFP bcbf329
Merge branch 'RooCodeInc:main' into main
MuriloFP 80413c0
Merge branch 'RooCodeInc:main' into main
MuriloFP ab10140
Merge branch 'RooCodeInc:main' into main
MuriloFP 39c5cf7
Merge branch 'RooCodeInc:main' into main
MuriloFP 00a0b63
Merge branch 'RooCodeInc:main' into main
MuriloFP 080b61b
Merge branch 'RooCodeInc:main' into main
MuriloFP 7a5ad14
Merge branch 'RooCodeInc:main' into main
MuriloFP 2c73ff2
Merge branch 'RooCodeInc:main' into main
MuriloFP 05ccf57
Merge branch 'RooCodeInc:main' into main
MuriloFP fdb1f35
Merge branch 'RooCodeInc:main' into main
MuriloFP 10ce509
Merge branch 'RooCodeInc:main' into main
MuriloFP ab1f9fc
Merge branch 'RooCodeInc:main' into main
MuriloFP 74fd8b4
Merge branch 'RooCodeInc:main' into main
MuriloFP 6745c8f
Merge branch 'RooCodeInc:main' into main
MuriloFP faf2ee5
Merge branch 'RooCodeInc:main' into main
MuriloFP b2dadf9
Merge branch 'RooCodeInc:main' into main
MuriloFP f648e4c
Merge branch 'RooCodeInc:main' into main
MuriloFP a6d1e60
Merge branch 'RooCodeInc:main' into main
MuriloFP be90907
Merge branch 'RooCodeInc:main' into main
MuriloFP ed3a077
Merge branch 'RooCodeInc:main' into main
MuriloFP 856313f
Merge branch 'RooCodeInc:main' into main
MuriloFP 22d5789
fix: resolve focus and performance issues with file mentions in first…
MuriloFP 2eab16d
fix: update test mocks to fix CI failures
MuriloFP 688c493
fix: address PR feedback and fix failing tests
MuriloFP c59edca
refactor: extract synthetic message functionality to separate module
MuriloFP 31a788e
fix: use multi-file read_file tool for synthetic messages
MuriloFP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| import { describe, it, expect } from "vitest" | ||
| import { extractFileMentions, hasFileMentions } from "../extractFileMentions" | ||
|
|
||
| describe("extractFileMentions", () => { | ||
| it("should extract single file mention", () => { | ||
| const text = "Please analyze @/src/main.ts and provide feedback" | ||
| const mentions = extractFileMentions(text) | ||
|
|
||
| expect(mentions).toHaveLength(1) | ||
| expect(mentions[0]).toEqual({ | ||
| mention: "@/src/main.ts", | ||
| path: "src/main.ts", | ||
| }) | ||
| }) | ||
|
|
||
| it("should extract multiple file mentions", () => { | ||
| const text = "Compare @/src/index.ts with @/src/utils.ts and @/tests/main.spec.ts" | ||
| const mentions = extractFileMentions(text) | ||
|
|
||
| expect(mentions).toHaveLength(3) | ||
| expect(mentions[0].path).toBe("src/index.ts") | ||
| expect(mentions[1].path).toBe("src/utils.ts") | ||
| expect(mentions[2].path).toBe("tests/main.spec.ts") | ||
| }) | ||
|
|
||
| it("should not extract folder mentions", () => { | ||
| const text = "Check the @/src/ folder and @/src/file.ts" | ||
| const mentions = extractFileMentions(text) | ||
|
|
||
| expect(mentions).toHaveLength(1) | ||
| expect(mentions[0].path).toBe("src/file.ts") | ||
| }) | ||
|
|
||
| it("should not extract non-file mentions", () => { | ||
| const text = "Check @problems and @terminal output" | ||
| const mentions = extractFileMentions(text) | ||
|
|
||
| expect(mentions).toHaveLength(0) | ||
| }) | ||
|
|
||
| it("should handle mentions with escaped spaces", () => { | ||
| const text = "Read @/path/to/file\\ with\\ spaces.txt" | ||
| const mentions = extractFileMentions(text) | ||
|
|
||
| expect(mentions).toHaveLength(1) | ||
| expect(mentions[0].path).toBe("path/to/file\\ with\\ spaces.txt") | ||
| }) | ||
|
|
||
| it("should return empty array for text without mentions", () => { | ||
| const text = "This is just regular text without any mentions" | ||
| const mentions = extractFileMentions(text) | ||
|
|
||
| expect(mentions).toHaveLength(0) | ||
| }) | ||
| }) | ||
|
|
||
| describe("hasFileMentions", () => { | ||
| it("should return true when content has file mentions", () => { | ||
| const content = [{ type: "text", text: "Check @/src/main.ts" }] | ||
|
|
||
| expect(hasFileMentions(content)).toBe(true) | ||
| }) | ||
|
|
||
| it("should return false when content has no file mentions", () => { | ||
| const content = [{ type: "text", text: "Just regular text" }] | ||
|
|
||
| expect(hasFileMentions(content)).toBe(false) | ||
| }) | ||
|
|
||
| it("should return false for non-file mentions", () => { | ||
| const content = [{ type: "text", text: "Check @problems and @terminal" }] | ||
|
|
||
| expect(hasFileMentions(content)).toBe(false) | ||
| }) | ||
|
|
||
| it("should check multiple content blocks", () => { | ||
| const content = [ | ||
| { type: "text", text: "First block without mentions" }, | ||
| { type: "text", text: "Second block with @/src/file.ts" }, | ||
| { type: "image", text: undefined }, | ||
| ] | ||
|
|
||
| expect(hasFileMentions(content)).toBe(true) | ||
| }) | ||
|
|
||
| it("should handle content blocks without text", () => { | ||
| const content = [{ type: "image" }, { type: "text", text: undefined }, { type: "text", text: "" }] | ||
|
|
||
| expect(hasFileMentions(content)).toBe(false) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { mentionRegexGlobal } from "../../shared/context-mentions" | ||
|
|
||
| export interface FileMention { | ||
| mention: string | ||
| path: string | ||
| } | ||
|
|
||
| /** | ||
| * Extracts file mentions from text content. | ||
| * Only extracts mentions that start with "/" (file paths). | ||
| * | ||
| * @param text The text to extract mentions from | ||
| * @returns Array of file mentions found in the text | ||
| */ | ||
| export function extractFileMentions(text: string): FileMention[] { | ||
| const mentions: FileMention[] = [] | ||
| const matches = text.matchAll(mentionRegexGlobal) | ||
|
|
||
| for (const match of matches) { | ||
| const mention = match[1] | ||
| if (mention.startsWith("/") && !mention.endsWith("/")) { | ||
| // This is a file mention (not a folder) | ||
| mentions.push({ | ||
| mention: `@${mention}`, | ||
| path: mention.slice(1), // Remove leading slash | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| return mentions | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the given content blocks contain any file mentions | ||
| * | ||
| * @param content The content blocks to check | ||
| * @returns true if any file mentions are found | ||
| */ | ||
| export function hasFileMentions(content: Array<{ type: string; text?: string }>): boolean { | ||
| for (const block of content) { | ||
| if (block.type === "text" && block.text) { | ||
| const mentions = extractFileMentions(block.text) | ||
| if (mentions.length > 0) { | ||
| return true | ||
| } | ||
| } | ||
| } | ||
| return false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.