From d957675ac81d24aa918847f317b94a89aaede11d Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Wed, 29 Oct 2025 15:15:35 -0700 Subject: [PATCH] there are always StringFragments --- src/compiler/utils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler/utils.ts b/src/compiler/utils.ts index 7fd9cf5..c5fb786 100644 --- a/src/compiler/utils.ts +++ b/src/compiler/utils.ts @@ -236,7 +236,12 @@ export const getStringParts = (node: SyntaxNode, input: string) => { } }) - return { parts, hasInterpolation: parts.length > 0 } + // hasInterpolation means the string has interpolation ($var) or escape sequences (\n) + // A simple string like 'hello' has one StringFragment but no interpolation + const hasInterpolation = parts.some( + (p) => p.type.id === terms.Interpolation || p.type.id === terms.EscapeSeq + ) + return { parts, hasInterpolation } } export const getDotGetParts = (node: SyntaxNode, input: string) => {