palantir-java-format icon indicating copy to clipboard operation
palantir-java-format copied to clipboard

Support re-writing multiline docstrings into their multiline form

Open MGHawes opened this issue 6 months ago • 4 comments

I often wish that people would write something like:

    /** Returns true if the argument should be optional when fully parsed. */
    public static boolean optionalWhenFullyParsed(Argument<?, ?> argument) {
        return argument.isOptional() && argument.defaultValue().isEmpty();
    }

rather than:

    /**
     * Returns true if the argument should be optional when fully parsed.
     */
    public static boolean optionalWhenFullyParsed(Argument<?, ?> argument) {
        return argument.isOptional() && argument.defaultValue().isEmpty();
    }

We could compute whether it would fit on one line and rewrite it if it would. This would only apply to the case of multi-line docstrings that contain a single line. i.e. it would not include:

    /**
     * This is
     * a silly 
     * docstring.
     */
    public static boolean example()

MGHawes avatar Jan 03 '24 18:01 MGHawes