OK, I'll commit those suggestions (against 
http://issues.jalview.org/browse/JAL-1551) to develop.

I found that if the first annotation parameter is a list (in braces), then the 
'array initializer' format takes precedence and parameters are all on one line.

Multiple annotation parameters are put on new lines correctly as long as the 
first one is single-valued.

mungo

Mungo Carstairs
Jalview Computational Scientist
The Barton Group
Division of Computational Biology
College of Life Sciences
University of Dundee, Dundee, Scotland, UK.
www.jalview.org<http://www.jalview.org>
www.compbio.dundee.ac.uk<http://www.compbio.dundee.ac.uk>

________________________________________
From: [email protected] <[email protected]> on 
behalf of Jim Procter <[email protected]>
Sent: 10 August 2015 13:22
To: [email protected]
Subject: Re: [Jalview-dev] Source code formatting and TestNG annnotations

Hi.

On 10/08/2015 12:46, Mungo Carstairs (Staff) wrote:
>
> It looks like our current code formatting settings will split
> annotations thus:
>
>
> @Test(groups = { "Functional" })
>
>
> reformats to
>
>
> @Test(groups =
>
>   { "Functional"})
>
... but they are both valid, I see.
> It seems Eclipse is not smart enough to realise this is not an array
> declaration.
>
> If I change this formatter preference (from 'Next line'):
>
>
>
>
> then the line is not split.
>
> The option is saved in .settings/org.eclipse.jdt.core.prefs as
>
>
> org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
>
>
> Shall we make this change to formatting?
>
How about 'Next line on wrap' - and tick the 'keep empty array
initializer' option. It's a nice compromise that fits with our current
formatting style.

There's also a specific setting for annotation parameter elements which
we probably ought to set.
1. Line Wrapping, select Annotations->element-value pairs
2. Set it to Wrap all elements, every element on a new line, and the
indent policy to 'indent by one'.

We're going to be using annotation parameters an awful lot more with
OSGi so it'd be good to finalise this now.

Jim
_______________________________________________
Jalview-dev mailing list
[email protected]
http://www.compbio.dundee.ac.uk/mailman/listinfo/jalview-dev

The University of Dundee is a registered Scottish Charity, No: SC015096
_______________________________________________
Jalview-dev mailing list
[email protected]
http://www.compbio.dundee.ac.uk/mailman/listinfo/jalview-dev

Reply via email to