xps / VSTextMacros

An extension for Visual Studio 2012-2022 that brings back support for macros in text/code editors
https://marketplace.visualstudio.com/items?itemName=XavierPoinas.TextMacrosforVisualStudio201220132015
Other
69 stars 20 forks source link

Question about adding a feature #25

Closed shankarswamy closed 6 years ago

shankarswamy commented 6 years ago

I am wondering if it is feasible to add the following feature to the macros, and if yes, some directions on how to modify the code to do it.

Way I type: while (xyze <= abcdef)

and hit return, I would like to see this:

while (xyze <= abcdef) {

} // while (xyze <= abcdef)

That is, the macro will copy the clause inside the while and add that as a comment after the brace close. Ditto for if, for etc and similar things.

Thanks!

xps commented 6 years ago

The idea of a macro is that you record and sequence of operations and then you replay it on demand. So you could certainly record one to do what you're after, but it won't be called automatically as you press ENTER (code might be able to be modified for that, but that cannot go into the main release as it would be way too invasive).

Instead, you could call your macro via a key binding. Currently, there is limited support to bind shortcuts to macros (see https://github.com/xps/VSTextMacros/issues/7), but this could definitely be improved.