Visual Studio 11 Developer Preview: Find & Replace

Visual Studio 11 Developer Preview: Find & Replace

Rate This
  • Comments 51

In Visual Studio 11 Developer Preview we’ve streamlined and modernized our vast array of Find experiences.  Find and Replace is now a lightweight control within documents, delivering incremental search results as you type.  The Find and Replace in Files dialog has been simplified while at the same time gaining additional functionality such as Find Next and Find Previous.  Both Find experiences now let you use .NET Regular Expressions to perform complex search and replace operations, even across multiple lines.

The new Find and Replace Control

The new Find control sits at the top of the document as a search box. Ctrl + F now brings up this control, instead of the dialog. The new control affords all the capabilities of the dialog. You can Find Next, Find Previous, set Search Options, Replace etc.

image

Performing a simple Find

With the new Find control, you can perform a search exactly as you would with the VS 2010. Just hit Ctrl+F and type the search term. What you would notice however, is that now the search is instant and incremental. As you type, you get the matches highlighted and the first match selected by default. No need to click an additional Find Next button. Hit Enter to navigate among the matches in the document.

image
Find Next

image
Find Previous

Performing an Advanced Find

As I mentioned earlier, the new Find control affords all the capabilities of the Find Dialog. This means that you can search using advanced options (Match Case, Match whole word, Use Regular Expression) just the same as in the Find dialog. For this, simply click on the drop down next to the magnifying glass, in the search box. You can also hit Alt+Down when inside the search box.

image

Notice that setting Search Options acts like a filter instead of starting a new search. So if you searched for “Button”, without Match case, this would highlight all matches – button as well as Button. Checking Match case would filter this result set to only matches for Button (with the uppercase “B”)

MRU (Search History)

Find control maintains a history of the previously performed searches of up to five terms. This is displayed as a MRU (Most Recently Used) list. The list can be accessed by bringing up the dropdown from within the Find search box (or hitting the Alt+Down arrow key)

image

Performing a Replace

You can perform a Replace operation right within the new control. Just hit Ctrl+H / click on the drop down arrow to the left of the search box. This brings up the expanded version of the Find & Replace control. The replace box is below the Find box. Type your replace term and Hit Enter, or Atl+R or the Replace Next or Replace All buttons.

image
Replace Next and Replace All

Changing the Scope

The Find control allows you to change the scope for Find & Replace operations. To change the scope, click on the Drop down arrow, as in the case of Replace. This brings up the expanded Find control with the scope selection dropdown.

image

“No Results” Alert

The Find control allows you to quickly find out when there are no results for the current search term with the current search criteria. When there are no results to show, the search box is highlighted with a red border indicating that there are currently no results to display.

image

Using Regular Expressions (.NET Regular Expression syntax only)

One of the major changes we have made, in response to customer feedback, with the new Find experience is moving away from the POSIX style regex syntax to .Net Regex syntax. You can do all your searches using the familiar .Net style regular expressions. The VS2010 style regular expression syntax has been discontinued. So, to search for a “Start Game”, I would type

In Visual Studio 11 Developer Preview: Start\s+Game

In VS 2010 (This will not work in VS 11 Developer Preview): Start:b+Game

A complete reference for .NET Regular expressions can be found here .NET Regular Expression Cheat Sheet.

Find In Files Dialog

You can still do everything that you were used to doing with VS2010 Find Dialog with the new experience. To bring up the Find In Files dialog, simply hit Ctrl+Shift+F (or Ctrl+Shift+H for replace). This brings up the familiar dialog. We have simplified this dialog to a large extent. There are just 2 tabs – Find In Files and Replace In Files.

image
Find In Files

Now there are only two tabs – Find In Files and Replace in Files. We have added Find Next and Find Previous. Note that you can also bring up the Find In files dialog from within the Find control, in the Search Options dropdown.

Find Symbol has been discontinued

With the new Find experience we have relooked at the Find dialog and redesigned it for simplicity. Based on the usage data we have received from our Customer Experience Improvement program, the Find Symbol features was rarely ever used by our customers. With the new Find, the support for Find Symbol has been removed from the UI. However, you can still search for symbols using the Find All References from within the Editor.

Find & Replace Cheat Sheet

You can of course use the same short-cuts and accelerator keys that you are used to with the Find dialog, with the Find control. Here is a list of shortcuts and accelerator keys you can use to work with Find & Replace in Visual Studio 11 Developer Preview.

Shortcuts:

Command

VS 11 Developer Preview Action

Command

Ctrl+F

New Quick Find

Edit.Find

F3

Find Next

Edit.FindNext

Shift+F3

Find Previous

Edit.FindPrevious

Ctrl+F3

Find Next Selected term

Edit.FindNextSelected

Ctrl+Shift+F3

Find Previous Selected term

Edit.FindPreviousSelected

Ctrl+I

New Quick Find / Forward incremental search

Edit.IncrementalSearch

Ctrl+Shift+I

New Quick Find / Reverse incremental search

Edit.ReverseIncrementalSearch

Ctrl+Shift+F

Find in Files

Edit.FindInFiles

Ctrl+Shift+H

Replace in Files

Edit.ReplaceinFiles

Ctrl+H

Quick Replace

Edit.Replace

Enter

Find Next

Edit.FindNext

Shift+Enter

Find Previous

Edit.FindPrevious

Accelerator Keys:

Shortcut

VS 11 Developer Preview Action

Alt+F

Find Next, Find All (buttons)

Alt+R

Replace, Find Next

Alt+A

Replace All (button)

Alt+I

Skip File (button

Alt+C

Toggle Match Case

Alt+W

Toggle Whole Word

Alt+E

Toggle Regular Expressions

Alt+N

Focus in Find What Box

Alt+P

Focus in Replace With Box

We want to hear from you!

Because Find is such a critical and integral part of the Developer experience, we need your feedback on how well the new experiences are (or are not!) working for you. We are listening to your feedback.

If you have any additional questions, feel free to leave comments below.  If you’re experience problems with Find & Replace, please file a Connect Bug, and we’ll investigate

You can write to us here: VSFindFeedback2@microsoft.com

You can also send your feedback from within the Find control:

image

Thanks,
Murali Krishna Hosabettu Kamalesha
Program Manager - Visual Studio Code Experience

Known Issues

As you might imagine, with the new release, we have completely revamped the Find experience for our customers. With this huge change, there are some known issues and unfortunately we didn’t have time to fix by the time of this release of Visual Studio 11 Developer Preview. However, these issues are already fixed in internal builds and you would be able to get these when you install a subsequent release J.

Unable to Find All with the Current Document scope

In the current version, you will not be able to perform a Find All when the scope is current document. However, when you search for a term using the new Find Control, all of the matches in the current document are highlighted. This should hopefully allow you to work around this issue. And like I mentioned, this issue has been fixed for a subsequent release.

Find in Files does not clear the Find results

In the current version, when you perform a Find in Files, the results are appended to the Find Results window. The results of the previous search are not cleared. To work around this issue, you can still clear out the Find Results window manually. We understand this is inconvenient and this has been fixed, but you will have to wait for a subsequent release. J

Search Criteria is missing from the Find Results window

When you perform a Find All operation, the search results are populated in the Find results window. In the current version, the results are still populated, but a line mentioning the search criteria is missing. For subsequent releases, this issue is also fixed.

Leave a Comment
  • Please add 5 and 1 and type the answer here:
  • Post
  • This is very much the same as the extension I already use for 2010

  • I tried sending an email to the address listed. I got this response:

    Delivery has failed to these recipients or groups:

    VSFindFeedback2@microsoft.com

    Your message can't be delivered because delivery to this address is restricted.

  • Although I program in .NET, I've become very accustomed to the regular expression find/replace syntax in Visual Studio through version 2010. I'm willing to change my ways.

    However, one thing I'm not seeing a good workaround for is a .NET alternative to the :i pattern, which matches an identifier. I'll be very unhappy to change to using [a-fA-F_][a-fA-F0-9]*. That's a LOT more typing.

    I don't see a .NET equivalent to :i. Please correct me if I'm wrong.

  • Yep, +1 for @MysticTaz.

    What about Replace with \0 and \1 syntax? Don't want to name my matches and refer to names afterwards, because that's also too much typing.

  • I don't see how the new interface for Find & Replace is better than what is in VS2010. Please forgive me for being frank, but I think you have wasted your time redoing what was working all right already. Now, the waste would have bothered me much less if you weren't constantly reminding us that you can't get us the features we want (like support for C++11, which you said isn't going to improve much in vNext) because you don't have infinite resources. Well, here is a good portion of your precious resources, wasted on something I am not even sure adds value... Way to go, Microsoft (sad).

  • "Find Symbol has been discontinued"

    Alt+F12? Nooooo... I use that all the time! Find All References requires you to actually go to a reference so you can right-click it. Alt+F12 allows you to just type a substring of the thing you want.

    I'd use the new Ctrl+Comma thing in VC2010 but you didn't include it in the Express edition.

    Class View has a filter, but it's clunky to use. Ctrl+Shift+C takes focus to the pane, but not to the search filter text box. You expect it to operate in real time, Windows Explorer filter style, but you wait for a while and then realise you have to press enter. And it doesn't find substrings, just prefixes. Perhaps these things will be improved with the changes to Solution Explorer.

    But, if you're going to remove Find Symbol, please at least add Navigate To to the Express Edition!

  • @PleaseFixYourBugs

    The people involved in the Find work are not on the C++ team, the alternative to them doing the find work would not to have been doing C++11 work.

    >I think you have wasted your time redoing what was working all right already

    There has been a lot of feedback from a lot of people that it *wasn't* working all right.  VS has a huge user base, so while something may be appear to be 'working all right' to some percentage of them it can be roundly disliked by a much larger percentage.

    Ryan

  • @Ryan Molden:

    "The people involved in the Find work are not on the C++ team, the alternative to them doing the find work would not to have been doing C++11 work."

    OK, what about improving the performance of the IDE? This is a #1 issue on the user voice site. Could people involved in the Find work instead have worked on that? (Of course, they could.)

    "There has been a lot of feedback from a lot of people that it *wasn't* working all right."

    Could you elaborate on what this feedback was? I am struggling to see what the new feature is going to do that the old feature didn't do. I see only one thing: performing the search in the background as the user types the search term and either highlighting matches in the text or turning the borders red. That's neat, but ...is this all there is? If there is nothing else new, did the above feature warrant a rewrite?? Given that it comes at the expense of another feature (Find Symbol)? Given that it can be easily offered via an add-in? Given that there are plenty of other, much more important problems, eg, a dog slow IDE? I don't think so.

  • >OK, what about improving the performance of the IDE? This is a #1 issue on the user voice site. Could people involved in the Find work instead have worked on that? (Of course, they could.)

    The people involved did work on performance bugs as well, as did all other people on the team. Performance is another interesting issue in that with a user base the size of Visual Studios and a HUGE variety of usage patterns (i.e. solutions with small numbers of projects, solutions with hundreds of projects, single language solutions, polyglot solutions, hundreds of third party plugins, etc...) some people see terrible performance problems (for which we are collecting data to figure out why via the PerfWatson stuff), others see no performance issues. With PerfWatson we are gathering actual hard data on what is causing the issues for people so we can fix them.

    >Could you elaborate on what this feedback was?

    I am not on the editor team but amongst the feedback I heard was it was annoying to have a popup dialog, it was annoying how it would try to be clever and reposition itself to not obscure the search results the dialog itself was too confusing with too many options, etc...

    >I am struggling to see what the new feature is going to do that the old feature didn't do. I see only one thing: performing the search in the background as the user types the search term and either highlighting matches in the text or turning the borders red. That's neat, but ...is this all there is?

    This was available in the old version as well, it was called Incremental Search and didn't have a dialog, so that isn't new.

    >Given that it comes at the expense of another feature (Find Symbol)?

    Everything comes at the expense of another feature, if we had done 'Find Symbol' it would have come at the expense of some other feature that someone else perhaps valued more highly than your choice of 'Find Symbol'.  

    Also the editor team wouldn't be the one doing Find Symbol as that would be language specific thus the language teams would need to be the ones doing that work, and each and every one of them would need to do it, at least until Rosyln integrates with the product.

    >Given that there are plenty of other, much more important problems, eg, a dog slow IDE? I don't think so.

    Again, you seem to imagine that your ranking of what is important is universal. Teams decide on feature work based on broad customer feedback/requests.  Deciding that all customers are say up in arms because of the top posting on User Voice is suffering from a bit of selection bias. Performance is important, and there is work being done on it, a lot of work. This is a complex area due to the massive size of our user base and the huge number of different configurations/usage patterns. That said we are always hiring people passionate about development tools and making VS better.

    Ryan

  • @Ryan:

    "I am not on the editor team but amongst the feedback I heard was it was annoying to have a popup dialog, it was annoying how it would try to be clever and reposition itself to not obscure the search results the dialog itself was too confusing with too many options, etc..."

    So what? You just traded these complaints for complaints that (1) it is annoying to have a search box appear as part of the window instead of in a separate dialog, that (2) it is annoying to have a search box obscure the top row of characters every time without any smarts, that (3) there are still too many options (you haven't thrown anything away, have you? if you have, replace this complaint with "you have thrown away the feature I used"). In addition to that you will have a new complaint that things work differently from how they used to work. Thoroughly unconvincing.

    "This was available in the old version as well, it was called Incremental Search and didn't have a dialog, so that isn't new."

    So, there isn't even anything new. Why did you rework the feature??

    "Everything comes at the expense of another feature, if we had done 'Find Symbol' it would have come at the expense of some other feature that someone else perhaps valued more highly than your choice of 'Find Symbol'."

    Oh, right, "our resources are not infinite" argument again. First, 'Find Symbol' was already there in the code, you have chosen to rewrite that code for the reason I am trying to understand, and in the process you have thrown the feature away. Second, the reason I am writing what I am writing is exactly that you seem to have chosen to waste your non-infinite resources reworking something that already worked.

    Seriously, why did you rework the old Find & Replace? I don't get it. You said that "there has been a lot of feedback from a lot of people that it *wasn't* working all right". Have you seen this feedback?? What was it? You seem to back off now saying that you are not on the editor team. Can you get someone from the editor team to clarify? Why did you rewrite the feature? In what way the new code is better than the old?

    Geez... And to think of it, this is what you have chosen to blog about. Something is rotten in the kingdom of Denmark.

  • @Ryan:

    "Deciding that all customers are say up in arms because of the top posting on User Voice is suffering from a bit of selection bias."

    Brilliant. With this, if you don't like the results of your poll, you can freely ignore it. Way to go.

  • @PleaseFixYourBugs

    >Brilliant. With this, if you don't like the results of your poll, you can freely ignore it. Way to go.

    No, I was simply pointing out that saying that something is at the top of the site == it is automatically slated for the next release is not accurate, I don't believe the site ever said that, in fact it says 'This site is for suggestions and ideas.'.

    >Second, the reason I am writing what I am writing is exactly that you seem to have chosen to waste your non-infinite resources reworking something that already worked.

    Again, worked for you, others had different views of the matter. Reasonable people can disagree.

    >Thoroughly unconvincing.

    I wasn't necessarily trying to convince you, I was trying to simply respond to your complaints with an alternative perspective. If you aren't interested in that then I apologize.

    Ryan

  • To be honest, I also don't get what exactly is the improvement of the new Find & Replace dialog over the old one.

  • @PleaseFixYourBugs:

    If you ever noticed people complained about Search Dialog in IE7 (yes, it's Internet Explorer 7) and earlier versions, I think that's what people are complaining with *modal-dialog-based* Search Dialog in VS. Well, at least for me.

    You know that modal dialog is obstructing/blocking visually any text/content behind it, and it's visually annoying for me to have it when searching. By making it inlined as this post has shown, VS can save a significant portion of UI space so that user can FOCUS more on the text editor than the Search Dialog itself when searching obviously. Modal dialog, like in searching, is personally distracting my focus and visually obstructing what I should actually look at when searching: it's the text editor and NOT the Search Dialog. And I think it improves user productivity and user experience so that user is doing no more work on 1) switching between Search Dialog and the text editor, and 2) moving the Search Dialog somewhere so that it won't visually obstruct any text/content in the text editor.

    So, does this finally make any sense to you?

  • @Maximilian Haru Raditya:

    The Find & Replace dialog in VS2010 is *modeless*, not modal. It has been modeless since forever. If you don't want it to obscure text, you can move it to a second monitor (if you have one) or dock it as a pane. If you work with at least one pane opened (say, Solution Explorer), docking the dialog as a pane works pretty much like the new system in that the dialog is out of the way and lets you focus on the text editor yet you can get to it by pressing a shortcut key.

    So:

    "So, does this finally make any sense to you?"

    ...no, it does not many any sense to me. I remain confused as to the reasons for the rewrite. The rewrite that doesn't add any value is a waste, and this particular rewrite doesn't seem to add a lot of value.

Page 1 of 4 (51 items) 1234