there are always StringFragments

This commit is contained in:
Chris Wanstrath 2025-10-29 15:15:35 -07:00
parent 9bc514a782
commit d957675ac8

View File

@ -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) => { export const getDotGetParts = (node: SyntaxNode, input: string) => {