Skip to content

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

MaximeKjaer
MaximeKjaer previously approved these changes Jan 16, 2021
Copy link
Contributor

@MaximeKjaer MaximeKjaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good. Just have some questions as to whether we could simplify this regex while we're at it.

patterns: [
{
match: `(?<=\\()\\s*(using)\\s+(?=[\\w\\d\\(\\.\\(\\{'"])`,
match: `(?<=\\()\\s*(using)\\s+(?=[\\w\\d\\(\\.\\(\\{'"$])`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for why we have the positive lookahead (?=[\\w\\d\\(\\.\\(\\{'"])?

I'm also noticing here that we have \\( twice in the character set [\\w\\d\\(\\.\\(\\{'"$].

Also, could some of these be un-escaped? I think ( and { don't need to be escaped in character sets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The positive lookahead seems to be there for historical reasons. I simplified the regex to not use it at all and added some tests for the cases the lookahead was trying to avoid.

Copy link
Contributor

@MaximeKjaer MaximeKjaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I'm happy with how we simplified the regex.

@nicolasstucki nicolasstucki merged commit a45260e into scala:master Jan 19, 2021
@nicolasstucki nicolasstucki deleted the fix-#180 branch January 19, 2021 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using parameter not highlighted if the name starts with $
2 participants