-
Notifications
You must be signed in to change notification settings - Fork 217
Fix crash when class regex matches an empty string #897
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
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.
Grateful for this fix, it improves the readability of text processing method substantially.
One minor end user comment I have is could we get some kind of log to signify the start and end of file processing? I only ask because it's hard to determine from the VSCode Ext Output what the extension is doing after initialising.
@mfb-davidmay I think that's worth doing but as a separate thing. Adding logging here could be quite noisy as it's used during editing when triggering completions. |
Bit of a stopper at the moment — running this with the regexes:
Results in what looks to be an infinite loop in v8. It'll proceed after exec() a handful of times and then it'll all of a sudden stop working and Running a simple profile against the process looks like its spending time inside It happens reliably in my environment:
I need to test this against a similar node.js / v8 version to see if I can reproduce it there. |
Okay I guess I wasn't paying too close attention to the regex but it has nested Take the regex: If you look closely you can see an external group with Here is a simplified regex with the same situation — but less capture groups and alternations: On a regex like this it takes almost 20s to match the string All in all, this isn't a bug, just a regex that's going to take quite literally forever if it doesn't immediately find a match. That means this should be safe to merge. 😀 |
48d99b4
to
d96c3a2
Compare
This means we no longer need an external package for this too!
d96c3a2
to
deaa4ad
Compare
This removes
becke-ch--regex--s0-0-v1--base--pl--lib
in lieu of native support for capture group indices. This is supported in Node 16+ so will work in VSCode — additionally all modern browsers have supported this since late September 2021 (Safari 15, Chrome/Edge 90, Opera 76, FF 88) so this shouldn't be an issue for Tailwind Play either.As part of this change I've also done some refactoring to reduce duplication in code that used the above package — and added more tests!
Fixes #893