Skip to content

Capture using followed by quote splice #181

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

Merged
merged 2 commits into from
Jan 19, 2021

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.

@@ -425,7 +425,7 @@ export const scalaTmLanguage: TmLanguage = {
'using': {
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