Using Google code formatter in Eclipse with GWT

2k views Asked by At

I would like to use the Google code style guidelines as an Eclipse code formatter. So, I imported this formatter XML definition file.

However, it disrupts GWT comments, which in my code start at the end of the line with /* -{ and continue on to multiple lines. The formatter pushes all these lines to the right margin.

GWT comments pushed to right

I set -{ }- as "on-off tags."

GWT in-comment tags

I also edited the formatter to not format any comments.

No comment-formatting

However, this misformatting still occurs.

How can I use the Google code-style but still keep GWT comments as-is?

1

There are 1 answers

3
Thomas Broyer On

You need to install the GWT Plugin for Eclipse (or the Google Plugin for Eclipse) and open Java source files with the GWT-aware editor. That way, JSNI is no longer seen as a simple comment and is formatted as JavaScript (using the JS formatter settings)