Bug 332936 - Java @formatter:off does not work
Summary: Java @formatter:off does not work
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-20 06:54 EST by Juris Sudmalis CLA
Modified: 2011-01-25 03:24 EST (History)
2 users (show)

See Also:


Attachments
Java Code Style preferences (47.09 KB, text/plain)
2010-12-20 10:03 EST, Juris Sudmalis CLA
no flags Details
formatter (29.16 KB, text/xml)
2010-12-20 12:16 EST, Juris Sudmalis CLA
no flags Details
before formatting, SR1 (98.22 KB, image/jpeg)
2010-12-20 14:33 EST, Juris Sudmalis CLA
no flags Details
after formatting, SR1 (115.07 KB, image/jpeg)
2010-12-20 14:34 EST, Juris Sudmalis CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Juris Sudmalis CLA 2010-12-20 06:54:14 EST
Build Identifier: M20100909-0800

@formatter:off tag does not work, even though it's enabled.

Formatting the class results in the array being formated to 1 line (as set in my formatter profile).
Setting this tag to off in the beginning of the class also does not work.

I'm using Eclipse for Java Developers.

Reproducible: Always

Steps to Reproduce:
1.1) an example array:
private static Object[] name = 
{
  Object1;
  Object2;
  etc...
};
1.2) apply formatter tags:
//@formatter:off
private static Object[] name =
{
  Object1;
  Object2;
  etc...
};
//@formatter:on

Result: array is formated.

2) put the tag in the beginning of the class:

/**
 * @author yournamehere
 * @formatter:off
 */

Result: all class is still formatted.
Comment 1 Ayushman Jain CLA 2010-12-20 07:32:05 EST
I couldn't reproduce using the default profile (Eclipse built in) + formatter on/off tags enabled (build  I20101214-0800). Both, array case and putting the off tag before the class declaration, work fine for me. 

Can you please attach your formatter settings here? (You may also want to check with the latest I build or 3.7M4 build). Thanks.
Comment 2 Juris Sudmalis CLA 2010-12-20 10:03:58 EST
Created attachment 185547 [details]
Java Code Style preferences
Comment 3 Ayushman Jain CLA 2010-12-20 10:33:47 EST
(In reply to comment #2)
> Created an attachment (id=185547) [details] [diff]
> Java Code Style preferences

Umm..I was specifically looking for the formatter settings in a .xml format. To get them, you can go to Java>Code Style>Formatter, make sure your formatter profile is showing, click edit and then click 'Export.." (on the top right). Please attach the xml file you get here. Thanks!
Comment 4 Juris Sudmalis CLA 2010-12-20 12:16:09 EST
Created attachment 185566 [details]
formatter
Comment 5 Ayushman Jain CLA 2010-12-20 12:43:15 EST
(In reply to comment #4)
> Created an attachment (id=185566) [details] [diff]
> guess 3 times

Thanks! Unfortunately, I still couldn't reproduce, even with your formatter settings. Can you please try the latest build?
Comment 6 Juris Sudmalis CLA 2010-12-20 13:50:33 EST
I'll download SR1 and M4 now.
Comment 7 Juris Sudmalis CLA 2010-12-20 14:33:47 EST
Created attachment 185589 [details]
before formatting, SR1
Comment 8 Juris Sudmalis CLA 2010-12-20 14:34:05 EST
Created attachment 185590 [details]
after formatting, SR1
Comment 9 Juris Sudmalis CLA 2010-12-20 14:35:45 EST
With default formatter, just plain extracted and ran the Eclipse and opened a known class, didn't change absolutely anything.
I'll try with Indigo M4 now.
Comment 10 Juris Sudmalis CLA 2010-12-20 15:04:56 EST
Okay, those 2 screens can be discarded, forgot to enable that tag in SR1. Works fine in SR1 and M4, but not in my current setup.
Comment 11 Ayushman Jain CLA 2010-12-21 03:47:13 EST
(In reply to comment #10)
> Okay, those 2 screens can be discarded, forgot to enable that tag in SR1. Works
> fine in SR1 and M4, but not in my current setup.

Will you be able to share your setup so that we can debug and find out the problem? Maybe something got messed up in your workspace and caused the problem. There's nothing much we can do unless we can reproduce the issue.
Comment 12 Ayushman Jain CLA 2010-12-21 03:49:08 EST
It'll be great if you can just use M4 instead since it works fine for you!
Comment 13 Juris Sudmalis CLA 2010-12-21 09:22:22 EST
(In reply to comment #12)
> It'll be great if you can just use M4 instead since it works fine for you!

I'm thinking of doing just that, current one suddenly refused to recognise one of my projects...
But AFAIK M4 is a developer (unstable) build, shouldn't there be some problems?
Comment 14 Ayushman Jain CLA 2010-12-21 09:29:14 EST
(In reply to comment #13)
>[..]
> But AFAIK M4 is a developer (unstable) build, shouldn't there be some problems?

M4 is a milestone build and we do everything on our side to make sure it is stable. So you can surely go ahead and use it. Anyway, if you do have some doubts, you can surely use 3.6.1 or the soon to be released 3.6.2 until 3.7 comes out. Thanks!

Closing as WORKSFORME
Comment 15 Juris Sudmalis CLA 2010-12-21 10:14:05 EST
K then, hopefully there will be no problems :)
Comment 16 Juris Sudmalis CLA 2010-12-21 11:09:13 EST
(In reply to comment #11)
> Will you be able to share your setup so that we can debug and find out the
> problem? Maybe something got messed up in your workspace and caused the
> problem. There's nothing much we can do unless we can reproduce the issue.

You mean all the preferences?
Comment 17 Ayushman Jain CLA 2010-12-21 13:06:25 EST
(In reply to comment #16)
> [..]
> You mean all the preferences?

I meant your workspace, including source code, could help us find what went wrong in your workspace. But i'm sure its not a bug since its otherwise not reproducible, so let's just stick to the good builds for now. :)
Comment 18 Juris Sudmalis CLA 2010-12-21 15:52:28 EST
(In reply to comment #17)
> (In reply to comment #16)
> > [..]
> > You mean all the preferences?
> 
> I meant your workspace, including source code, could help us find what went
> wrong in your workspace. But i'm sure its not a bug since its otherwise not
> reproducible, so let's just stick to the good builds for now. :)

Yeah, can't do that. >40k files, good part of it is stuff I wouldn't want to show anyone.
Hopefully this is the last time I'm here.
Comment 19 Srikanth Sankaran CLA 2011-01-25 03:24:43 EST
Verified for 3.7 M5 using build id: I20110124-1800