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) => {