From f1c80e047737df81ac31e4d0c6e86ff2f70a7321 Mon Sep 17 00:00:00 2001 From: felixlaga Date: Sat, 7 Nov 2026 17:20:40 +0900 Subject: [PATCH] fix(shared): inline code like `allocator.cc:217` becomes a file chip Inline code naming a bare C++ source with a line number, such as `allocator.cc:217`, stayed plain code. The file-chip check listed `cc` with generic TLDs like `com`, so it read the text as a host and port. The same reference to a `.cpp`, `.h` or `.pl` file became a chip. `cc` now sits with the country TLDs. Like `pl`, it reads as a file when a line number follows and as a host otherwise, so `example.cc/docs` stays code. Co-Authored-By: Claude Opus 5.5 --- packages/shared/src/markdownLinks.test.ts | 1 + packages/shared/src/markdownLinks.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/shared/src/markdownLinks.test.ts b/packages/shared/src/markdownLinks.test.ts index 68aa6950135fd..1ca0b0ea0401b 100644 --- a/packages/shared/src/markdownLinks.test.ts +++ b/packages/shared/src/markdownLinks.test.ts @@ -24,6 +24,7 @@ describe("inlineCodeFilePathCandidate", () => { // regression: #13909 model ids in inline code do not become file chips it.each([ ["src\\main.ts", "src/main.ts"], + ["allocator.cc:217", "allocator.cc:217"], ["origin/main", null], ["z-ai/glm-5.3", null], ["share/man/ls.1", "share/man/ls.1"], diff --git a/packages/shared/src/markdownLinks.ts b/packages/shared/src/markdownLinks.ts index f8b0e8434e9b4..0d4e7556d072b 100644 --- a/packages/shared/src/markdownLinks.ts +++ b/packages/shared/src/markdownLinks.ts @@ -116,7 +116,6 @@ const GENERIC_HOSTNAME_TLDS = new Set([ "xyz", "me", "tv", - "cc", "gg", "chat", "cloud", @@ -159,6 +158,8 @@ const COUNTRY_HOSTNAME_TLDS = new Set([ "tr", "sg", "hk", + // C++ sources end in `.cc`, so `allocator.cc:217` names a file, not a host and port. + "cc", ]); function looksLikeHostname(segment: string, hasPosition: boolean): boolean {