netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

add editor folds or similar to keep hand crafted formatting intact

Open homberghp opened this issue 1 year ago • 0 comments

Description

For readability, you sometimes format code in a nicely aligned way, e.g. columnar for operations on a sequence of array elements.

For instance

        return new Student(
                     java.lang.String.class.cast( components[ 0 ] ),
                     java.lang.String.class.cast( components[ 1 ] ),
                     java.lang.String.class.cast( components[ 2 ] ),
                  java.time.LocalDate.class.cast( components[ 3 ] )
        );

This is hard work, even in this wiki editor I am currently using, for lack of a fixed sized font. Anyhow, if you could keep that formatting intact even with a reformat all over the code, that would be nice.

The start and end tags could look like this: The first to turn reformatting off.

  • //!reformat-
  • //!reformat+

complete example

        //!reformat-
        return new Student(
                   java.lang.String.class.cast( components[ 0 ] ),
                   java.lang.String.class.cast( components[ 1 ] ),
                   java.lang.String.class.cast( components[ 2 ] ),
                java.time.LocalDate.class.cast( components[ 3 ] )
        );
        //!reformat+


Use case/motivation

The readability of code is key.

Related issues

reformatting in general

Are you willing to submit a pull request?

No

homberghp avatar Feb 08 '24 13:02 homberghp