ruby-formatter/rufo

Using prism instead of Ripper?

Closed this issue · 2 comments

Is switching to Prism possible? (hard to switch?)
Or maybe it is not worth in the performance POV?

Rubocop is using it for Ruby 3.3+

kzkn commented

Thanks for the suggestion.
I have high hopes for Prism. But so far it doesn't look like it will be easy to migrate from Ripper and there are performance concerns. The Prism documentation also explains it that way.

https://docs.ruby-lang.org/en/3.3/Prism/RipperCompat.html

Note: This integration is not finished, and therefore still has many inconsistencies with Ripper. If you’d like to help out, pull requests would be greatly appreciated!

This class is meant to provide a compatibility layer between prism and Ripper. It functions by parsing the entire tree first and then walking it and executing each of the Ripper callbacks as it goes.

This class is going to necessarily be slower than the native Ripper API. It is meant as a stopgap until developers migrate to using prism. It is also meant as a test harness for the prism parser.

To use this class, you treat Prism::RipperCompat effectively as you would treat the Ripper class.

I think it is best to wait and see.

So we would have to glue the code and adjust to Prism instead of using compatibility layer.
so rufo2 makes more sense maybe :P