I am using VS 2010, does Visual C++ with Visual Assist provide refactor functions on finding usage of variables? I right click the variable and the find usage function is always grey out.
Find All References in the context menu is the IDE version of the command.
To use Find References from Visual Assist, try one of:
open the "Refactoring (VA)" sub-menu of the context menu
use the default shortcut Shift+Alt+F
open the Quick Refactoring Menu with Shift+Alt+Q ("refactoring" is used loosely in this instance.)
It works for me right clicking on a variable and selecting Refactor (VA) - Find References.
Related
I am having trouble finding the right-click context menu in Visual Studio 2015. I know that nothing is wrong with my project or the file I am working. I can find the right-click context refactor menu in Visual Studio 2013. However, in Visual Studio 2015 there isn't a refactor context menu in the right-click context menu.
Where did it go? How do I get it back?
Your suggestion cannot include menu Edit → Refactor.
I have tried to reset my Visual Studio settings back to default using menu Tools → Import and Export Settings and that didn't bring the menu back either.
Some of the refactoring tools have been relocated or are at least accessible in a different manner than they were previously.
Using the extract method refactor as an example, you can still use this function; it is just not done the same as before:
Right click
Quick actions
Click extract Method
I think they've changed it to feel more "ReSharper"ey. All of the functionality should still be there however.
Here's more information on refactoring in Visual Studio 2015 - hopefully this helps! Refactoring (C#)
You no longer need to access the refactoring using the mouse right click.
It is recommended that you use the keyboard shortcut keys within Visual Studio.
For all possible shortcut keys, see Default Keyboard Shortcuts in Visual Studio, Refactor.
You might need to build the project to get it to work.
See Code Editing ASP.NET Web Forms in Visual Studio 2013 | Microsoft Docs. (If it is missing then the point is that I am using an example provided by Microsoft.). In Refactoring and Renaming see To extract a method in a C# page. When I follow the instructions I cannot find the feature to extract the code to a method. When I tried the Edit menu it said I did not have valid code. Then I built the project and the feature to extract the code was available and worked.
If you change the name of the object you are refactoring, the light bulb then appears to the left which asks if you wish to change the name of the object (i.e. refactor) or generate a new constructor for the new named object.
Ctrl + . is the shortcut key for extracting a method in Visual Studio 2015 and onward.
Ctrl+M, R does not work anymore in new versions.
I was curious if there is/are tools that can be used to embed so the the function name in C# can have a link in order to jump to its definition. In this case no need to right click and select 'go to definition' or F12. I was having hard time explaining what i meant. Hope someone can understand. Thanks a lot.
Ctrl + Left Mouse Button does the trick. Just Ctrl+Click the name of the function.
(assuming you are using Visual Studio with JetBrains ReSharper plugin).
Not sure if I understand what you are after, but ReSharper from JetBrains is an incredibly powerful addin to Visual Studio.
One of the functions is a replacement of the Go to Definition function.
There is an extention in the visual studio gallery which allows Ctrl+Click Navigation
http://visualstudiogallery.msdn.microsoft.com/4b286b9c-4dd5-416b-b143-e31d36dc622b?SRC=VSIDE
I don't have ReSharper at my current gig, and I miss the "Extract Variable" refactoring. I understand that it's possible to write your own refactoring "snippet" in VS. Does anybody have one that does this?
In Visual Studio 2017, if you select something, on right-click you will find a menu option "Quick Actions and Refactorings", with shortcut ctrl+..
This seems to be somewhat similar to ReSharper's ALT+Enter.
This allows you to extract a variable, as in this example where the text was selected and then ctrl+. was pressed:
Have a look at this post, but it does not seem to be a documented feature:
Snippets For Refactoring
Browse to your "Program Files\Microsoft Visual Studio 8\VC#\Snippets\language id\Refactoring" directory and you'll find the snippets used to perform the refactoring techniques in the Refactor menu. (...) If you're going to try modifying these snippets then (...)
Another way would be a write a macro using the EnvDTE programming model. Not easy, but should be feasible.
On top of visual studio code editor, There are two drop down lists displays list of classes and members in then selected class. See the picture below. What do you call them and what are the shortcuts? So that I can navigate to methods and members using keyboard.
I am using Vs 2010
Thanks
CtrlF2Tab gets you there. Take a look at this link. Is there a hotkey in Visual Studio to open the member drop down list?
Not strictly on topic but ReSharper has a shortcut for this Alt+\
Can use Edit -> Navigate to [Ctrl + ,]. or Solution Navigator in Vs Power Tools. But I am still looking for shortcut to access it directly.
Thanks
I guess it is Edit.ExpandCollapsableBaseTypeList (or something) in the Tools-Options-Keyboard.
If that doesn't work you can always record a macro and assign a shortcut key for that.
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