@devries-cameron20 / t3code-1 / commits / 729924af29
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): keep pasted decorators as text (#8415)

Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Guillermo Casanova committed Oct 19, 2026 at 15:15 UTC 729924af29f3ed9c03eb8a1d4ffead02f9816a81
2 files changed +30 -3
packages/shared/src/composerInlineTokens.test.ts
+24 -2
@@ -125,8 +125,30 @@ describe("collectComposerInlineTokens", () => {
125 expect(collectComposerInlineTokens("入力 @expo/ui を追加")).toEqual([]);
126 });
127
128 - it("keeps bare non-scoped file paths as mentions", () => {
129 - expect(collectComposerInlineTokens("Inspect @README.md next")).toEqual([
128 + it.each(["@namespace.foo(bar)", "@écrire(option)", "@e\u0301crire(option)"])(
129 + "keeps decorator call %s as plain text",
130 + (reference) => {
131 + expect(collectComposerInlineTokens(`${reference}\nclass Example {}`)).toEqual([]);
132 + },
133 + );
134 +
135 + it.each(['@"foo(bar)"', "[foo(bar)](foo%28bar%29)"])(
136 + "keeps an explicit decorator-shaped file reference as a mention: %s",
137 + (reference) => {
138 + expect(collectComposerInlineTokens(`${reference} `)).toEqual([
139 + {
140 + type: "mention",
141 + value: "foo(bar)",
142 + source: reference,
143 + start: 0,
144 + end: reference.length,
145 + },
146 + ]);
147 + },
148 + );
149 +
150 + it("keeps bare file mentions before whitespace-separated parentheses", () => {
151 + expect(collectComposerInlineTokens("Inspect @README.md (notes)")).toEqual([
152 {
153 type: "mention",
154 value: "README.md",
packages/shared/src/composerInlineTokens.ts
+6 -1
@@ -40,6 +40,7 @@ const URI_SCHEME_REGEX = /^[A-Za-z][A-Za-z0-9+.-]*:/;
40 const WINDOWS_DRIVE_PATH_REGEX = /^[A-Za-z]:[\\/]/;
41 const SCOPED_PACKAGE_REFERENCE_REGEX =
42 /^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;
43 +const DECORATOR_CALL_REFERENCE_REGEX = /^[\p{ID_Start}_$][\p{ID_Continue}.$\u200c\u200d]*\(/u;
44
45 function collectMentionTokens(text: string): ComposerInlineToken[] {
46 const matches: ComposerInlineToken[] = [];
@@ -75,7 +76,11 @@ function collectMentionTokens(text: string): ComposerInlineToken[] {
76 const prefix = match[1] ?? "";
77 const quotedPath = match[2];
78 const path = quotedPath !== undefined ? quotedPath.replace(/\\(.)/g, "$1") : (match[3] ?? "");
78 - if (!path || (quotedPath === undefined && SCOPED_PACKAGE_REFERENCE_REGEX.test(path))) {
79 + if (
80 + !path ||
81 + (quotedPath === undefined &&
82 + (SCOPED_PACKAGE_REFERENCE_REGEX.test(path) || DECORATOR_CALL_REFERENCE_REGEX.test(path)))
83 + ) {
84 continue;
85 }
86 const start = (match.index ?? 0) + prefix.length;