Notepad++ like search highlighting in VisualStudio - visual-studio

Notepad++ has a neat feature that combines search and highlighting. When you select a word, it is highlighted wherever else it shows up on the page, so it is an implicit search, which I find very very useful.
Is there a way to get that into VS?
I would also be interested in having these highlightings stick so that I can highlight more than one keyword (using different bgcolor of course), and even have all these keywords get highlighted automatically on the newer pages I open after making them stick. Now that would be really cool!

Check out this question and the related answers:
How to highlight occurrences of a search term in text in Visual Studio?

Visual Studio 2010 will introduce a feature called "Highlight References" for symbols in C# and Visual Basic and it will behave as you describe. The "sticky" highlight however is not supported yet (in 2010).

The same feature is also available in Eclipse. Very useful.

Sara Ford has a post on her blog about making a custom editor. Might be a good starting point for investigating writing your own addin or editor for achieving your goal.
http://blogs.msdn.com/saraford/archive/2006/08/09/693548.aspx

Related

"in-line find" plug-in for Visual Studio

Is there a plug-in (or built-in feature) for Visual Studio 2008 to be able to do a quick in-line find in your code?
I am unhappy with the find feature (Ctrl+F). I don't like how it pops up in its own window. I think it would be much better if it was more like the Firefox find. (Try Ctrl+F in Firefox). I like how you start typing and it instantly tries to match what you're typing. Often you don't have to type your full search term before you find what you want.
I am use to FlashDevelop, and think they have good some great search functionality. you can just selected a word in your code and tap F3. It will instantly select the next occurrence of that string.
So is there anything out there with this sort of functionality?
Type Ctrl+I. This is the "inline find" version you want.
Ctrl+F3 will start a search for the word that the caret is in (without displaying the Find dialog). Subsequent presses of F3 will continue the search forward. Shift+Ctrl+F3 will search backwards. The whole word and case sensitive options of the Ctrl+F Find dialog are used during Ctrl+F3.
You already got your answer from 1800 INFORMATION, but I figured you might find this one interesting as well:
Favorite Visual Studio keyboard
shortcuts
A good amount of Visual Studio keyboard goodness.

ViM-like search highlight in Visual Studio possible?

ViM has this option hlsearch where a searched string is displayed in highlight mode at all places in the file it is found. Is there a way to do the same in Visual Studio?
That is, if I search for "foobar", then all the foobar in the file are shown highlighted and this display remains until my next search. I find this very useful to see the places in a function where a certain variable is used (without having to manually search for the next appearance of that string).
I am aware of the Visual Studio Task List which can be used to look up strings like TODO. I hope the reader realizes that this is not a good fit for my problem which is more general text search and highlight.
If you like vim and are using Visual Studio you may want to check out Viemu.
The hlsearch Feature is of course included.
Example Picture:
Viemu hlsearch http://dklein.taunus.de/viemuhlsearch.png
With best regards.
Visual Assist X does this, along with something akin to light-symbol-mode. Among other things, of course.
Visual Studio 2010 now supports Reference Highlighting. Click on or move the cursor to any symbol such as names of variables, classes, methods, properties, etc. and it will highlight all other references in the file. It also allows you to navigate between the references using:
ctrl+shift+down arrow or ctrl+shift+up arrow
I use the RockScroll add-in. It has multiple features, one of them is that if you double click on a word it will be highlighted everywhere in the file. This is very similar to what you describe. It is free (as in beer).
If you happen to really like Vim, you might want to look into ViEmu for Visual Studio . I'm just a really happy user of it :)

Visual Studio: Is there an incremental search for the entire solution?

I am very fond of the keyboard shortcuts built into Visual Studio. One of my favorites is Ctrl+i, which triggers the incremental search. It jumps over the text in the current document as I fill in the searchword. After the desired searchword is typed, I use F3 to jump through the matches.
It works fine, except that is is limited to searching in the current document. Also, triggering incremental search, automatically changes the Look In option in the Find And Replace dialog to Current Document.
Is there an incremental search for the entire solution? Is there a keyboard shortcut for it? Or at the very least is there a way to prevent an usage of incremental search from changing the Look In option?
I use Ctrl-Shift-F which is Find in Files. Once I get a list of results, you can hit F8 and Shift-F8 to cycle through them. Ctrl-I does not affect the scope of this search.
Also, after you've found your first match with Ctrl-I, you don't have to hit F3, you can just hit Ctrl-I and Ctrl-Shift-I to cycle through the matches.
In addition, a quick way to jump to a specific file or class is to use something like SonicFileFinder
ReSharper has some really nice navigation and search features, including an incremental Go To Type search which works across the whole solution.
Visual Sidekick performs incremental search over the whole solution. You can search for file names and for symbols names as well. This tool has been a huge time saver for the C++ development we do. It is ridiculous that Visual Sidekick works better than Visual Studio's own IntelliSense. It hasn't been updated in a while though and doesn't support Visual Studio 2010 yet. ReSharper doesn't seem to support C++ though.
Visual Assist X supports many languages (C++, C#, VB, ASP/ASP.NET, HTML, XML, JavaScript, VBScript, XAML) but it offers a lot of refactoring tools that usually don't work with C++ (e.g. Find References) because C++ is so difficult to parse (macros, templates, etc).

Visual Studio identical token highlighting

I coded a Mancala game in Java for a college class this past spring, and I used the Eclipse IDE to write it. One of the great (and fairly simple) visual aids in Eclipse is if you select a particular token, say a declared variable, then the IDE will automatically highlight all other references to that token on your screen. Notepad++, my preferred Notepad replacement, also does this.
Another neat and similar feature in Eclipse was the vertical "error bar" to the right of your code (not sure what to call it). It display little red boxes for all of the syntax errors in your document, yellow boxes for warnings like "variable declared but not used", and if you select a word, boxes appear in the bar for each occurrence of the word in the document.
A screenshot of these features in action:
After a half hour of searching, I've determined that Visual Studio cannot do this on its own, so my question is: does anyone know of any add-ins for 2005 or 2008 that can provide either one of the aforementioned features?
Being able to highlight the current line your cursor is on would be nice too. I believe the add-in ReSharper can do this, but I'd prefer to use a free add-in rather than purchase one.
There is a RockScroll alternative called MetalScroll which is essentially the same thing with a few tweaks and improvements.
Also there is a small and simple WordLight plug-in that only highlights the identical tokens.
Both are open source and support code folding which is nice.
Imho, the bar next to the scroll bar in Eclipse is a lot more elegant solution than the scroll bar replacement of RockScroll/MetalScroll. Unfortunately I couldn't find any VS plug-ins that do it the Eclipse way, so I just stick with WordLight.
Check following addins
Productivity Power Tools- Displays error in scrollbar and
Highlight selected word
In a different question on SO (link), someone mentioned the VS 2005 / VS 2008 add-in "RockScroll". It seems to provide the "error bar" feature I was inquiring about in my question above.
RockScroll
EDIT: RockScroll also does the identical token highlighting that I was looking for! Great!
Old question but... Visual Studio 2010 has this feature built-in, at last.
The highlight functionality is conveniently implemented in VisualAssist.
In my opinion, they are both must-have.
1) Highlight identifier under editing caret:
Options -> Advanced -> Refactoring -> Automatically highlight references to symbol under cursor
2) Highlight search result - in all windows. Works for RegExps!
Options -> Advanced -> Display -> Highlight find results
About RockScroll: It doesn't highlight the identifiers. It only highlights the same string in the source code! If there are similar identifier declared : ex. _test and test, and test is highlighted it will highlight the string "test" in variable _test too! And it will also highlight the same string in a method called "sometesting()". So it isn't exactly like eclipse and doesn't work for me.
The automatic highlight is implemented in Visual Assist as the refactoring command "Find References". It highlights all occurences of a given variable or method, but that's not automatic (binded to a keyboard shortcut on my computer).
Here is an exmaple:
DevExpress CodeRush does this when you press TAB when the cursor is in an identifier, you can then tab through all the highlighted instances. There's also a DXCore plugin (the foundation upon which CodeRush/Refactor Pro are built) that does current-line highlighting.
In VS 2017, this can be solved by installing the Match Margin plugin.
It appears to be part of the Productivity Power Tools (which might be worth looking at for other features), but surprisingly, installing PPT didn't solve the problem for me, I had to install Match Margin separately.
The "error bar" functionality is provided in JetBrains ReSharper. I'm not sure if it does highlighting of references to the currently selected identifier.
For selected word(s) highlight function only, there is also StickyHighlight.
StickyHighlight supports Visual Studio 2010 & 2012.

Plugin for Visual Studio to Mimic Eclipse's "Open Type" or "Open Resource" Keyboard Access

If you've ever used Eclipse, you've probably noticed the great keyboard shortcuts that let you hit a shortcut key combination, then just type the first few characters of a function, class, filename, etc. It's even smart enough to put open files first in the list.
I'm looking for a similar functionality for Visual Studio 2008. I know there's a findfiles plugin on codeproject, but that one is buggy and a little weird, and doesn't give me access to functions or classes.
Vs11 (maybe 2010 had it too) has the Navigate To... functionality which (on my machine) has the Ctrl+, shortcut.
By the way it understands capitals as camelcase-shortucts (eclipse does so too). For instance type HH to get HtmlHelper.
This isn't exactly the same as Eclipse from your description, but Visual Studio has some similar features out of the box (I've never used Visual Assist X, but it does sound interesting).
The Find ComboBox in the toolbar ends up being a sort of "Visual Studio command line". You can press Ctrl+/ (by default) to set focus there, and Visual Studio will insert an ">" at the beginning of the text (indicating that you want to enter a command instead of search). It even auto-completes as you type, helping you to find commands.
Anyway, to open a file from there, type "open <filename>". It will display any matching files in the drop down as you type (it pulls the list of files from the currently open solution).
To quickly navigate to a function, in the code editor press Ctrl+I to start an incremental search. Then just start typing until you find what you are looking for. Press Escape to cancel the search, or F3 to search again using the same query. As you are typing in the search query, the status bar in the lower left corner will contain what Visual Studio is searching for. Granted, this won't search across multiple files (I've never used Eclipse much, but that sounds like what it does from your description), but hopefully it will help you at least a little bit.
If anyone stumbles upon this thread:
There's a free plugin (created by me) for Visual Studio 2008 that mimics the Eclipse Ctrl+Shift+R Open Resource dialog (note, not the Open Type dialog). It works with any language and/or project type.
You can find it at Visual Studio Gallery.
Some of the neat features are available in Visual Assist X, though not all of them. I've asked on their forums, but they haven't appeared as yet. VAX gets updated regularly on a rough 4 week period for bug fixes and a new feature every couple of months.
If you are looking for an add-in like this to quickly navigate to source files in your project:
try the Visual Studio 2005/2008 add-in SonicFileFinder.
Resharper does this with the Ctrl-N keyword. Unfortunately it doesn't come for free.
Visual Studio doesn't have anything like this feature beyond Find.
Found this thread while searching for Eclipse's Ctrl+Shift+R, and after seeing the Visual Studio Gallery, found the DPack Tools (they are free, and no, I'm not endorsed in any way by them).
But it's exactly what I was searching:
- Alt+U -> File Browser (a la Eclipse Ctrl+Shift+R)
- Alt+M -> Code Browser (Method list in the actual class)
It has more features, but I'm happy with these ones.
I have been using biterScripting along with Visual Studio to do more flexible searching and manipulation.
It can search the entire workspace.
It can search within any project - EVEN IF THAT PROJECT IS NOT LOADED OR EVEN PART OF A WORKSPACE.
It can find things using regular expressions.
AND, ABOVE ALL, it can make bulk changes. For example, want to change the name of a class from CCustomer to CUser, I can do it in just a few command lines - Actually, I have written scripts for things like this I do often. I DON'T HAVE TO CLICK ON EACH INSTANCE AND MANUALLY DO THE CHANGE.
And, it is inexpensive ($0). I downloaded it from http://www.biterscripting.com .
I'm also comming from the Java Development side and was looking for the CTRL+T feature in the Visual Studio. The other answers refer to open file, but since in C# the class name and file name can be different this is not what i was looking for.
With the Class View or the Object Browser you can search for Objects and Classes
[View]->[Class View] or [View]->[Object]

Resources