Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Replace in Files Searches Skipped Matches After Each Replace

In VS Find and Replace > Replace in Files seems to repeatedly search skipped matches before finding new matches.

  1. Perform a Find and Replace in multiple files: File_1, File_2 and File_3
  2. Skip one of the matches on File_1 and proceed to the next file with Find Next
  3. Make some replacements on the next file, File_2, using Replace
  4. After the final replacement on File_2, the Find Next match goes back to previously searched files, File_1 in this case, before going on to matches in File_3

I end up skipping through more and more previously searched files and skipped matches, just to find new matches. The Skip File option doesn't seem to help.

Is there a way to make Find/Replace search all un-searched files before looping back to the previously searched files?

I'm using VS 2012 but I seem to remember the same behavior in 2010.

Update: this is a bug. Please vote for a fix on this Visual Studio UserVoice suggestion.

like image 554
Walter Avatar asked Feb 11 '14 19:02

Walter


People also ask

How do I replace all occurrences in Visual Studio?

You can find and replace text in the Visual Studio editor by using Find and Replace (Ctrl+F or Ctrl+H) or Find/Replace in Files (Ctrl+Shift+F or Ctrl+Shift+H). You can also find and replace only some instances of a pattern by using multi-caret selection.

How do I search an entire solution in Visual Studio?

Ctrl + Shift + F – Find in Solution Sometimes you want to search across your entire solution. You can double-click each item in the “Find Results” window to navigate to that instance of the search term you searched for.

How do I search for a word in all files in Visual Studio?

Search across files# VS Code allows you to quickly search over all files in the currently opened folder. Press Ctrl+Shift+F and enter your search term.


1 Answers

I never noticed that. You can do a Find in Files, Find All. That way you have a list of all instances and can work your way down the list. Double-click the first one, press Ctrl-H, and replace or skip all matches in that file. Go back to your list and click the first match in the next file.

It will be harder to lose your place this way, but it is still tedious if you have a lot of files/matches to go through.

VS 2013 has the same behavior, in case you were curious. Sorry I don't have a better answer.

like image 121
Lou Avatar answered Oct 14 '22 02:10

Lou