Java Code Examples for com.intellij.formatting.Indent#getIndent()
The following examples show how to use
com.intellij.formatting.Indent#getIndent() .
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: FusionIndentProcessor.java From intellij-neos with GNU General Public License v3.0 | 6 votes |
/** * @param node An ASTNode * @return The calculated indent for the given node */ public static Indent getIndent(ASTNode node) { IElementType type = node.getElementType(); Indent indent = Indent.getNoneIndent(); ASTNode parent = node.getTreeParent(); if (parent == null) { return indent; } if (TYPES_WHICH_PROVOKE_AN_INDENT.contains(parent.getElementType())) { indent = Indent.getIndent(Indent.Type.NORMAL, false, true); } if (TYPES_WHICH_DO_NOT_NEED_AN_BEGINNING_INDENT.contains(type)) { indent = Indent.getNoneIndent(); } if (TYPES_WHICH_CANNOT_GET_AN_INDENT.contains(type)) { indent = Indent.getAbsoluteNoneIndent(); } return indent; }
Example 2
Source File: GraphQLBlockWrapper.java From js-graphql-intellij-plugin with MIT License | 5 votes |
@Nullable @Override protected Indent getChildIndent() { if(myNode.getPsi() instanceof JSStringTemplateExpression) { // enter in a top-level block inside template indents, e.g. queries etc. return Indent.getNormalIndent(); } if(wrapped != null) { return wrapped.getChildAttributes(0).getChildIndent(); } if(parent == null) { return Indent.getNoneIndent(); } return Indent.getIndent(Indent.Type.NORMAL, false, false); }
Example 3
Source File: JavaLikeLangLineIndentProvider.java From consulo with Apache License 2.0 | 4 votes |
@Contract("null -> null") protected static Indent getDefaultIndentFromType(@Nullable Type type) { return type == null ? null : Indent.getIndent(type, 0, false, false); }