Source formatting - and how to suppress it

(re: JAL-1551 source code formatting and editing)

​​

Automatic code formatting is usually a good thing, but sometimes you don’t want it.

For example, for test data strings neatly laid out, one alignment per line.

Or lists of items you want on separate lines (e.g. StockholmFile line 450).

For javadoc comments (only), you can provide your own html formatting tags (e.g.

  • etc), or turn off formatting with the
     tag.

    More generally, you can temporarily turn off code formatting in Eclipse with

    // @formatter:off

    …your lines here…

    // @formatter:on

    The annotation is configured in the Eclipse | Preferences | Java | Codestyle | Formatter | Edit | Off/On Tags tab.

    pastedImage.png

    The setting is stored along with other code formatting options in file

    .settings/org.eclipse.jdt.core.prefs

    At the moment this file is just on branch features/JAL-1264… awaiting merge into Release_2_2.

    Mungo

    The University of Dundee is a registered Scottish Charity, No: SC015096

Hi Mungo… I see your clearly in ‘holiday mode’ !

I’m not sure where I stand on disabling formatting (you know I loath editor dependency, even if I am dependent on eclipse myself). Although it irks me (somewhat), html tags in javadoc are preferable if formatting needs to be different to the standard. As a general rule, I think we should avoid eclipse switches if possible, and for chunks of copy and pasted preformatted documentation like the one you highlight in Stockholm, try to them put somewhere in the docs directory and referenced.

j.

image001.png

···

From: jalview-dev-bounces@jalview.org [mailto:jalview-dev-bounces@jalview.org] On Behalf Of Mungo Carstairs
Sent: 13 October 2014 09:01
To: Jalview Development List
Subject: [Jalview-dev] Source formatting - and how to suppress it

(re: JAL-1551 source code formatting and editing)

​​

Automatic code formatting is usually a good thing, but sometimes you don’t want it.

For example, for test data strings neatly laid out, one alignment per line.

Or lists of items you want on separate lines (e.g. StockholmFile line 450).

For javadoc comments (only), you can provide your own html formatting tags (e.g.

  • etc), or turn off formatting with the
     tag.

    More generally, you can temporarily turn off code formatting in Eclipse with

    // @formatter:off

    …your lines here…

    // @formatter:on

    The annotation is configured in the Eclipse | Preferences | Java | Codestyle | Formatter | Edit | Off/On Tags tab.

    The setting is stored along with other code formatting options in file

    .settings/org.eclipse.jdt.core.prefs

    At the moment this file is just on branch features/JAL-1264… awaiting merge into Release_2_2.

    Mungo

    The University of Dundee is a registered Scottish Charity, No: SC015096