Skip to content

KtStringTemplateExpressionManipulator

The ElementManipulator of KtStringTemplateExpression, which edits the content of a string literal, e.g., when a language fragment injected into the string is edited or a reference contributed to the string is renamed.

The IntelliJ Kotlin plugin registers it as the element manipulator of KtStringTemplateExpression. By default, it edits the content between the quotes. In a single-quoted string, it escapes quotes, backslashes, and control characters in the new content, but keeps interpolated expressions ($name and ${...}) as is. In a raw string, it inserts the new content as is.

Constructors

KtStringTemplateExpressionManipulator

constructor()

Functions

getRangeInElement

open override fun getRangeInElement(element: KtStringTemplateExpression): TextRange

handleContentChange

open fun handleContentChange(@NotNull element: @NotNull KtStringTemplateExpression, newContent: String?): KtStringTemplateExpression?
open override fun handleContentChange(
    element: KtStringTemplateExpression, 
    range: TextRange, 
    newContent: String
): KtStringTemplateExpression?