Java Code Examples for com.intellij.lang.ASTNode#getCopyableUserData()

The following examples show how to use com.intellij.lang.ASTNode#getCopyableUserData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeEditUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void checkForOuters(ASTNode element) {
  if (element instanceof OuterLanguageElement && element.getCopyableUserData(OUTER_OK) == null) {
    throw new IllegalArgumentException("Outer element " + element + " is not allowed here");
  }

  ASTNode child = element.getFirstChildNode();
  while (child != null) {
    checkForOuters(child);
    child = child.getTreeNext();
  }
}
 
Example 2
Source File: CodeEditUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Allows to answer if given node is configured to be reformatted.
 *
 * @param node node to check
 * @return {@code true} if given node is configured to be reformatted; {@code false} otherwise
 */
public static boolean isMarkedToReformat(final ASTNode node) {
  if (node.getCopyableUserData(REFORMAT_KEY) == null || !isSuspendedNodesReformattingAllowed()) {
    return false;
  }
  final NotNullFunction<ASTNode, Boolean> strategy = NODE_REFORMAT_STRATEGY.get();
  return strategy == null || strategy.fun(node);
}
 
Example 3
Source File: CodeEditUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static int getOldIndentation(ASTNode node) {
  if (node == null) return -1;
  final Integer stored = node.getCopyableUserData(INDENT_INFO);
  return stored != null ? stored : -1;
}
 
Example 4
Source File: CodeEditUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static boolean isNodeGenerated(final ASTNode node) {
  return node == null || node.getCopyableUserData(GENERATED_FLAG) != null;
}