7

Is there a visual studio add-on to copy the full type name of the identifier under the cursor into clipboard? Please DO NOT link me to "VS 2010 - easy way to copy full type name of a class/interface?" I don't want to deal with macros; only add-ons. Thanks :)

Community
  • 1
  • 1
Jordan
  • 9,642
  • 10
  • 71
  • 141
  • You mean you have your cursor in the identifier, you've no selection and hitting Ctrl+C copies the identifier to clipboard? – Mrchief Aug 04 '11 at 21:00
  • No, that would be silly. I'm thinking more of a right click menu item to do it. – Jordan Aug 04 '11 at 21:03
  • 1
    No its not silly. By default, VS 2010 copies the whole line if you don't have any selection. I guess older versions copied word only (although my memory is vague on this). AFAIK, there is no addon/extension that does that as this becomes the non-standard behavior (compared to other IDEs). It should be an easy one to write though. – Mrchief Aug 04 '11 at 21:20
  • Similar to http://stackoverflow.com/questions/8566628/is-there-a-way-within-visual-studio-to-easily-get-qualified-type-names – David Gardiner Jul 03 '14 at 23:54
  • 1
    I asked my question first. :p – Jordan Jul 07 '14 at 12:39

1 Answers1

6

Ultimately, Visual Studio's Object Browser gets you what you want. Unfortunately, the task might be cumbersome without Resharper.

If you have Resharper, you can set up a key binding for EditorContextMenus.CodeWindow.NavigateTo.Resharper_NavigateToObjectBrowser

EditorContextMenus.CodeWindow.NavigateTo.Resharper_NavigateToObjectBrowser

To copy the full type name of a property, method, or class to the clipboard, position your cursor in the relevant spot... (for example)

enter image description here

Now press your new keyboard shortcut (CTRL+ALT-J in my example above).

enter image description here

Once in the object browser, you can press CTRL+C immediately to copy what you want to the clipboard.

Flip over to any ol' application now and press CTRL+V to paste the contents..

enter image description here

Alex Dresko
  • 5,179
  • 3
  • 37
  • 57
  • Speeking of ReSharper indeed it's faster to press [Alt] + [~], then go straight to "Object browser". – Puterdo Borato Feb 27 '15 at 08:35
  • It's now perhaps just as fast, but easier, to press ALT+ENTER, then begin typing "object browser". ALT+ENTER can do anything now. – Alex Dresko Feb 27 '15 at 12:30
  • Alex, you mean RS9, I suppose. We're still running on RS8.0 with no upgrade in foreseeable future :( – Puterdo Borato Mar 02 '15 at 10:53
  • 1
    Yes, sorry. RS9 introduced the mega ALT+ENTER feature. – Alex Dresko Mar 02 '15 at 14:39
  • This has been inoperable/broken since we moved to VS2015. I was hoping VS2015 Update 1 would fix it, or the 10.0.1 release of ReSharper, but alas, it is still broken. I have Ctrl+Alt+J mapped properly, as above, but pressing it does nothing. If anyone out there has this working in VS2015, can you chime in? Maybe I just have an errant setting preventing this from working. – sliderhouserules Dec 16 '15 at 23:24
  • @sliderhouserules This seems to work again.. at least with the current VS 2015 and R# 10 EAP. – Alex Dresko Apr 13 '16 at 19:27
  • 2
    If you have a recent ReSharper version you can use the menu option called **ReSharper/Edit/Copy Fully-qualified name/ Source browser URI to clipboard**. – emilast May 19 '17 at 09:01