From 77bdb1d724cd1646213f7e8d001d396c64b8b94f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 3 Sep 2026 00:56:59 +0000 Subject: [PATCH 1/3] Initial plan From 9aa7234395936c85016b1241eb97c1ea7899582f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 3 Sep 2026 01:00:15 +0000 Subject: [PATCH 2/3] Fix AST JSDoc scan range handling Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- packages/typescript/src/ast/scanner.ts | 2 +- packages/typescript/test/scanner.test.ts | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 packages/typescript/test/scanner.test.ts diff --git a/packages/typescript/src/ast/scanner.ts b/packages/typescript/src/ast/scanner.ts index 8e956bb967f54..df3a7415cec5d 100644 --- a/packages/typescript/src/ast/scanner.ts +++ b/packages/typescript/src/ast/scanner.ts @@ -2434,7 +2434,7 @@ export function createScanner( if (isIdentifierStart(ch)) { let char = ch; - while (pos < end && isIdentifierPart(char = codePointUnchecked(pos)) || char === CharacterCodes.minus) pos += charSize(char); + while (pos < end && (isIdentifierPart(char = codePointUnchecked(pos)) || char === CharacterCodes.minus)) pos += charSize(char); tokenValue = text.substring(tokenStart, pos); if (char === CharacterCodes.backslash) { tokenValue += scanIdentifierParts(); diff --git a/packages/typescript/test/scanner.test.ts b/packages/typescript/test/scanner.test.ts new file mode 100644 index 0000000000000..4d9cbfb70c0a9 --- /dev/null +++ b/packages/typescript/test/scanner.test.ts @@ -0,0 +1,23 @@ +import { + createScanner, + SyntaxKind, +} from "@typescript/typescript/unstable/ast"; +import assert from "node:assert"; +import { test } from "node:test"; + +test("scanJsDocToken respects a range ending in a hyphen", () => { + const text = "/** x-yy"; + const scanner = createScanner(/*skipTrivia*/ true); + scanner.setText(text); + + scanner.scanRange(3, text.length - 5, () => { + const tokens = []; + while (scanner.scanJsDocToken() !== SyntaxKind.EndOfFile) { + tokens.push([scanner.getToken(), scanner.getTokenText()]); + } + assert.deepStrictEqual(tokens, [ + [SyntaxKind.WhitespaceTrivia, " "], + [SyntaxKind.Identifier, "x-"], + ]); + }); +}); From cba9b6bd4ede4a6fd8330bf4c8dc69c7af7d09dc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 3 Sep 2026 01:14:54 +0000 Subject: [PATCH 3/3] Format AST scanner regression test Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- packages/typescript/test/scanner.test.ts | 46 ++++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/typescript/test/scanner.test.ts b/packages/typescript/test/scanner.test.ts index 4d9cbfb70c0a9..0f52a34040628 100644 --- a/packages/typescript/test/scanner.test.ts +++ b/packages/typescript/test/scanner.test.ts @@ -1,23 +1,23 @@ -import { - createScanner, - SyntaxKind, -} from "@typescript/typescript/unstable/ast"; -import assert from "node:assert"; -import { test } from "node:test"; - -test("scanJsDocToken respects a range ending in a hyphen", () => { - const text = "/** x-yy"; - const scanner = createScanner(/*skipTrivia*/ true); - scanner.setText(text); - - scanner.scanRange(3, text.length - 5, () => { - const tokens = []; - while (scanner.scanJsDocToken() !== SyntaxKind.EndOfFile) { - tokens.push([scanner.getToken(), scanner.getTokenText()]); - } - assert.deepStrictEqual(tokens, [ - [SyntaxKind.WhitespaceTrivia, " "], - [SyntaxKind.Identifier, "x-"], - ]); - }); -}); +import { + createScanner, + SyntaxKind, +} from "@typescript/typescript/unstable/ast"; +import assert from "node:assert"; +import { test } from "node:test"; + +test("scanJsDocToken respects a range ending in a hyphen", () => { + const text = "/** x-yy"; + const scanner = createScanner(/*skipTrivia*/ true); + scanner.setText(text); + + scanner.scanRange(3, text.length - 5, () => { + const tokens = []; + while (scanner.scanJsDocToken() !== SyntaxKind.EndOfFile) { + tokens.push([scanner.getToken(), scanner.getTokenText()]); + } + assert.deepStrictEqual(tokens, [ + [SyntaxKind.WhitespaceTrivia, " "], + [SyntaxKind.Identifier, "x-"], + ]); + }); +});