如何在VSCode中为未导入的隔离模块添加跳转链接?
Solution for VSCode JSDoc Links to Unimported Isolated Modules
To make @see links jump to your own isolated modules without importing them, you need to use module-specific path references instead of generic module: prefixes. Here's how to fix it:
1. Use Relative or Absolute Module Paths in @link
Point directly to the module file containing the symbol, appending #SymbolName for named exports:
/** * @Component - main Renderer * @see {@link ./path/to/SystemRenderer#SystemRenderer} * @see {@link ../systems/SystemRenderer} // If it's the default export */
- Replace
./path/to/with the actual relative path from the current file to the SystemRenderer module. - The
#suffix targets a named export (like a class or function) inside the module. Omit it if SystemRenderer is the default export of the file.
2. Use Module Aliases (Cleaner for Large Projects)
If your project uses TypeScript or has a module resolver configured, set up aliases in tsconfig.json (or jsconfig.json for JS projects) to shorten paths:
{ "compilerOptions": { "baseUrl": "./src", "paths": { "@SYSTEMS/*": ["systems/*"] } } }
Then reference the alias in your JSDoc:
/** * @Component - main Renderer * @see {@link @SYSTEMS/SystemRenderer#SystemRenderer} */
VSCode will resolve the alias using your config, linking directly to your project's module instead of global Node modules.
Key Notes
- Avoid
module:SystemRenderer— this prefix is reserved for Node.js core modules and global packages, which is why it’s pointing to the wrong place. - Ensure VSCode is using your project’s
tsconfig.json/jsconfig.json(check the bottom-right corner of the editor to confirm).
内容的提问来源于stack exchange,提问作者jon
相关产品推荐
相关产品推荐

