-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
A macro expansion visualizer tool would be nice! #2400
Comments
I think the "peek def"-kind of UI would be a nice, if it can be implemented. |
Sounds awesome with support for this. I'll have a think about the UI. You could post about it in the Calva channel on slack too to hopefully get more ideas. |
A bit unrelated: One thing that springs to mind, looking at how CIDER supports the macro expand tooling, is if we added some options to custom commands:
Less unrelated: With such mechanisms in place, we could implemen macro expand tooling built-in using those. Another option (we could support this in several ways) is to have a setting Include macroexpand in Hover? If we do both we would support the expand-again option naturally with the rich comment mechanism. |
Expanding macros into comment forms sounds like a great first step. Another option to adding it below what was just expanded (when invoked from inside a RCF) would be to replace the form with its expansion, i.e. the recursive behaviour that Cider sports. For the hovering, you mean when you hover any macro use you see the expansion there? That sounds sweet. Ultimately, I think it would be nice to integrate the macroexpand-1, macroexpand-all and macroexpand functionality in the same UI, but which would require some more interaction. |
If you want to have a feel for how it would be to use a command that would put the expansion in a rich comment, try the command Calva: Add Rich Commment. |
A classic Lisp IDE feature is the ability to visualize expansion of macros. This gets more interesting due to the recursive nature of this problem but at least some basic 1st level-expand functionality (akin to clojure.core/macroexpand-1) would be nice (see below). So I'm thinking some command to macroexplanding forms (for the usual meaning/variations of "forms").
Bonus points for the ability to recursively expand more layers of macros, though a simple toggle for 1st level vs all levels would be a good start.
Example of prior art: https://docs.cider.mx/cider/debugging/macroexpansion.html
Cursive also has a macro-expander, and DrRacket a particularly nice Macro debugger/stepper.
This is my current poor mans Custom REPL Commands-based implementation of this functionality:
Basic UX question: Where to print the expanded form? A hover window would probably be nicest. Another dedicated window would be another option. The REPL is probably not much better than what the above commands give.
The text was updated successfully, but these errors were encountered: