Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show constructor declaration with Visual studio 2012?

When I hover my cursor on a function called in my code in Visual studio 2012, a small box pops up to show its declaration. How let this work for constructors?

Function(1, 2); // Hover on Function
MyClass a(1, 2); // Hover on a or MyClass or use any shortcut key
like image 452
user1899020 Avatar asked Jun 01 '26 15:06

user1899020


1 Answers

The problem is C++'s syntax for constructor calls. It works fine with normal methods because they look like method calls. Constructor calls are all mixed up with the object declaration, and when you hover over them, VS just gives you a tooltip with the object's declaration because it assumes that's what you want.

Hovering over the text gets you the same tooltip as if you had invoked the "Display Quick Info" command (Ctrl+K, Ctrl+I).

But there is also the "Display Parameter Info" command, invoked with Ctrl+Shift+Space, that will display the information you're interested in for constructors.

The trick is that you have to invoke the command with the caret inside of the parentheses. It won't work when the caret is somewhere within the identifier.

like image 186
Cody Gray Avatar answered Jun 04 '26 07:06

Cody Gray



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!