程序包 com.intellij.psi
类 LiteralTextEscaper<T extends PsiLanguageInjectionHost>
java.lang.Object
com.intellij.psi.LiteralTextEscaper<T>
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static <T extends PsiLanguageInjectionHost>
@NotNull LiteralTextEscaper<T>createSimple(T element) abstract booleandecode(@NotNull TextRange rangeInsideHost, @NotNull StringBuilder outChars) Add decoded and unescaped characters from the host element tooutCharsbuffer.abstract intgetOffsetInHost(int offsetInDecoded, @NotNull TextRange rangeInsideHost) This method is called only afterdecode(com.intellij.openapi.util.TextRange, java.lang.StringBuilder), so it's possible to prepare necessary data indecode(com.intellij.openapi.util.TextRange, java.lang.StringBuilder)and then use it here.@NotNull TextRangeabstract boolean
-
字段详细资料
-
myHost
-
-
构造器详细资料
-
LiteralTextEscaper
-
-
方法详细资料
-
decode
public abstract boolean decode(@NotNull @NotNull TextRange rangeInsideHost, @NotNull @NotNull StringBuilder outChars) Add decoded and unescaped characters from the host element tooutCharsbuffer. 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 returnfalse- 参数:
rangeInsideHost- range to be decoded. It's guarantied to be insidegetRelevantTextRange()outChars- buffer for output chars. Useappendmethods only, it's forbidden to modify or remove existing characters- 返回:
trueif whole range was successfully decoded,falseotherwise
-
getOffsetInHost
public abstract int getOffsetInHost(int offsetInDecoded, @NotNull @NotNull TextRange rangeInsideHost) This method is called only afterdecode(com.intellij.openapi.util.TextRange, java.lang.StringBuilder), so it's possible to prepare necessary data indecode(com.intellij.openapi.util.TextRange, java.lang.StringBuilder)and then use it here.- 参数:
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)- 返回:
- offset in the host PSI element, or -1 if offset is out of host range.
E.g. if some language fragment xyz was injected into string literal expression "xyz", then
getOffsetInHost(0)==1 (there is an 'x' at offset 0 in the injected fragment,
and that 'x' occurs in "xyz" string literal at offset 1
since string literal expression "xyz" starts with double quote)
getOffsetInHost(1)==2
getOffsetInHost(2)==3
getOffsetInHost(3)==-1 (out of range)
Similarly, for some language fragment xyz being injected into xml text inside xml tag 'tag':
xyz getOffsetInHost(0)==0 (there is an 'x' at offset 0 in injected fragment, and that 'x' occurs in xyz xml text at offset 0) getOffsetInHost(1)==1 getOffsetInHost(2)==2 getOffsetInHost(3)==-1 (out of range)
-
getRelevantTextRange
- 返回:
- range inside the host where injection can be performed; usually it's range of text without boundary quotes
-
isOneLine
public abstract boolean isOneLine()- 返回:
trueif the host cannot accept multiline content,falseotherwise
-
createSimple
@NotNull public static <T extends PsiLanguageInjectionHost> @NotNull LiteralTextEscaper<T> createSimple(@NotNull T element)
-