Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse "Copy Qualified Name" function in Visual Studio?

In Eclipse (for Java) I got used to the function Copy Qualified Name available in the context menu of the code window, which copied the fully qualified name of a type or method under the cursor into the clipboard. After switching to Visual Studio I am unable find an equivalent of this useful tool.

Is there a Copy Qualified Name function somewhere in Visual Studio? (Or is it in some plugin?)

If not, is there at least a good workaround which does not require a successful build and launch of my application nor forces me to manually re-type a qualified name visible somewhere on the screen?

I'm currently using VS 2012 Pro and need this in a Visual Basic project.

like image 296
miroxlav Avatar asked Aug 27 '13 20:08

miroxlav


People also ask

What is copy qualified name?

"Copy" will literally copy the object you have selected and "Copy Qualified Name" will copy the name of the object including the package or path information of the element you are coping.

What is a qualified method name in Java?

A qualified name consists of a name, a " . " token, and an identifier. In determining the meaning of a name (§6.5), the Java language takes into account the context in which the name appears. It distinguishes among contexts where a name must denote (refer to) a package (§6.5.


6 Answers

The latest version of ReSharper includes the ReSharper_CopyFqn command, which will copy a fully-qualified type name to the clipboard for the currently selected symbol.

like image 153
David Gardiner Avatar answered Oct 01 '22 18:10

David Gardiner


Not sure if this will be convenient enough for you, but you can choose View menu item and open the Class view window (Ctrl+W,C or Ctrl+Shift+C short cut - probably depends on the settings). There you can select a class or a method and pressing Ctrl+C (or choosing Copy from context menu) gives you the fully qualified name in the clipboard.

like image 26
BartoszKP Avatar answered Oct 01 '22 18:10

BartoszKP


I'm not sure if this still needed, but I just published extension to copy qualified name in Visual studio, you can find it here: https://visualstudiogallery.msdn.microsoft.com/f15022a5-aec4-44e7-a51d-6c24df3b55e0

like image 23
vmg Avatar answered Oct 01 '22 16:10

vmg


My own answer to my question:

Quite a long time I was using the command in answer I got for this question. Too bad that the Visual Studio command given in accepted answer is:

  • relatively hard to reach - lack of Class View pane synchronization requires further navigation
  • not included in list of commands in the Visual Studio - no keyboard shortcut can be attached to the command

Few weeks ago I asked author of Supercharger Visual Studio plugin to add the functionality in there and he found it useful and added it. This is now quite comfortable way to get the fully qualified name. The view is similar to original Class View pane, but is synchronized with current location in code, so finding desired member is painless, compared to procedure in original Class View pane. Here's an image of open context menu on sample SortedLines property:

enter image description here

like image 39
miroxlav Avatar answered Oct 01 '22 17:10

miroxlav


I'm using ReSharper Ultimate 2017.3.2, where you can select "ReSharper" > "Edit" > "Copy XML-Doc ID to Clipboard": enter image description here

The copied string looks like this:

M:EnEffCoWeb.Chart.ColorPickerTemplate.InstantiateIn(System.Web.UI.Control)
like image 43
Kim Homann Avatar answered Oct 01 '22 18:10

Kim Homann


Update from 2022: In ReSharper, ReSharper_CopyFqn is now "Copy code reference to clipboard"

The shortcut is Ctrl+Alt+Shift+C:

When you need to log or share the context of the current location, such as the name of the symbol under the caret or its XML-documentation ID, the path to the file or the VCS path, you can press Ctrl+Alt+Shift+C and copy the desired reference from a popup

like image 41
David Avatar answered Oct 01 '22 16:10

David