Skip to content
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

Replace regexp for matching regexeps with atom's version. #133

Closed
wants to merge 1 commit into from

Conversation

graceful-potato
Copy link
Contributor

Potential solution for #117

(?x)
(?<![\w)])((/))(?![?*+])
(?=
(?:\\/|[^/])*+ # Do NOT change the order
Copy link
Contributor Author

@graceful-potato graceful-potato Feb 18, 2020

Choose a reason for hiding this comment

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

looks like /\\/ is not highlighted by this rule. And I think that this can be fixed with
(?:\\\\|\\/|[^/])*+

@graceful-potato
Copy link
Contributor Author

graceful-potato commented Feb 18, 2020

Also this regexp has some disadvantages with multi-line expression.

If you want to write division and put divisor on the new line then you have to use a whitespace after /. Whithout whitespace this expression will be highlighted as regexp.

# without whitespace after `/`
# `/` will be highlighted as start of regexp
4 /
2
# with whitespace after `/`
# expression will be highlighted as division
4 / 
2

If you want to write multi-line regexp then you have to make sure that there isn't a single character after /

# with whitespace after `/`
# expression will not be highlighted as multi-line regex
regexp = /  
foo
bar
/
# with any other character after `/`
# expression will not be highlighted as multi-line regex
regexp = /f
oo
bar
/
# without any character after `/`
# expression will be highlighted as multi-line regex
regexp = /
foo
bar
/

Github highlighting has exactly the same issues.
UPDATE
Same issues only in preview mode

@graceful-potato
Copy link
Contributor Author

Well, according to issue atom/language-ruby#82 this regexp will bring in new highlighting problems.

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.

None yet

1 participant