|
Re: Formatting ML_Comment inside a indentation block ? [message #918250 is a reply to message #917958] |
Thu, 20 September 2012 22:02 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
Afaik, the current formatter is not capable of dealing with that, and it
is difficult (as in "you don't want to do that") to extend.
If you are a bit adventurous you could use the formatter I developed for
cloudsmith / geppetto @ github - it is not a direct replacement as the
rules are expressed using CSS style rules and/or via "semantic methods".
One of the things I spent a lot of time on is its comment formatter.
The geppetto formatter is generic but is not (currently) packaged as a
separate consumable plugin. (It also requires overriding and tweaking
some aspects of the serializer) - hence the "adventurous" warning.
Geppetto itself uses it, so there is a live example.
Your other option is probably to do a second pass of formatting, finding
all comments, extracting them from their "container", and perform
formatting using the context they are found in. (It quickly gets complex
if you want to deal with things like "should comment be moved of
folded", "aligning sequences of SL comments", etc.
Maybe someone else has done something smart that can be reused.
Regards
- henrik
On 2012-20-09 17:44, Cristiano Gaviao wrote:
> Hi,
>
> I'm using the following code to format a document:
>
> c.setLinewrap(0, 1, 2).before(gac.getSL_COMMENTRule());
> c.setLinewrap(0, 1, 2).before(gac.getML_COMMENTRule());
> c.setLinewrap(0, 1, 1).after(gac.getML_COMMENTRule());
>
>
>
> The problem that I'm facing is that only the first line of the multiline
> comment is being formatted when there is a indentation (see in test
> result below).
>
> Could someone point me what can I do to indent all the commented lines?
>
>
> org.junit.ComparisonFailure: expected:<...partment."
> }
>
> /**
> [ * The roles
> ]*/
> role id financia...> but was:<...partment."
> }
>
> /**
> [* The roles
> ]*/
> role id financia...>
> at org.junit.Assert.assertEquals(Assert.java:125)
>
>
>
> thanks,
>
> Cristiano
>
|
|
|
Powered by
FUDForum. Page generated in 0.02737 seconds