public static Spacing getSpacing()

in src/java/org/jetbrains/plugins/clojure/formatter/processors/ClojureSpacingProcessor.java [30:66]


  public static Spacing getSpacing(Block child1, Block child2) {
    if (!(child1 instanceof ClojureBlock) || !(child2 instanceof ClojureBlock)) return null;
    ClojureBlock block1 = (ClojureBlock) child1;
    ClojureBlock block2 = (ClojureBlock) child2;

    ASTNode node1 = block1.getNode();
    ASTNode node2 = block2.getNode();

    IElementType type1 = node1.getElementType();
    IElementType type2 = node2.getElementType();

    final Spacing psiBased = psiBasedSpacing(node1.getPsi(), node2.getPsi());
    if (psiBased != null) {
      return psiBased;
    }

    if (MODIFIERS.contains(type1)) {
      return NO_SPACING;
    }

    if (ClojureTokenTypes.ATOMS.contains(type2)) {
      return NO_SPACING;
    }

    String text1 = node1.getText();
    String text2 = node2.getText();

    if (text1.trim().startsWith(",") || text2.trim().startsWith(",")) {
      return null;
    }

    if (BRACES.contains(type1) || BRACES.contains(type2)) {
      return NO_SPACING_WITH_NEWLINE;
    }

    return COMMON_SPACING;
  }