Improving Find & Replace in Visual Studio 11 Beta

Improving Find & Replace in Visual Studio 11 Beta

Rate This
  • Comments 34

In our previous blog post, we introduced the new Find control we are building in Visual Studio.  Our goal was to streamline and modernize the vast array of Find experiences and provide a lightweight mechanism to search within documents. With the huge number of responses we received from the Developer Preview, we knew that our top priority for the Beta release was improving the quality of Find.  Since the Developer Preview release, we have fixed a large number of customer reported bugs, including replace in selection not working, buttons being disabled in the find dialog, missing wrap alerts, match whole word not working, and more.  There still are some rough edges in the Beta Find control, but we are working hard at making Find consistent and reliable for future releases.  Along with fixing bugs, we took a hard look at addressing the top customer suggestions.  Here are some of the top suggestions reported in the Developer Preview that are now available in Beta:

  • Down arrow pops open search options
    One of our top feedback complaints was that search options were not discoverable in the new control.  Additionally, a number of users requested the ability to scroll through the History using the arrow keys.  To enable both of these scenarios, we added the ability to pop open the MRU list by hitting the down arrow key.  We hope that this change makes the search options easier to discover. 

image

  • Keyboard shortcuts
    The support for search option shortcuts was not extensive in the Developer Preview.  A number of customers wanted the ability to use the same shortcuts they were familiar with in VS2010 to set their search options.  In Beta, you can now use Alt+C to toggle Match case or Alt+E to toggle regular expressions.  You can find a full list of shortcuts in my previous post.

image

  • Find control is resizable
    Making the Find control resizable was a top customer request for users who work with larger search terms, mostly common in regular expression searches.

image

  • Regular expression builder updates
    The new Find supports .NET regular expressions, which has been a longstanding ask from customers.  However, users let us know that a number of common (and easy) VS 2010 regular expressions no longer worked in the new Find.  In the Beta Find, we have made additions to the Regular expression builder to support some of the missing patterns that you used in VS 2010.  Click on the builder menu flyout to access these newly added regular expressions.

image

  • Tab order
    Another small but useful change post Developer Preview is the tab order is now consistent with the dialog.  This is another change we pursued based off user feedback.

Even with the improvements in the Beta Find control, there are still some noticeable bugs:

  • Shared scope and options for Quick Find and Find-in-Files.
    One of our top reported bugs is the shared scope and search options for Quick Find and Find in Files. This bug causes the scope and options to be common across the new Find control and the Find dialog. This bug fix, unfortunately, was too risky to release in Beta, but we are addressing it post-Beta.  In the meantime, this extension (link below) should fix the issue so you can work with separate scope and search options.

Download: VS11_BETA_ONLY-FindSettingsSeparator.vsixx

IMPORTANT: The extension provides a workaround for the shared scope & options issue. Please note that this extension can be expected to work correctly only on Beta and should be uninstalled when upgrading to future versions. This extension will not be serviced by Microsoft. If you encounter any issues after installing the extension, please uninstall and restart Visual Studio.

  • Closing documents with an active Incremental search session throws COM Exception
    There is a bug in Find that causes a COM exception every time a document is closed with an active incremental search.  This issue will also be addressed post-Beta. To work around this issue, incremental search should be dismissed before closing documents. ISearch can be dismissed by hitting the Esc key.  Once this exception occurs, please re-invoke Find using Ctrl+F and perform a Find Next.  This will restore incremental search for future operations.

Finally, we want to thank you all for the great feedback you have been giving us.  We are using the feedback to prioritize our work areas and we appreciate you telling us the Find pain-points. Please do continue to send us feedback on the Beta Find experience!


clip_image002Murali Krishna Hosabettu Kamalesha – Program Manager, Visual Studio Editor team

Leave a Comment
  • Please add 3 and 4 and type the answer here:
  • Post
  • Thanks for releasing the updated FindSettingsSeparator.vsix as this latest version works great.  So glad to see the find scope issue resolved!

  • Ah, yes this updated version does in fact work with VS11 Beta with updates applied. Thank you!

  • One feature I would really love is Find/Replace with wildcards. So you can replace parts of phrases without affecting the parts that can vary.

    Like mycontrol.DoSomething(1, 5, 34, 32, "abc") replaced with mycontrol.DoSomethingElse(1, 64, 28, 32, "abc"). You would specify a find string like mycontrol.DoSomething(*34, 32*) and replace string like mycontrol.DoSomethingElse(64, 28). Currently something like that would require going through every instance and replacing manually, since you don't know what the other parameters might be and you can't run a regular replace.

  • The FindSettingsSeparator worked for "Visual Studio 11 Express Beta for Windows 8"

    but I can't install it on "Visual Studio 11 Express Beta for Web". Thanks!

  • "The new Find supports .NET regular expressions"

    This is HUGE, really appreciated! Thanks!

    The only thing I would really like to have changed now is the search text being multiline (3-5 lines will do) and the same for the replacement text. I know this makes the box huge with all options unfolded, maybe this could be based on screen resolution or simply an option.

    Oh and some way to add favorites (especially useful for regex searches) would be really sweet, history is great, but it's not really a substitute.

    For inspiration perhaps have a look at the Replace dialog in UltraEdit.

  • Val: That is exactly why we have Regular Expression support! Go and look it up if this is unfamiliar to you, it's a really powerful tool - not just for search/replace in editors, but also for a lot of development scenarios.

  • Please add "CTR+/" shortcut for commenting/uncommenting ("CTR+K,CTR+C" is useless - too complex). This little change would save me and other guys tones of minutes every working day :)

  • visualstudio.uservoice.com/.../2858788-add-a-better-shortcut-for-commenting-and-uncomment

  • @Konstantin: If you prefer using a different shortcut such as Ctrl+/ you can assign it yourself in Tools/Options dialog, Environment/Keyboard page (and remove it from the current command using it, like Tools/GoToCommandLine)

  • @Alin: Is there a functionality for toggling comments in Visual Studio?

  • ..so that one shortcut key could be used for both commenting and uncommenting like it works in almost all other code editors.

  • I'm running VS 11 Beta 11.0.50323.1 QRELB

    The above patch (VS11_BETA_ONLY-FindSettingsSeparator.vsixx) announces that "The extension manifest is invalid."

  • I hate this thing. I have been using it for months and can't get used to it. I can never find which dropdown arrow does what. To make things worse - I can't get it to do search/replace with regex groups. I thought it would be fixed in RC. I guess not.

    Is there an option or registry hack to restore the old dialog by default? I know it is still there because it is the same thing that still comes up with Ctrl+Shift+F/H, but it used to be that one of these (Ctrl+F/H) brought up local search and the other did it for global solution scope...

  • Visual Studio 2012 RTM does not search project files (vcproj, vbproj) when Find or Replace in Files is invoked. My intent was to use this to make all 130 projects in my solution target v4.5 of the framework by replacing "<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>" with "<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>". Are there faster ways to do this without having to open each project property one at a time?

  • Hi Taiwo,

    You can use the Replace-in-Files dialog and change the scope to point to the folder in which these project files reside. This way, you can find and replace all occurrences in these files as desired.

    Filip,

    In RTM, we've moved the search options from the dropdown to reside next to the scope. This was done to make options visible by default and easily accessible. This will hopefully make the UI more friendly to use. In VS 2012, the Find uses .NET regular expressions. The capture group syntax in .NET regex is slightly different when compared to the POSIX syntax. I'd recommend reading about .NET regular expression substitutions (msdn.microsoft.com/.../az24scfc.aspx).

    If you need further help, have specific questions or feedback, please feel free to reach out to our find crew directly at vsfindfeedback2@microsoft.com.

    Thanks,

    Murali

Page 2 of 3 (34 items) 123