crystal-lang-tools / vscode-crystal-lang

Yet another VSCode extension for Crystal Programming Language
https://marketplace.visualstudio.com/items?itemName=crystal-lang-tools.crystal-lang
MIT License
277 stars 58 forks source link

Add macro expansion on hover #165

Closed nobodywasishere closed 10 months ago

nobodywasishere commented 1 year ago

When enabled, when the cursor hovers over a macro, the file/line is sent to crystal tool expand and the results are returned in a hover.

Closes #4.

Simple example

Macros defined in src/mlcsim/transcoder.cr: image

Main file set to src/mlcsim.cr: image

Macro expansion on hover in spec/mlcsim/matrix_spec.cr: Screenshot_2023-05-19_02-39-18

nobodywasishere commented 1 year ago

I'm thinking about adding to this the option to right click on a macro and click an option like "Show macro expansion" which would show the output in an output pane, as an alternative to hovering.

nobodywasishere commented 1 year ago

Added!

image

nobodywasishere commented 10 months ago

So this probably won't be merged but rather re-implemented for the rewrite. With that, I think I'm only going to have it as a right click option as it's something that's only need here or there, versus type information (which is what hover is currently used for).

nobodywasishere commented 10 months ago

This will be implemented with the rewrite.