-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Using the JS engine by default #870
Comments
Yeah I think it's definitely ready to mark as stable, thanks to your hard work! I am still not sure about to have it as the default yet (if we cover 100% then I'd be totally up to it, we could also remove those really-hard-to-support grammars, or change to sources that are more compatible). My goal is definitely to have Shiki to not coupled with Oniguruma. The separation is almost done, but it's still be bundled in the main entry, that I planned to make them composable/exchangable in the next major. |
In terms of improving the grammars, do you think we should provide a better toolset for authoring grammars? We can have starter template with a playground that can inspect the state machine and tokens, also would tell if you are using some Oniguruma-specific feature and whether they can be polyfilled by |
Cool. I'll make related documentation changes alongside the next
Nice to have that as an option.
Aside: Would it also be possible to upgrade
I think it's a great idea. TM grammar authors need all the help they can get, and providing a toolset like that might help ensure future grammars are compatible with Shiki (including its JS engine). It's probably not something I'd be able to take on, though, apart from helping with |
Is there any feature/fix missing with the current version? I see |
Oh, you're right!
|
Closing this since you removed the "experimental" label in 25695aa (released in v1.24.4). |
The latest version of Shiki's JS engine is robust, handling 95% of grammars (99.9% of regexes). The next version of
oniguruma-to-es
will also move Markdown and PO to supported (at minimum, since they're already fully working onmain
). Ada (maybe also Hack) will move to supported after a single invalid Oniguruma regex is fixed upstream [1], [2]. And I've also identified a complex subroutine edge case (Oniguruma subroutines are horrifyingly complex to emulate if you want to cover 100% of edge cases) causing mismatches for Apex. Although it's a really tricky one, I'm optimistic that I'll figure out how to emulate it (with a fair amount of work and special handling inoniguruma-to-es
's RegExp subclass).Not counting other potential improvements (and grammars that might come along for the ride with the Apex fix), supporting the grammars mentioned above would mean 97% of grammars are supported. For people who understand the full depth of Oniguruma's advanced features and crazy edge cases (and JavaScript's limitations), I think this is epic. 😊
Given that the JS engine is about 4% of the size of the WASM engine and roughly performance-neutral (some grammars are faster, some slower), I'm curious what it would take to remove the experimental label and/or make it the default engine.
It's certainly possible to keep grinding away at improving the underlying
oniguruma-to-es
library to add even more support (help would be very welcome). However, it would probably be easier to modify patterns in the remaining unsupported / mismatched grammars to avoid problematic features (like overlapping recursions and some uses of\G
). That approach would also probably allow more people to help.What do you think? Is moving to the JS engine as the default the right goal?
The text was updated successfully, but these errors were encountered: