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

Using Ripper with run.rb #9

Open
AlanFoster opened this issue Feb 23, 2019 · 3 comments
Open

Using Ripper with run.rb #9

AlanFoster opened this issue Feb 23, 2019 · 3 comments

Comments

@AlanFoster
Copy link

Hey, love the project. I was just wondering if it would ever be possible to call off to Ruby's ripper module with run.rb ?

I was looking into integrating run.rb with the prettier plugin for Ruby - which requires access to the Ruby runtime and Ripper. I just want to rule out whether it's possible to use this project for that or not as it would allow Ruby code to be formatted directly in the browser without ever making external calls to a web server.

Some extra context here:

prettier/plugin-ruby#138

Any insights would be appreciated! 🏆

@jasoncharnes
Copy link
Owner

Thanks, Alan! I currently use Prettier for JavaScript, so I've kept my eye on the Ruby implementation. 😎

I would love to answer this question, but my contribution to this project was more the idea and the interface for it. 😅 My friend Will came up with the idea for the WASM implementation (and subsequently wrote the implementation).

We're currently using the Ruby runtime, be we don't have the standard library loaded. I believe it's possible and I know long term we'd like to add stdlib to the project. So speaking ignorantly, I think it's possible?

@willglynn if you have time, would you know (and be willing to share) the answer to this?

@willglynn
Copy link
Collaborator

@jasoncharnes Yeah, the WebAssembly module interacts with the filesystem via the Emscripten filesystem interface, which lets us ship files inside or alongside the WebAssembly module. A reasonable solution might be to bundle the standard library as part of the build process and expose a JS interface for other files.

@AlanFoster
Copy link
Author

@jasoncharnes + @willglynn Cool - thanks for the context!

It's worth noting that the module we're after is Ripper - which I think might add an extra level of complexity as it's the interface to ruby's parser. Let me know if this would change the approach or not 👍

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

No branches or pull requests

3 participants