From 24dc52854f3cd5958b2a7505ecdcd8e4fcf6a0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20R=C3=B8ed?= Date: Fri, 28 Aug 2026 09:42:09 +0200 Subject: [PATCH] Match the template block of a semicolon-less TOC in multi-template files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `readGts` picks the template block that lies inside the named declaration's range, computed on the file with templates blanked. For `export const X = ` without a trailing semicolon the blanked initializer leaves the statement ending at `=`, so no block was ever inside the range and the lookup failed silently; the consumer fell back to the TypeScript-side result (typically `transparent`). Accept a block that starts inside the range or follows it across whitespace only. Cowritten by Claude --- lib/resolver/template-source.ts | 7 +++++-- test/glint-fixtures/toc-expression-no-semicolon.gts | 11 +++++++++++ test/resolver/template-source.test.ts | 8 ++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 test/glint-fixtures/toc-expression-no-semicolon.gts diff --git a/lib/resolver/template-source.ts b/lib/resolver/template-source.ts index c2cfcbc..e419892 100644 --- a/lib/resolver/template-source.ts +++ b/lib/resolver/template-source.ts @@ -279,8 +279,11 @@ function readGts( for (const block of templates) { if (!block.range) continue; const start = block.range.startUtf16Codepoint; - const end = block.range.endUtf16Codepoint; - if (start >= resolvedRange.start && end <= resolvedRange.end) { + if (start < resolvedRange.start) continue; + // `const X =