-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
allow whitespaces before and after java expression #164
allow whitespaces before and after java expression #164
Conversation
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.
Looks good! 👍
Just some naming nitpicks to be more consistent and provide a better usability in the IntelliJ settings dialog.
src/main/resources/org/mapstruct/intellij/messages/MapStructBundle.properties
Outdated
Show resolved
Hide resolved
@thunderhook thanks for the feedback. I change the names like you suggested. In addition the properties file is now used to provide the warning message instead of defining it directly inside the java code. |
@@ -49,7 +49,7 @@ | |||
*/ | |||
public class JavaExpressionInjector implements MultiHostInjector { | |||
|
|||
private static final Pattern JAVA_EXPRESSION = Pattern.compile( "\"java\\(.*\\)\"" ); | |||
public static final Pattern JAVA_EXPRESSION = Pattern.compile( "\" *java\\(.*\\) *\"" ); |
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.
Perhaps we need to do something like we are doing in core.
See
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.
I agree. The current implementation is missing the Pattern.DOTALL
and does not match all whitespace characters.
mapstruct allows whitespaces before and after the
java( )
block. Currently the plugin does not support this.I changed the
JavaExpressionInjector
to allow whitespaces before and after thejava( )
block. In addition I added an inspection to check if there are unnecessary whitespaces. If one or more is found before or after thejava( )
block, I added two quick fixes to remove allwhitespaces before or after thejava( )
block.