Tabifier clobbers Annotations

Strings that I have annotated with @NonNls lose their annotation when they are "Tabified". Is this a known issue? Is there an easy solution?

Cheers
Tony

7 comments
Comment actions Permalink

surely I'm not the only one that this is happening to...

0
Comment actions Permalink

uninstall - click

problem solved :(

0
Comment actions Permalink

Tony,

Sorry for the delay in responding. I've been out of town. Are you talking about field declarations? Give me a sample piece of code and I'll fix it.

-Dave

0
Comment actions Permalink

Fields and local variables lose their annotations. Format code places the field annotations above the field declarations. CTRL-ALT-SHIFT-T then nukes them. I'm using the default Tabifier settings with one exception. The hotkey tabifies the whole file if no lines are selected.

import org.jetbrains.annotations.NonNls;

public class AnnotationsClobbered {

@NonNls
private String annotatedField;
@NonNls
private String anotherAnnotatedField;

public String getAnnotatedField() {
return annotatedField;
}

public void setAnnotatedField(final String annotatedField) {
this.annotatedField = annotatedField;
}

public String getAnotherAnnotatedField() {
return anotherAnnotatedField;
}

public void setAnotherAnnotatedField(final String anotherAnnotatedField) {
this.anotherAnnotatedField = anotherAnnotatedField;
}

public static void main(String[] args) {
@NonNls final String a1;
@NonNls final String a2;
}
}

Message was edited by:
Tony Johnson

Message was edited by:
Tony Johnson

0
Comment actions Permalink

Thanks, Tony. I've uploaded a new version, 5.2, which will preserve those annotations. Let me know if you have any problems.

I appreciate your patience and the bug report!

-Dave

0
Comment actions Permalink

Thanks. The annotations are now preserved. Unfortunately, fields that are divided by annotations are not aligned - eg:

@NonNls
public static final String GLOBAL_MAPPING_KEY_SUCCESS = "success";
@NonNls
public static final String GLOBAL_MAPPING_KEY_ERROR = "error";

does not have the initial value aligned after the file is Tabified.

Tony

0
Comment actions Permalink

Tony,

In the Tabifier configuration panels, go to the Line Grouping pane and uncheck the option "Non-blank lines (non-tabifiable statements) delimit groups". This will cause the tabifier to group the two assignment statements together and do what you want.

-Dave

0

Please sign in to leave a comment.