Open cgringmuth opened 4 years ago
Go to definition on "foo" in "Foo * f = new foo(0);" should go to the foo constructor. We can use this issue to track adding some Go to Constuctor command for other cases where the constructor isn't explicitly invoked like a method.
Go to definition on "foo" in "Foo * f = new foo(0);" should go to the foo constructor. We can use this issue to track adding some Go to Constuctor command for other cases where the constructor isn't explicitly invoked like a method.
Yes, this case works as you mentioned because the constructor is explicitly called. However for Foo f(0);
it does not work. It could work, as cpp-tools already knows which function it can jump to. Hitting ctrl+shift+space
in the parenthesis shows all possible declarations. It even selects the correct overload if list of variables are provided.
So, I don't see a reason Go to Definition
to constructor is not working in this case. I would like to introduce this myself. However I don't have a clue where to start. So, I probably would need ages to implement it. But for experienced people it is probably easy to fix, as all the necessary information is already available.
Besides, hitting F12
on the variable definition does nothing in this case. In some cases it shows all references to the symbol which is a bit wired because then F12
has multiple meanings then. shift+F12
is the shortcut for showing all references.
The code is in our closed source cpptools/cpptools-srv. I've filed a feature request on VS at https://developercommunity.visualstudio.com/idea/1226131/enable-cc-intellisense-go-to-definition-on-class-i.html -- there might be a shared implementation we could leverage. It's not a trivial thing to add. The ctrl+shift+space is invoking signature help.
This feature request has received enough votes to be added to our backlog.
Hi, I was not able to find any documentation about this. Is it possible to jump to the constructor of a class? I tried several ways,
F12
andCtrl
+Click
on variable, on Classname (before variable), on parenthesis, inside of parenthesis. Nothing worked.Everything else works quite well. I was just wondering if there is an option to jump to correct constructor of the class. Current workaround: Jump to definition of class and search for (correct if it has overloads) constructor.