Skip to content

Commit acc1c8e

Browse files
fix(mobile): inline code with a line range becomes a file link
Mobile prefilters inline code with its own regex before the shared parser runs, so `src/http.ts:42-64` stayed plain code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 7aaa9eb commit acc1c8e

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎apps/mobile/src/lib/enrichedLinkPresentation.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ describe("Enriched link presentation", () => {
2020
"/tmp/report.md",
2121
"C:\\repo\\app.tsx",
2222
"app.tsx:12:3",
23+
"src/http.ts:42-64",
24+
"http.ts:42-64",
2325
]) {
2426
expect(ENRICHED_INLINE_FILE_LINK_REGEX.test(path), path).toBe(true);
2527
}
2628
for (const text of [
2729
"npm run dev",
2830
"port:3000",
31+
"port:3000-3010",
2932
"TODO:12",
3033
"example.com",
3134
"https://example.com/app.tsx",

‎apps/mobile/src/lib/enrichedLinkPresentation.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export function enrichedLinkVariantPattern(url: string) {
9292
}
9393

9494
export const ENRICHED_INLINE_FILE_LINK_REGEX =
95-
/^(?!\S*:\/\/)(?:(?:\.{1,2}[\\/]|~[\\/]|\/(?:Users|home|tmp|var|etc|opt|mnt|Volumes|private|root|usr|bin|sbin|lib|lib64|srv|dev|proc|sys|run|boot|media|workspace|workspaces)\/|[A-Za-z]:[\\/])[^\s`]+|(?:[A-Za-z0-9._-]+[\\/])+[A-Za-z0-9._-]+\.[A-Za-z0-9_-]+(?::\d+){0,2}|[A-Za-z0-9._-]+\.[A-Za-z0-9_-]+:\d+(?::\d+)?)$/;
95+
/^(?!\S*:\/\/)(?:(?:\.{1,2}[\\/]|~[\\/]|\/(?:Users|home|tmp|var|etc|opt|mnt|Volumes|private|root|usr|bin|sbin|lib|lib64|srv|dev|proc|sys|run|boot|media|workspace|workspaces)\/|[A-Za-z]:[\\/])[^\s`]+|(?:[A-Za-z0-9._-]+[\\/])+[A-Za-z0-9._-]+\.[A-Za-z0-9_-]+(?::\d+(?::\d+|-\d+)?)?|[A-Za-z0-9._-]+\.[A-Za-z0-9_-]+:\d+(?::\d+|-\d+)?)$/;
9696

9797
export function enrichedSkillLinkRegex(skills?: ReadonlyArray<SelectableMarkdownSkill>) {
9898
const names = [...new Set(skills?.map((skill) => skill.name) ?? [])].filter(Boolean);

0 commit comments

Comments
 (0)