类 JavaLikeLangLineIndentProvider
java.lang.Object
com.intellij.psi.impl.source.codeStyle.lineIndent.JavaLikeLangLineIndentProvider
- 所有已实现的接口:
LineIndentProvider
-
嵌套类概要
嵌套类修饰符和类型类说明classstatic enum -
字段概要
从接口继承的字段 com.intellij.psi.codeStyle.lineIndent.LineIndentProvider
DO_NOT_ADJUST -
构造器概要
构造器构造器说明JavaLikeLangLineIndentProvider(@NotNull CharSequence charSequence, @NotNull ITokenSequence tokenSequence, @NotNull IndentOptions indentOptions) -
方法概要
修饰符和类型方法说明protected booleandropIndentAfterReturnLike(@NotNull SemanticEditorPosition statementBeforeSemicolon) Checking the document context in position for return-like token (i.e.protected intgetBlockStatementStartOffset(@NotNull SemanticEditorPosition position) Returns the start offset of the statement or new-line-'{' that owns the code block inposition.protected intgetDeepBlockStatementStartOffset(@NotNull SemanticEditorPosition position) Returns the start offset of the statement that owns the code block inpositionprotected static IndentgetDefaultIndentFromType(@Nullable Indent.Type type) protected @Nullable IndentCalculatorgetIndent(int offset) protected @Nullable IndentgetIndentInBlock(@NotNull SemanticEditorPosition blockStartPosition) protected Indentprotected Indent.Typeprotected @NotNull LexemeIteratorgetIteratorAtPosition(int offset) @Nullable StringgetLineIndent(int offset) Calculates the indent that should be used for the line at specified offset in the specified document.getPosition(int offset) Returns abstract semantic position ineditorfor indent calculation.protected booleanisColonAfterLabelOrCase(@NotNull SemanticEditorPosition position) protected booleanisInArray(int offset) Checks that the current offset is inside array.protected booleanisIndentProvider(@NotNull SemanticEditorPosition statementStartPosition, boolean ignoreLabels) Checking the document context in position as indent-provider.protected booleanprotected booleanisStartOfStatementWithOptionalBlock(@NotNull SemanticEditorPosition position) Returnstrueif thepositionstarts a statement that can have a code block and the statement is the first in the code line.final booleanisSuitableFor(@Nullable Language language) abstract booleanisSuitableForLanguage(@NotNull Language language) protected abstract SemanticEditorPosition.SyntaxElementmapType(@NotNull IElementType tokenType)
-
构造器详细资料
-
JavaLikeLangLineIndentProvider
public JavaLikeLangLineIndentProvider(@NotNull @NotNull CharSequence charSequence, @NotNull @NotNull ITokenSequence tokenSequence, @NotNull @NotNull IndentOptions indentOptions)
-
-
方法详细资料
-
getLineIndent
从接口复制的说明:LineIndentProviderCalculates the indent that should be used for the line at specified offset in the specified document.- 指定者:
getLineIndent在接口中LineIndentProvider- 参数:
offset- The caret offset in the editor.- 返回:
- The indent string (possibly consisting of tabs and/or white spaces),
nullif LineIndentProvider can't calculate the indent (in this case indent calculation is delegated to formatter if smart indent mode is used) orLineIndentProvider.DO_NOT_ADJUSTconstant to leave the current caret position as is without any further formatter-based adjustment.
-
getIndent
-
isInArray
protected boolean isInArray(int offset) Checks that the current offset is inside array. By default it is assumed to be after opening array bracket but can be overridden for more complicated logic, for example, the following case in Java: []{<caret>}.- 参数:
offset- The current offset in the editor.- 返回:
trueif the position is inside array.
-
dropIndentAfterReturnLike
protected boolean dropIndentAfterReturnLike(@NotNull @NotNull SemanticEditorPosition statementBeforeSemicolon) Checking the document context in position for return-like token (i.e.return,break,continue), after that we need to reduce the indent (for example afterbreak;inswitchstatement).- 参数:
statementBeforeSemicolon- position in the document context- 返回:
- true, if need to reduce the indent
-
isColonAfterLabelOrCase
-
isInsideForLikeConstruction
-
getBlockStatementStartOffset
Returns the start offset of the statement or new-line-'{' that owns the code block inposition.Custom implementation for language can overwrite the default behavior for multi-lines statements like
or check indentation after new-line-'{' vs the brace style.template<class T> class A {};- 参数:
position- the position in the code block
-
getDeepBlockStatementStartOffset
Returns the start offset of the statement that owns the code block inposition- 参数:
position- the position in the code block
-
isStartOfStatementWithOptionalBlock
protected boolean isStartOfStatementWithOptionalBlock(@NotNull @NotNull SemanticEditorPosition position) Returnstrueif thepositionstarts a statement that can have a code block and the statement is the first in the code line. In C-like languages it is one ofif, else, for, while, do, try.- 参数:
position-
-
isIndentProvider
protected boolean isIndentProvider(@NotNull @NotNull SemanticEditorPosition statementStartPosition, boolean ignoreLabels) Checking the document context in position as indent-provider.- 参数:
statementStartPosition- position is the documentignoreLabels-true, if labels cannot be used as indent-providers in the context.- 返回:
true, if statement is indent-provider (by default)
-
getPosition
Returns abstract semantic position ineditorfor indent calculation.- 参数:
offset- the offset in theeditor
-
getIteratorAtPosition
-
mapType
@Nullable protected abstract SemanticEditorPosition.SyntaxElement mapType(@NotNull @NotNull IElementType tokenType) -
getIndentInBlock
@Nullable protected @Nullable Indent getIndentInBlock(@NotNull @NotNull SemanticEditorPosition blockStartPosition) -
getDefaultIndentFromType
@Contract("null -> null") protected static Indent getDefaultIndentFromType(@Nullable @Nullable Indent.Type type) -
isSuitableFor
@Contract("null -> false") public final boolean isSuitableFor(@Nullable @Nullable Language language) - 指定者:
isSuitableFor在接口中LineIndentProvider
-
isSuitableForLanguage
-
getIndentTypeInBrackets
-
getIndentInBrackets
-