DigitalDesignDude
DigitalDesignDude

Reputation: 71

Visual Studio IDE - Find and Replace Prevent Jumping to Next Result?

Is there any workaround or extension to prevent Visual Studio IDE 2022 from scrolling my view when clicking the "Replace Next" button in the Find-and-Replace related windows?

I use REGEX code with Find-and-Replace, and so I would like to verify that text is replaced correctly each time I press the "Replace Next" button. But the view scrolls or switches to another file with the next matching found result before I can see the changes that were made.

I also like to run Visual Studio's "Edit.FormatDocument" command to beautify or clean up the improper indenting made when replacing text, but I can't do that to my current file before Visual Studio jumps to the next matching result in another file.

It would be fantastic to temporarily turn off that auto-scroll-to-next-result behavior or to have another button in the Find-and-Replace windows that replaces the current matching text without scrolling to the next one.

I looked into making my own Visual Studio extension to override the behavior or to make a custom find and replace command but it's difficult to find examples for doing something like this and I'm just a beginner. I wasn't even able to get something working with the DTE.Find.FindReplace API. And with the addition of the extension needing to be compatible with REGEX I figure it will be more difficult.

Thank you for any input or assistance with this.

Upvotes: 0

Views: 248

Answers (1)

Bowman Zhu
Bowman Zhu

Reputation: 7146

Is there any workaround or extension to prevent Visual Studio IDE 2022 from scrolling my view when clicking the "Replace Next" button in the Find-and-Replace related windows?

The answer is NO.

For the focus of the "Replace Next" feature, Visual Studio doesn't have such configuration to control this. And also doesn't have such an already-made extension.

And I think extenion also hard/unable to achieve this. I didn't see any API of VS SDK give such configuration.

If you don't want to see the results via scrolling the view. what about "find all" feature:

enter image description here

If you don't want focus move when click "replace next", what about "replace all" feature:

enter image description here

Upvotes: 1

Related Questions