mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
fix: keep framework route terminal links whole (#4036)
This commit is contained in:
@@ -119,6 +119,19 @@ describe('terminal path helpers', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('detects framework route paths with bracket and paren segments', () => {
|
||||
const links = extractTerminalFileLinks(
|
||||
'Error in app/(shop)/products/[productId]/page.tsx:42:7'
|
||||
)
|
||||
expect(links).toHaveLength(1)
|
||||
expect(links[0]).toMatchObject({
|
||||
pathText: 'app/(shop)/products/[productId]/page.tsx',
|
||||
line: 42,
|
||||
column: 7,
|
||||
displayText: 'app/(shop)/products/[productId]/page.tsx:42:7'
|
||||
})
|
||||
})
|
||||
|
||||
it('handles large spaced path lists without quadratic overlap scans', () => {
|
||||
const line = Array.from({ length: 20_000 }, () => '/tmp/Foo Bar/file').join(', ')
|
||||
|
||||
|
||||
@@ -25,8 +25,10 @@ export type ResolvedTerminalFileLink = Pick<ParsedTerminalFileLink, 'line' | 'co
|
||||
|
||||
// Matches a path with at least one `/` separator, optionally followed by
|
||||
// `:line` and `:col` suffixes (e.g. `src/foo.ts:12:3`, `./bin`, `/abs/path`).
|
||||
// Why: framework route files commonly use punctuation segments like
|
||||
// `app/(shop)/products/[id]/page.tsx`; keep those links whole.
|
||||
const LOCAL_PATH_REGEX =
|
||||
/(?:~[\\/]|[\\/]|\.{1,2}[\\/]|[A-Za-z]:[\\/]|[A-Za-z0-9._-]+[\\/])[A-Za-z0-9._~\-/%+@\\]*(?::\d+)?(?::\d+)?/g
|
||||
/(?:~[\\/]|[\\/]|\.{1,2}[\\/]|[A-Za-z]:[\\/]|[A-Za-z0-9._-]+[\\/])[A-Za-z0-9._~\-/%+@\\()[\]]*(?::\d+)?(?::\d+)?/g
|
||||
|
||||
// Matches separator paths whose file or folder names include spaces. This runs
|
||||
// before LOCAL_PATH_REGEX so `/Users/A/Foo Bar/file.ts` is claimed as one link
|
||||
|
||||
Reference in New Issue
Block a user