private boolean hasHardLine(TreeCursor cursor) {
        List<TreeCursor> children = cursor.findChildrenByType(
                TreeType.COMMENT,
                TreeType.TEXT_BLOCK,
                TreeType.NODE_ARRAY,
                TreeType.NODE_OBJECT,
                TreeType.QUOTED_TEXT);
        for (TreeCursor child : children) {
            if (child.getTree().getType() != TreeType.QUOTED_TEXT) {
                return true;
            } else if (child.getTree().getStartLine() != child.getTree().getEndLine()) {
                // Detect strings with line breaks.
                return true;
            }
        }
        return false;
    }
Formats various kinds of brackets, dealing with interspersed whitespace and comments.
smithy-syntax/src/main/java/software/amazon/smithy/syntax/BracketFormatter.java