Java Code Examples for com.intellij.psi.codeStyle.CommonCodeStyleSettings#DO_NOT_WRAP
The following examples show how to use
com.intellij.psi.codeStyle.CommonCodeStyleSettings#DO_NOT_WRAP .
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: WrappingUtil.java From consulo with Apache License 2.0 | 5 votes |
public static WrapType getWrapType(int setting) { switch (setting) { case CommonCodeStyleSettings.WRAP_ALWAYS: return WrapType.ALWAYS; case CommonCodeStyleSettings.WRAP_AS_NEEDED: return WrapType.NORMAL; case CommonCodeStyleSettings.DO_NOT_WRAP: return WrapType.NONE; default: return WrapType.CHOP_DOWN_IF_LONG; } }
Example 2
Source File: HaxeWrappingProcessor.java From intellij-haxe with Apache License 2.0 | 4 votes |
Wrap createChildWrap(ASTNode child, Wrap defaultWrap, Wrap childWrap) { final IElementType childType = child.getElementType(); final IElementType elementType = myNode.getElementType(); if (childType == OCOMMA || childType == OSEMI) return defaultWrap; // // Function definition/call // if (elementType == PARAMETER_LIST || elementType == EXPRESSION_LIST) { final ASTNode parent = myNode.getTreeParent(); if (parent == null) { return defaultWrap; } final IElementType parentType = parent.getElementType(); if (parentType == CALL_EXPRESSION && mySettings.CALL_PARAMETERS_WRAP != CommonCodeStyleSettings.DO_NOT_WRAP) { if (myNode.getFirstChildNode() == child) { return createWrap(mySettings.CALL_PARAMETERS_LPAREN_ON_NEXT_LINE); } if (!mySettings.PREFER_PARAMETERS_WRAP && childWrap != null) { return Wrap.createChildWrap(childWrap, WrappingUtil.getWrapType(mySettings.CALL_PARAMETERS_WRAP), true); } return Wrap.createWrap(WrappingUtil.getWrapType(mySettings.CALL_PARAMETERS_WRAP), true); } if (FUNCTION_DEFINITION.contains(parentType) && mySettings.METHOD_PARAMETERS_WRAP != CommonCodeStyleSettings.DO_NOT_WRAP) { if (myNode.getFirstChildNode() == child) { return createWrap(mySettings.METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE); } if (childType == PRPAREN) { return createWrap(mySettings.METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE); } return Wrap.createWrap(WrappingUtil.getWrapType(mySettings.METHOD_PARAMETERS_WRAP), true); } } if (elementType == CALL_EXPRESSION) { if (mySettings.CALL_PARAMETERS_WRAP != CommonCodeStyleSettings.DO_NOT_WRAP) { if (childType == PRPAREN) { return createWrap(mySettings.CALL_PARAMETERS_RPAREN_ON_NEXT_LINE); } } } // // If // if (elementType == IF_STATEMENT && childType == KELSE) { return createWrap(mySettings.ELSE_ON_NEW_LINE); } // //Binary expressions // if (BINARY_EXPRESSIONS.contains(elementType) && mySettings.BINARY_OPERATION_WRAP != CommonCodeStyleSettings.DO_NOT_WRAP) { if ((mySettings.BINARY_OPERATION_SIGN_ON_NEXT_LINE && BINARY_OPERATORS.contains(childType)) || (!mySettings.BINARY_OPERATION_SIGN_ON_NEXT_LINE && isRightOperand(child))) { return Wrap.createWrap(WrappingUtil.getWrapType(mySettings.BINARY_OPERATION_WRAP), true); } } // // Assignment // if (elementType == ASSIGN_EXPRESSION && mySettings.ASSIGNMENT_WRAP != CommonCodeStyleSettings.DO_NOT_WRAP) { if (childType != ASSIGN_OPERATION) { if (FormatterUtil.isPrecededBy(child, ASSIGN_OPERATION) && mySettings.PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE) { return Wrap.createWrap(WrapType.NONE, true); } return Wrap.createWrap(WrappingUtil.getWrapType(mySettings.ASSIGNMENT_WRAP), true); } else if (mySettings.PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE) { return Wrap.createWrap(WrapType.NORMAL, true); } } // // Ternary expressions // if (elementType == TERNARY_EXPRESSION) { if (myNode.getFirstChildNode() != child) { if (mySettings.TERNARY_OPERATION_SIGNS_ON_NEXT_LINE) { if (!FormatterUtil.isPrecededBy(child, OQUEST) && !FormatterUtil.isPrecededBy(child, OCOLON)) { return Wrap.createWrap(WrappingUtil.getWrapType(mySettings.TERNARY_OPERATION_WRAP), true); } } else if (childType != OQUEST && childType != OCOLON) { return Wrap.createWrap(WrappingUtil.getWrapType(mySettings.TERNARY_OPERATION_WRAP), true); } } return Wrap.createWrap(WrapType.NONE, true); } return defaultWrap; }
Example 3
Source File: WrappingUtil.java From consulo with Apache License 2.0 | 4 votes |
public static boolean shouldWrap(int setting) { return setting != CommonCodeStyleSettings.DO_NOT_WRAP; }