cmd+click function name goes to type definition file instead of source
See original GitHub issueduplicate of microsoft/vscode#68782 but that was closed without fix.
- VSCode Version: 1.41.1
- OS Version: macOS 10.14.6
Steps to Reproduce:
- Create a project folder with 2 files:
lib.js
export const testMethod = (name, params) => {
params && params.age
? `hello ${name} with age: ${params.age}`
: `hello ${name}`;
};
test.js
import { testMethod } from "./lib";
testMethod("foo", { age: 3 });
cmd+click works and jumps to definition.
now add a type definition file
lib.d.ts
declare namespace MyModule {
interface IParams {
age: number;
}
function testMethod(name: string, params: IParams): string;
}
export = MyModule;
cmd+click jumps to type definition instead of source definition.
I do not think this should be the default behavior. I would expect cmd+click to bring me to the function definition.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:5 (2 by maintainers)
Top Results From Across the Web
cmd+click skip typescript definition and go to source? #68782
I'm unsure why we can CMD + click on code in JS files and it points us to the entity's assignment/definition within a...
Read more >Go to implementation instead of TypeScript declaration
Try Go to source definition. This command will try to jump to the original JavaScript implementation of a function/symbol, even for code ...
Read more >Better mapping between *.js and *.d.ts files : WEB-47153
I navigate to the index.d.ts file instead of index.js source file. Looks like Webstorm prioritizes type definition file over source file when in...
Read more >Configure your Data Set - Tableau Help
Configure your Data Set · Right-click or Cmd-click (MacOS) on the Input step to rename or remove it. · Search for fields. ·...
Read more >July 2018 (version 1.26) - Visual Studio Code
If you'd like to read these release notes online, go to Updates on ... If you are not using editor tabs, breadcrumbs show...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mjbvz
I would argue that this is actually a very frequent case, think of all the pure js libraries that have d.ts files. IMO there should be a way to jump to either the definition file or completely disregard the definition file and jump to the source code.
From an architectural perspective, this is a bit of a jump for us. If there’s a
.d.ts
file, we don’t even look for.js
and wouldn’t realize that there was another option to even go to. If we did decide this was worth investing in based on feedback, there’d need to be a separate verb so that we didn’t spend a bunch of timing trying to load JS files the user wasn’t interested in.