Eugleo / magic-racket

The best coding experience for Racket in VS Code
https://marketplace.visualstudio.com/items?itemName=evzen-wybitul.magic-racket
GNU General Public License v3.0
204 stars 28 forks source link

DrRacket's interactions window in VS Code #122

Open codekhol opened 11 months ago

codekhol commented 11 months ago

Hello there!

Thanks for this great Racket extension. Is there any way to enable graphical mode in VSCode's terminal/REPL similar to DrRacket? I am writing a game using "slideshow" and wondering if I can develop and debug this game in graphical mode?

jryans commented 11 months ago

Unfortunately at the moment, there's no way to do that, but it is something I have pondered in the past. 😄 Rather than trying to make Racket graphical things happen in VS Code's terminal (which is designed for CLI programs), I think we'd really be imagining a separate VS Code "output area" that could host DrRacket's interactions window (the bottom part with a REPL). There are multiple large efforts involved to achieve this, at least as far as I can see.

One major area is the UI toolkit. DrRacket's GUI framework assumes it is constructing its own native windows and widgets using platform-specific UI frameworks. VS Code would need quite a different approach, perhaps by extending Racket's GUI framework to add a "web platform" path that uses HTML / CSS / JS instead of native things.

Another major area concerns execution of Racket code in a web environment. If these graphical things are meant to be interactive, then you'd most likely need to trigger Racket code in response to GUI events. Either you have some Racket native process running in the background that communicates with the web UI by passing messages ... or you need to translate all the Racket code into something that run on the web, perhaps via existing efforts like RacketScript or future work that compiles Racket to WebAssembly.

There are probably more areas I've missed... Perhaps it's at least clear that it would take a lot of work to pull this off. Still, I agree it would be quite impressive if it did all come together. Most of the hard parts here are more generally about "running Racket on the web" and less about VS Code itself (that's just one particular usage of such abilities). If there's someone out there who is motivated to make it all happen, I think the first step would be to discuss this with the community on Racket Discourse or similar to sanity check the plan.

jryans commented 11 months ago

I have tweaked the issue title to match my understanding of your request... If I have misunderstood, please let me know. 🙂