New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single line comments on "case:" lines forced to next line #242
Comments
Can you give us a reference for this format? Why would dropping it to the next line be bad? Is there a consistent, easily identifiable pattern for these comments? |
Hi Daniel, see Moving the comment markup to the next line will defeat its purpose: It will flag the string again as I have not found a formal spec, but EOL comments matching /\bNON-NLS\b/ should be left alone. Ah, here is the source: Best regards! See also |
You have this: switch (a) {
case "ok"://$NON-NLS-0$
break;
case "ko"://$NON-NLS-0$
break;
} It looks like if it were beautified as follows it would it still be acceptable: switch (a) {
case "ok": //$NON-NLS-0$
break;
case "ko": //$NON-NLS-0$
break;
} Is that correct? I could see this as a potentially valid case for any |
@bitwiseman You are correct. Regarding preserver_newline; I am going to mention a different formatting issue here just because it may be connected: Let me know if I should elaborate or raise a separate issue for this. |
Non-indent first column Regarding preserve_newline and And actually now that I'm running the scenario in my head, I see this really not a big change at all and preserve_newline has nothing to do with it: /* Input */
if (a) { // This is a plain old comment
b();
// This is also a plain old comment
c = "TOKEN_NAME"; //$NON-NLS-0$
switch (c) {
case "TOKEN_NAME": //$NON-NLS-0$
break;
default:
break;
}
}
/* Old Output */
if (a) { // This is a plain old comment
b();
// This is also a plain old comment
c = "TOKEN_NAME"; //$NON-NLS-0$
switch (c) {
case "TOKEN_NAME":
//$NON-NLS-0$
break;
default:
break;
}
}
/* New Output */
if (a) { // This is a plain old comment
b();
// This is also a plain old comment
c = "TOKEN_NAME"; //$NON-NLS-0$
switch (c) {
case "TOKEN_NAME": //$NON-NLS-0$
break;
default:
break;
}
} Okay, I can do this. |
Great, thanks! |
Updated title and label - general bug, not specific to NON-NLS. |
As tested at minutes ago at http://jsbeautifier.org/
following code
gets beautified as
which breaks the purpose of these i18n annotations.
I first noticed the problem in Orion plugin
http://mamacdon.github.io/0.5/plugins/beautify/jsbeautify.html
as well.
The text was updated successfully, but these errors were encountered: