Is there a way to make the Quick Find dialog wait until you hit enter to find results in Visual Studio 2015? - visual-studio

When I'm trying to search for something in the current document, I think it's really annoying that VS immediately starts trying to find a match when I've only typed a single character. The document ends up jumping all over the place, causing me to lose my spot. Is there any way to make it so VS doesn't start looking for results until I actually hit enter?

You could just use the find and replace dialog instead of quick find. ctrl+shift+F or Edit > Find And Replace > Find in Files. Then just switch the dropdown to current document. Although this creates a list that you can click through rather than navigating directly.

Related

Force Visual Studio to find from cursor

Just upgraded to VS 2019... and by default (in this and previous versions)... if I search within a document, every subsequent search I make for the same text searches relative to the previous find result... not where I reposition the cursor. I know it is possible to reset the search by moving the cursor... but how? The setting is frustratingly elusive... and not being able to rely on finding the first result after a specific point without first searching for something else, then what you actually want to find, is doubly frustrating! :-(
In this situation, unable to fight design, it might be better served to take a different way of looking/thinking and use CTRL F to do a "find all" into a search results dialog. Then instead move around the Find Locations as needed.
Otherwise you would need to cancel the initial search and restart the search after moving the cursor to the new location.

In Editor: Ctrl+F find box, config to search only on Enter?

In VS2013, I find it irritating that it jumps wildly through the current source file to places matching my incomplete entry, while I am typing - I would prefer if it did nothing at all until I completed my entry and hit Enter (and if it finds nothing, the scroll position in the file will not be changed).
I couldn't find an option under "Tools/Options..." that looks like it helps there.
Is it possible to do this?
No, there is no user setting for that, sadly.
Instead, however, consider using SHIFT CTRL+F (find in files). Not the obvious choice, but I've started to prefer it as it gets rid of the leaping about and it can anyway be useful to see the list of occurrences before losing scroll position (whether or not it finds anything).

Incremental Search vs Quick Find in Visual Studio

What is the difference between Incremental Search (Ctrl + I) and Quick Find (Ctrl + F) in Visual Studio?
as I said in the comment of mine , that's not the only reason and microsoft would not implement something like this for just being easier to use !
by the way you don't need F3 to navigate between the results in the normal find method . you can do that with hitting enter and hell yea , its easier than Ctrl+I.
You can press Ctrl-I and start to type and all occurrences of what you type get highlight throughout the document, and also added to the find buffer, so F3 then works on the typed text as-well as the normal find method.
Incremental search allows developers to search in document without blocking UI and allow to search as they type.
The very good reason to use Ctrl+I is it find the result as you type the term in the box and you don't need to hit enter or F3 to go to the first result .
How To :
To enable incremental search, just type “Ctrl + i” within the editor.
This will subtly change your cursor, and cause your status bar at the
bottom left of the IDE to change to “Incremental search: (search
term)” – you can then type the search term you are searching for and
the editor will search for it from the current source location you are
on (no dialog required).
Note that the version of Visual Studio will affect the UI differences. It seems that in older versions e.g. 2010, the find dialog was quite obtrusive, and got in the way of things and so incremental search was by comparison more streamlined. Conversely, running on Visual Studio 2015 I've found that the Find Dialog (at least the one launched by CTRL-F) is very unobtrusive, since it is embedded in the top left of the code editor. Hitting CTRL-I in fact launches a similar dialog with fewer options. Furthermore I also find with this version of VS the editor jumps to the first matching occurrence as with incremental search, so there is barely any difference in terms of how streamlined/unobtrusive one is over the other.
Assuming one is using a version of Visual Studio where the Find Dialog is embedded in the corner, the only reason I can think to use incremental search over the standard find is the fact that you can reverse search with CTRL-SHIFT-I (the alternative would be to CRTL-F to go to the next occurrence, then SHIFT-F3 to go backwards).
Long story short: it looks like the standard find has been modernised somewhat bringing it closer to the incremental search. If using VS2015 (not sure about 2017) the difference appears to be fairly negligible besides the differences in shortcuts, and so is really a matter of preference. Personally, in VS2015 I find the incremental search to be of little improvement over the standard find, and so I'll be sticking to the latter (unless I've missed something in which case I'll be glad to hear about it!)
Incremental search allows you to keep hitting Ctrl+I until you hit the end of your document. Quick Find finds the first hit, highlights every other hit but you'd need some additional keys to go the the next hit (F3 with standard keybinds).

How to begin a text selection in a Visual Studio macro

Long ago in a former editor, there was the ability to begin a macro, and then "open" the text selection...such that if your next action was to, say, search for some string - the text selection would then extend to that spot.
This was a great way to do fairly sophisticated operations without having to use wildcards or regular expressions.
Is there a similar facility in Visual Studio 2008?
Ctrl-= is the answer.
It is the 'SelectToLastGoBack' command, officially documented as "Selects from the current location in the editor back to the previous location in the navigation history". So, get the cursor where you want to begin your selection (preferably using something reliably repeatable like a search), start a new search (usually I like ctrl-I better than ctrl-F because I can see what it's doing, but ctrl-I seems to not work right in macros), have the search end where you want to end it (esc to close search box), and hit control equals to select back to where you started.
Unfortunately I can't really find anything that explains in detail how the editor decides what the previous location in navigation history is.

Is it possible to disable command input in the toolbar search box?

In the Visual Studio toolbar, you can enter commands into the search box by prefixing them with a > symbol. Is there any way to disable this? I've never used the feature, and it's slightly annoying when trying to actually search for something that you know is prefixed by greater-than in the code. It's particularly annoying when you accidentally search for "> exit" and the IDE quits (I knew there was a line in the code that was something like if(counter > exitCount) so entered that search without thinking).
At the very least, can you escape the > symbol so that you can search for it? Prefixing with ^ doesn't seem to work.
This is a really cool feature. I've poked through the feature documentation, and the accompanying command list, and not a heck of a lot is showing up in terms of turning it off.
If you want to search for >exit, you could always type >Edit.Find >exit in the search box; that seems to do the trick. A bit verbose, though, but it really is an edge case.
you can enter commands into the search box by prefixing them with a > symbol.
Wow, I didn't know that. Where do I find the list of possible commands?
I never actually use the search box, I've remapped ctrl+F to incremental search, which is usually ctrl+I
I find this much cooler than the normal search - give it a go, you might end up not caring about the search box anymore.
Wow, I didn't know that. Where do I
find the list of possible commands?
The commands are the same as those you can enter in the command window, so you can pretty much drive the entire IDE and debugger using it. There are a load of predefined aliases for common commands. Open up the command window and enter alias for a list, to get you started.

Resources