I noticed VSCode has the following
I'm a bit confused as to how these work, sometimes they even open up a peek definition. Can someone please provide a practical example on the usages of this. I found the following Difference between Goto Definition and Goto Implementation in Visual Studio but its lacking goto type definition.
Well, go to type definition does exactly what it says.
VS Code documentation provides us all that info:
Go to Type Definition
Some languages also support jumping to the type definition of a symbol by running the Go to Type Definition command from either the editor context menu or the Command Palette. This will take you to the definition of the type of a symbol. The command editor.action.goToTypeDefinition is not bound to a keyboard shortcut by default but you can add your own custom keybinding.
Regarding your questions:
sometimes they even open up a peek definition
It shows peek definition popup window when it found more than one candidate, and leave to you choose where to jump.
I'm a bit confused as to how these work
These terms have meaning for some languages, such as C#, and full support of VS Code. In other languages, such as Ruby, despite having Interfaces, VS Code seems have no support for Go To Implementation
for example. Then you have JavaScript, which does not have Interfaces, in this case Go To Implementation
routes to Go To Definition
.
Can someone please provide a practical example on the usages of this.
You already have Go To Implementation
and Go To Definition
, here it goes Go To Type Definition
(since it's been a while I haven't coded this type of language, I may be wrong in some detail):
1: class Animal
2: end
3:
4: Animal dog = new Animal();
In line 4
:
Go To Type Definition
on symbol "dog" -> l1Go To Definition
on symbol "dog" -> l4Go TO Definition
on symbol "Animal" -> l1If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With