-
Notifications
You must be signed in to change notification settings - Fork 43
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
Fix: NON-NLS comments move before +
in string concatenations
#45
Conversation
Generate changelog in
|
+
in string concatenations+
in string concatenations
+ "field_1," //$NON-NLS-1$ | ||
+ "field_2," //$NON-NLS-1$ | ||
+ "field_3," //$NON-NLS-1$ | ||
+ "field_4"; //$NON-NLS-1$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ 😍
@@ -620,6 +631,10 @@ private static int getI(Input.Token token) { | |||
return newOps.build(); | |||
} | |||
|
|||
private static boolean isNonNlsComment(Input.Tok tokAfter) { | |||
return tokAfter.isSlashSlashComment() && tokAfter.getText().contains("$NON-NLS"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be able to make this more specific, nls comments are required to start with //$NON-NLS-
, even subsequent numbers, e.g.
String f() {
return "a" + "b"; //$NON-NLS-1$ //$NON-NLS-2$
}
Realistically I'm not sure that makes much difference.
Released 0.2.8 |
Before this PR
NON-NLS comments after
+
in chains of string concatenations are moved such that they don't follow the original string anymore.After this PR
==COMMIT_MSG==
NON-NLS comments are moved behind
+
tokens in string concatenations. This is a heuristic that doesn't look at what the thing before the+
is, so it might produce confusing results.==COMMIT_MSG==
Possible downsides?