public class StringLiteralEscaper<T extends PsiLanguageInjectionHost> extends LiteralTextEscaper<T>
myHost| Constructor and Description |
|---|
StringLiteralEscaper(T host) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
decode(TextRange rangeInsideHost,
java.lang.StringBuilder outChars)
Add decoded and unescaped characters from the host element to
outChars buffer. |
int |
getOffsetInHost(int offsetInDecoded,
TextRange rangeInsideHost)
This method is called only after
LiteralTextEscaper.decode(com.intellij.openapi.util.TextRange, java.lang.StringBuilder), so it's possible to prepare necessary data in LiteralTextEscaper.decode(com.intellij.openapi.util.TextRange, java.lang.StringBuilder) and then use it here. |
boolean |
isOneLine() |
createSimple, getRelevantTextRangepublic StringLiteralEscaper(T host)
public boolean decode(TextRange rangeInsideHost, java.lang.StringBuilder outChars)
LiteralTextEscaperoutChars buffer. If it's impossible to properly decode some chars
from the specified range (e.g. if the range starts or ends inside escaped sequence), decode the longest acceptable prefix of the range and return falsedecode in class LiteralTextEscaper<T extends PsiLanguageInjectionHost>rangeInsideHost - range to be decoded. It's guarantied to be inside LiteralTextEscaper.getRelevantTextRange()outChars - buffer for output chars. Use append methods only, it's forbidden to modify or remove existing characterstrue if whole range was successfully decoded, false otherwisepublic int getOffsetInHost(int offsetInDecoded,
TextRange rangeInsideHost)
LiteralTextEscaperLiteralTextEscaper.decode(com.intellij.openapi.util.TextRange, java.lang.StringBuilder), so it's possible to prepare necessary data in LiteralTextEscaper.decode(com.intellij.openapi.util.TextRange, java.lang.StringBuilder) and then use it here.getOffsetInHost in class LiteralTextEscaper<T extends PsiLanguageInjectionHost>offsetInDecoded - offset in the parsed injected filerangeInsideHost - range where injection is performed,
E.g. if some language fragment xyz was injected into string literal expression "xyz", then rangeInsideHost = (1,4)public boolean isOneLine()
isOneLine in class LiteralTextEscaper<T extends PsiLanguageInjectionHost>true if the host cannot accept multiline content, false otherwise