Go to Definition
What is Go to Definition?
Go to Definition: Jump to where a symbol (function, class, variable) is defined. Core to reading unfamiliar code. Go to Definition jumps from where a function, class or variable is used to where it is defined. In VS Code press F12, or hold Ctrl or Cmd and click the name. JetBrains IDEs use Ctrl+B or Cmd+B.
Frequently asked questions about Go to Definition
How is Go to Definition used in practice?
It is the most useful shortcut for reading code you did not write. Instead of searching through files, you follow the code the same way it runs, one call at a time.
What should you keep in mind with Go to Definition?
Its partners are just as useful. Go back, Alt+Left or Ctrl+-, returns to where you were. Find usages, Shift+F12 in VS Code or Alt+F7 in JetBrains, shows every place something is used, which is exactly what you need before changing or deleting it. These features rely on the editor understanding your code, so they work best with type hints and a properly configured project.
At a glance
| Category | Keyboard shortcuts |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |