in src/java/org/jetbrains/plugins/clojure/formatter/processors/ClojureSpacingProcessor.java [68:96]
private static Spacing psiBasedSpacing(PsiElement psi1, PsiElement psi2) {
final IElementType rightElementType = psi2.getNode().getElementType();
// Namespace declaration
if (ClojurePsiCheckers.isNs(psi1)) {
return NS_SPACING;
}
if (ClojurePsiCheckers.isImportingClause(psi2)) {
return MANDATORY_NEWLINE;
}
// todo questionable: should be adjustable
if (psi1 instanceof ClKeyword) {
if (TokenSets.RIGHT_PARENTHESES.contains(rightElementType)) return null;
return NO_NEWLINE;
}
// formatting imports
if (psi1 instanceof ClListLike &&
psi2 instanceof ClListLike &&
psi1.getParent() == psi2.getParent() &&
ClojurePsiCheckers.isImportingClause(psi1.getParent())) {
return MANDATORY_NEWLINE;
}
// todo add more cases
return null;
}