public class FormatterUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Collection<java.lang.String> |
FORMATTER_ACTION_NAMES |
static java.lang.String |
REFORMAT_BEFORE_COMMIT_COMMAND_NAME
Deprecated.
Use
getReformatBeforeCommitCommandName() instead |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsWhiteSpacesOnly(ASTNode node) |
static ASTNode |
getNext(ASTNode node,
IElementType... typesToIgnore) |
static ASTNode |
getNextNonWhitespaceLeaf(ASTNode node) |
static ASTNode |
getNextNonWhitespaceSibling(ASTNode node) |
static ASTNode |
getPrevious(ASTNode node,
IElementType... typesToIgnore) |
static ASTNode |
getPreviousLeaf(ASTNode node,
IElementType... typesToIgnore) |
static ASTNode |
getPreviousNonWhitespaceLeaf(ASTNode node) |
static ASTNode |
getPreviousNonWhitespaceSibling(ASTNode node) |
static java.lang.String |
getReformatBeforeCommitCommandName() |
static boolean |
hasPrecedingSiblingOfType(ASTNode node,
IElementType expectedSiblingType,
IElementType... skipTypes) |
static boolean |
isFollowedBy(ASTNode node,
IElementType expectedType) |
static boolean |
isFollowedBy(ASTNode node,
IElementType expectedType,
IElementType... skipTypes) |
static boolean |
isFollowedBy(ASTNode node,
IElementType expectedType,
TokenSet skipTypes) |
static boolean |
isFollowedBy(ASTNode node,
TokenSet expectedTypes,
IElementType... skipTypes) |
static boolean |
isFollowedBy(ASTNode node,
TokenSet expectedTypes,
TokenSet skipTypes) |
static boolean |
isFormatterCalledExplicitly() |
static boolean |
isIncomplete(ASTNode node) |
static boolean |
isOneOf(ASTNode node,
IElementType... types) |
static boolean |
isPrecededBy(ASTNode node,
IElementType expectedType) |
static boolean |
isPrecededBy(ASTNode node,
IElementType expectedType,
IElementType... skipTypes) |
static boolean |
isPrecededBy(ASTNode node,
IElementType expectedType,
TokenSet skipTypes) |
static boolean |
isPrecededBy(ASTNode node,
TokenSet expectedTypes) |
static boolean |
isPrecededBy(ASTNode node,
TokenSet expectedTypes,
IElementType... skipTypes) |
static boolean |
isPrecededBy(ASTNode node,
TokenSet expectedTypes,
TokenSet skipTypes) |
static boolean |
isWhitespaceOrEmpty(ASTNode node) |
static void |
replaceInnerWhiteSpace(java.lang.String newWhiteSpaceText,
ASTNode holder,
TextRange whiteSpaceRange)
There is a possible case that we want to adjust white space which is not represented at the AST/PSI tree, e.g.
|
static void |
replaceLastWhiteSpace(ASTNode astNode,
java.lang.String whiteSpace,
TextRange textRange) |
static void |
replaceWhiteSpace(java.lang.String whiteSpace,
ASTNode leafElement,
IElementType whiteSpaceToken,
TextRange textRange) |
@Deprecated public static final java.lang.String REFORMAT_BEFORE_COMMIT_COMMAND_NAME
getReformatBeforeCommitCommandName()
insteadpublic static final java.util.Collection<java.lang.String> FORMATTER_ACTION_NAMES
public static boolean isWhitespaceOrEmpty(ASTNode node)
public static boolean isOneOf(ASTNode node, IElementType... types)
public static ASTNode getPrevious(ASTNode node, IElementType... typesToIgnore)
public static ASTNode getNext(ASTNode node, IElementType... typesToIgnore)
public static ASTNode getPreviousLeaf(ASTNode node, IElementType... typesToIgnore)
public static boolean isPrecededBy(ASTNode node, IElementType expectedType)
public static boolean isPrecededBy(ASTNode node, IElementType expectedType, TokenSet skipTypes)
public static boolean isPrecededBy(ASTNode node, IElementType expectedType, IElementType... skipTypes)
public static boolean isPrecededBy(ASTNode node, TokenSet expectedTypes, TokenSet skipTypes)
public static boolean isPrecededBy(ASTNode node, TokenSet expectedTypes, IElementType... skipTypes)
public static boolean hasPrecedingSiblingOfType(ASTNode node, IElementType expectedSiblingType, IElementType... skipTypes)
public static boolean isFollowedBy(ASTNode node, IElementType expectedType)
public static boolean isFollowedBy(ASTNode node, IElementType expectedType, TokenSet skipTypes)
public static boolean isFollowedBy(ASTNode node, IElementType expectedType, IElementType... skipTypes)
public static boolean isFollowedBy(ASTNode node, TokenSet expectedTypes, TokenSet skipTypes)
public static boolean isFollowedBy(ASTNode node, TokenSet expectedTypes, IElementType... skipTypes)
public static boolean isIncomplete(ASTNode node)
public static boolean containsWhiteSpacesOnly(ASTNode node)
public static void replaceInnerWhiteSpace(java.lang.String newWhiteSpaceText, ASTNode holder, TextRange whiteSpaceRange)
newWhiteSpaceText
- new text to use at the target inner element rangeholder
- target range holderwhiteSpaceRange
- target range which text should be replaced by the given onepublic static void replaceWhiteSpace(java.lang.String whiteSpace, ASTNode leafElement, IElementType whiteSpaceToken, TextRange textRange)
public static void replaceLastWhiteSpace(ASTNode astNode, java.lang.String whiteSpace, TextRange textRange)
public static boolean isFormatterCalledExplicitly()
true
explicitly called 'reformat' is in progress at the moment; false
otherwisepublic static java.lang.String getReformatBeforeCommitCommandName()