Skip to content

Fix problem with syntax highlihtingting #635

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
Oct 4, 2015
Merged

Conversation

prefiks
Copy link
Contributor

@prefiks prefiks commented Oct 2, 2015

So first a disclaimer, i almost completely don't know how those grammar files should be working, pretty much just tried some things until got results i wanted, it may broke some other things.

Those changes fixes two things that were bothering me, first missing syntax in atom 1.0.15+ and second change fixes missing missing syntax highlighting of jsx elements in some context (for example in return <something/> or let v = <value/>

This was easily visible by comparing look of those two lines:

let x;x=<div/>
let x=<div/>
basarat added a commit that referenced this pull request Oct 4, 2015
Fix problem with syntax highlihtingting
@basarat basarat merged commit 1424dda into TypeStrong:master Oct 4, 2015
@basarat
Copy link
Member

basarat commented Oct 4, 2015

Phew ... Thanks 🌹 This was driving me crazy, I guess you are breaking on newlines, and that fixes it?

/cc @Cu3PO42

@basarat
Copy link
Member

basarat commented Oct 4, 2015

release with 7.1.0

@alitaheri
Copy link

@prefiks Thank you.

@prefiks
Copy link
Contributor Author

prefiks commented Oct 4, 2015

I think problem with changed rules was that both begin and end regexes could match zero width string, so they could not advance current position. Optimization added in 1.0.15 didn't like that, and caused problem with highlighting.

@basarat
Copy link
Member

basarat commented Oct 4, 2015

}
]

'type':
'begin': '(?=)'
'begin': '(?=[\\(\\{\\p{L}\\p{Nl}$_])'
Copy link
Member

Choose a reason for hiding this comment

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

I'm unable to understand how this code is designed to work.

See https://regex101.com/r/qO2zF7/1

image

What's up with matching p or {L} etc. ... or am I misreading this. Thanks for the fix btw. Perhaps all we needed was literals ( and {?

Copy link
Member

Choose a reason for hiding this comment

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

In some regexp implementations, that would work for internationalisation categories - matches letters or number letters.

Reference: http://xregexp.com/plugins/, no idea if Atom supports it personally, but I know they do fix some back references and other regexp features.

Edit: If you switch to PHP in the link you posted, you'll see what I imagine is desired.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense now https://regex101.com/r/cZ1zZ6/1 . Cheers 🌹

@TypeStrong TypeStrong locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants