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" -> l1
Go To Definition
on symbol "dog" -> l4
Go TO Definition
on symbol "Animal" -> l1