public class CommentLiteralEscaper extends LiteralTextEscaper<PsiCommentImpl>
myHost
Constructor and Description |
---|
CommentLiteralEscaper(PsiCommentImpl 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, getRelevantTextRange
public CommentLiteralEscaper(PsiCommentImpl host)
public boolean decode(TextRange rangeInsideHost, java.lang.StringBuilder outChars)
LiteralTextEscaper
outChars
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 false
decode
in class LiteralTextEscaper<PsiCommentImpl>
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)
LiteralTextEscaper
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.getOffsetInHost
in class LiteralTextEscaper<PsiCommentImpl>
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<PsiCommentImpl>
true
if the host cannot accept multiline content, false
otherwise