How to include special characters when selecting text in the Visual Studio editor - visual-studio

I've recently started following the recommendation to use $ as the first character in the name of all jQuery variables, so it's easy to differentiate them from normal JavaScript variables.
Unfortunately the JS editor in Visual Studio 2010 doesn't pick up the $ when I double-click to select a word, or when searching for "whole word".
I know some text editors (Textpad, for example) allow you to tweak which characters are included in words. Is there any way to control this in Visual Studio?

This doesn't really answer the question, but the problem has gone away as the $ symbol is included automatically in VS 2012 and beyond.

Related

Copying code from Visual Studio to Microsoft Word or to StackOverflow is indented too far to the right

Whenever I copy code from Visual Studio 2010 to anywhere like Stack Overflow or into a Microsoft Word document or into the editor in Outlook, except for the first line of code, the rest of all the code is indented so far to the right and I have to constantly remove the tabs in each line before posting.
How do I get around this? There surely is a Visual Studio setting in the Edit menu that I have forgotten to use over the years.
UPDATE
In response to Akshay's answer, it appears that I already have that set to "Insert Spaces." Please see picture attached.
There is an option to replace tabs with a fixed number of spaces. In Visual Studio, go to Tools -> Options -> Text Editor
Then choose the language you want to modify, or "All Languages" and select the "Tabs" option. This will let you replace tabs with the desired number of spaces.
The Visual Studio Extension Copy for review may help you (only for Visual Studio 2013 currently, however.)
It currently supports two output formats, both removing leading whitespace, while keeping the indentation as much as possible. Thus, this may improve your experience, together with the tip from Akshay.
Disclosure: I am the author of that Extension. Please notfiy me, if I can improve it to your needs.

How to make word wrap respect indentation in Visual Studio?

Visual Studio has a word wrap feature, but frustratingly it ignores line indents, making the text hard to read. Other text editors (Notepad++, Sublime Text) simulate the indentation of wrapped lines, making code easier to read
How can I make Visual Studio 2012 wrap lines intelligently? Smartly?
See in Notepad++, 'of beer' is wrapped appearing in line with Console
Where as in Visual Studio, 'bottles of beer' juts out into the indentation, making the code shape hard to read.
Good news: In Visual Studio 2013, word wrap properly respects indents!
However there's a number of remaining issues with it (eg. around the Home/End keys). Please vote at https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/5574507-fix-behaviour-of-home-end-keys-when-word-wrap-is-e
Alas, it's not possible. Bug to the Visual Studio developers at http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3285423-wrap-lines-intelligently-simulating-indents- . Please vote for it!
This extension does what I want, but only for Visual Studio 2010 :/
http://visualstudiogallery.msdn.microsoft.com/ac95f80f-6cfd-4b67-b0fd-e9c5c8fb27de
NB. I tried hacking the extension manifest to make it install on 2012 but the behaviour went awry. The extension needs a real update
For VS2012, there is an extension
http://visualstudiogallery.msdn.microsoft.com/a5b5001e-fe7a-4c08-9cf5-96ae5892088a
It does the same thing...

Highlight all occurrences of a selected object with ReSharper

I was used to use RockScroll (or MetalScroll), but when I started to use ReSharper my RockScroll start to show some bugs. Well, this is scope to another discussion https://stackoverflow.com/questions/1089493/is-rockscroll-compatible-with-resharper.
But my problem is related, because now without MetalScroll I can't highlight all occurrences, what I consider very useful in many situations.
Someone have another plugin for VS2010 or for ReSharper that do the same or better?
I think you are looking for "Highlight usages in file" This can be access via Shift+Alt+F11 or Ctrl+Shift+F7 depending if you are using VS key bindings or InteliJ bindings. Use either Ctrl+Alt+Up/Down or Ctrl+Alt+PageUp/PageDown to go to next and previous highlights.
You can also use the Ctrl+Alt+G combo to bring up a menu of what to jump to. This can be used to move the cursor to the next occurrence.
You should try Productivity Power Tools for Visual Studio 2010. There are other versions, at least one for Visual Studio 2013 and another one for Visual Studio 2015.
It plays nicely with ReSharper and has this selected text matches highlighting both in the editor and the scrollbars among many other features.
Try the visual studio extension RockMargin which highlight the occurrences on double click (like most IDEs). Works fine with VS 2015 and ReSharper.

Highlight all references to X?

The Eclipse IDE has a neat little feature that I really miss in Visual Studio.
If I place the cursor on a variable or method name, the IDE will automatically highlight all references to it in the current document within the relevant scope.
I can't seem to find an option to turn on similar behaviour in VS2008 or Resharper 4. I know VS has a Find Usages function, but I'd like to do it automatically on the fly.
Does anyone know of a free addin which will add this functionality?
If you're using ReSharper, you can highlight the usages in the file with Shift-Alt-F11. Place your cursor on the variable you want to find usages of, and press the Shift-Alt-F11 combination.
There is an add-in for Visual Studio that will do something similar called RockScroll.
When you double click on something, it will highlight all occurrences of the item you double clicked. It also changes the vertical scrollbar to a "syntax highlighted thumbnail view" showing an overview of where the item occurs in the file.
I know you mentioned ReSharper, but CodeRush has a nice references window that you can dock and let it search for things on-the-fly or on demand. As a bonus, you can select each usage and it will show you the context surrounding the usage. It also works for methods.
I mentioned CodeRush since they have an express edition, which looks like it includes that feature, but I haven't tried that edition.
Visual Studio 2010 has sorta implemented this, but the feature is somewhat lacking. There is a non-configurable delay between placing the cursor and highlighting.
The RockScroll Addin is not available for Visual Studio 2010 and above.
As a replacement, the free "Highlight all occurrences of selected word" plugin will highlight all occurences of the selected string after a doubleclick. There is no delay as with the native vs2010 highlighter.
It is string-based, which means it works inside comments and string literals.
Microsoft published a tool that sort of does what you want.
Some of my favourite features:
Enhanced Scrollbar
Auto Brace Completion
Ctrl + Click Go To Definition
Open Containing Folder
and the list goes on.
For Visual Studio 2010 and for Visual Studio 2012

Keyword highlighting on selection in Visual Studio 2008

A little while ago I managed to get Visual Studio 2008 (C++) into a state where, if I would select a keyword (or any symbol for that matter), by either double clicking on it or highlighting it, all other instances of that symbol within the current file would become highlighted too.
This was a really useful feature.
Since then it's gone away, and I don't know how to get it back.
Please help.
#Sander - that'll be it. Thanks!
I think you've installed RockScroll. It also lights them up in the graphical scrollbar (its main feature)
I use MetalScroll, it's like RockScroll only better; it doesn't interfere with Resharper (a VS must-have) and you can set it up to only highlight if you hold down 'alt' when you double-click.
There is something called "WordLight" by Mikhail Nasyrov.
An add-in for Visual Studio 2008 that highlights all occurrences of a selected text.
It searches and highlights substrings that are currently selected in a text editor.
Can be found at below link
WordLight
https://marketplace.visualstudio.com/items?itemName=MikhailNasyrov.WordLight

Resources