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

Macros should record find operations #1

Closed xps closed 4 years ago

xps commented 11 years ago

As suggested by someone on StackOverflow, find operations should be recorded as they allow reaching text that is hard/impossible to get to via cursor moves.

This should probably include Find / Incremental Find, and Find Next / Find Previous operations.

TheSneak commented 11 years ago

+1 I would love to have this functionality

xps commented 11 years ago

Would love to have this as well. Unfortunately I have been looking at how to implement this but I've hit brick wall after brick wall. I am not giving up yet but it doesn't look too good at this point.

The problem is that the find operations cannot be intercepted (at least not in a supported way). I have tried to replace the default search by a custom one but this raises more issues (synchronization of the search options with the default one, can't press F3 in a macro if the initial search was made before you started recording, etc.).

Another option (unsupported) might be subclassing the search window and intercept Windows messages (hard to do, hard to maintain, possibly unstable and susceptible to break for multiple reasons).

I am happy to take ideas on possible implementations.

ghost commented 11 years ago

What about overriding the F3 shortcut with a function that calls Find internally and also registers the action in the macro? I will try this in a fork sometime, but maybe someone will beat me to it with the suggestion?

dcbrilho commented 11 years ago

+1...

Bradley-Ford commented 5 years ago

+1 to the F3 solution. That is exactly how I use macros in Notepad++..

Now the marco with find the next time and edit it each time you replay it.. I can't see the use of this plug in with out that function.

xps commented 5 years ago

I was just told that Microsoft's macro extension could record find operations. Would be worth it to have a look at their code and see if we can implement it: https://github.com/Microsoft/VS-Macros

peterthomastlc commented 4 years ago

I was just told that Microsoft's macro extension could record find operations. Would be worth it to have a look at their code and see if we can implement it: https://github.com/Microsoft/VS-Macros

I just installed Microsoft's VS-Macros vsix in VS2019. It seems that it doesn't record find operations - but it does support F3 find next. One question though - if Microsoft's version of macros works in VS2013 and later as they claim (and I can verify that it runs in VS2019), why do we need this extension?

xps commented 4 years ago

Thanks for the feedback on Microsoft's extension.

This extension existed before the Microsoft one, so that's why it exists.

Some people prefer to use this one as it is reportedly faster than Microsoft's.

viniciusvillas commented 4 years ago

Some people prefer to use this one as it is reportedly faster than Microsoft's.

Yeap. MS's one is unbearably slow for daily use, which is weird, as their embedded macro functionality on previous VS versions was great - kinda like this one. The missing F3/Find recording on this extension is really a must have. I did fiddle with the code a little bit to try to intercept the find commands, but to no avail. :(

viniciusvillas commented 4 years ago

Hey @xps , I just added support for it making some very minor changes using DTE. I'm not really sure what kind of collateral effects we can get by doing it this way, but it finally works! 😉 https://github.com/viniciusvillas/VSTextMacros/commit/45ad5db9679db49261be2e44e56b26e885675f3c

xps commented 4 years ago

Hey @viniciusvillas, that's awesome, thank you! Tested and it seems to work great.

Would you like to submit a pull request? If not, I can just cherry-pick the commit.

xps commented 4 years ago

@viniciusvillas Thank you, that's merged and live on the Visual Studio Marketplace!