Eclipse “Copy Qualified Name” function in Visual S

2020-04-02 04:22发布

问题:

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.

回答1:

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.



回答2:

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.



回答3:

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



回答4:

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:



回答5:

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

The copied string looks like this:

M:EnEffCoWeb.Chart.ColorPickerTemplate.InstantiateIn(System.Web.UI.Control)