Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Goto definition aliasNew to Visual Studio Code? Get it now.
Goto definition alias

Goto definition alias

Anthony Fu

|
154,542 installs
| (8) | Free
Go to definition following alias redirections
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

vscode-goto-alias

Go to Definition following alias redirections.

Visual Studio Marketplace Version


Usages

Install this extension from the VS Code Marketplace.

Set editor.gotoLocation.multipleDefinitions to goto in your VS Code settings for the best experience.

{
  "editor.gotoLocation.multipleDefinitions": "goto"
}

Motivation

For example, in Nuxt 3 or Vitesse projects, we provide auto import for APIs and components. To provide types for these auto imports, the tools will generate a .d.ts file to declare those APIs as "global" type.

// generated.d.ts
declare global {
  const autoImported: typeof import('foobar')['autoImported'] // alias to provide type from package 'foobar'
  // ...
}

With this declaration file, we could have type safety using autoImported in our code without importing it.

// no need to import
const foo = autoImported()

The only small downside is that when you use "Go to definition" in the code, the IDE will redirect you the the definition file we generated instead of the real definition source.

So, this extension is built to solve this. With this extension installed, when the "Go to definition" command hits the definition file, it will then redirect again to the definition source.

Working with Vue Components

If you find trouble redirecting auto-registed components by Nuxt 3 or unplugin-vue-components, you might want to enable the Takeover mode of Volar.

Sponsors

License

MIT License © 2022 Anthony Fu

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft