rescript-association / rescript-lang.org

Official documentation website for the ReScript programming language
https://rescript-lang.org
MIT License
1.85k stars 246 forks source link

AST explorer in playground #110

Open tom-sherman opened 3 years ago

tom-sherman commented 3 years ago

As a complete newbie teaching myself Rescript, it's very difficult to know what to google for when you're not sure on some syntax. I find it very useful to past a snippet into a tool like https://astexplorer.net to find out what's going on in the syntax.

Could such a tool be added to the playground? Maybe it would be easier to integrate Recript into astexplorer itself, such is the case for Reason: https://astexplorer.net/#/gist/3412c637cd5ffe6019f772f540d14365/f0a2a0945bba8cade7a1d28896409db872a0af0e

ryyppy commented 3 years ago

As a complete newbie teaching myself Rescript, it's very difficult to know what to google for when you're not sure on some syntax

We recently saw this pretty nice UI idea about discovering JS operators and would be interested in designing something similar as well. Just a matter of creating a stateful component that gets an array of keywords / documentation text that gets embedded on a markdown page (advantage here is that we can use the mdx JSX functionality to edit our documentation text in markdown, passing it as a React.element to our component when rendering).

There are no plans on exposing AST functionality on the playground... not only because it would take some time to get the necessary infrastructure in place, but also because ASTs shouldn't be the way to explore the language. We are also on a tight time budget and would like to ship some more important features instead.

Edit: I added a separate ticket #111 for the implementation details of the syntax discovery widget mentioned above.