Override Java code formatter to prevent comments with a specific prefix from indenting?

Answered

Any way to override the Java code formatter based on the content of a comment? For example let's say I want to prevent a comment from getting indented if it looks like this /*!! blah */ .  I've examined the Formatter API, but I don't see a way to override or filter specific elements from indentation or formatting in general.  Any ideas?

Thanks!

0
1 comment
Avatar
Rustam Vishniakov

There is no such API for Java. The only way to prevent something from not being formatted (reindented) is to surround a fragment with `@formatter on/off` tags in line comments.

0

Please sign in to leave a comment.