Open tgreen7 opened 4 years ago
This is the designed behavior for TS files at least.
Hand authoring d.ts
files for js files that you already have the code for is sort of an odd case. For TS projects with generated definitions, the solution is to use declaration maps so tools can map from the type definitions back to the implementation
@mjbvz
Hand authoring d.ts files for js files that you already have the code for is sort of an odd case.
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.
I think that approach makes sense @RyanCavanaugh ! Definitely wouldn't want to bog down users who were uninterested in this feature.
That being said I bet there will be quite a bit of interest from users who want this feature.
Thanks for the reply!
IMO, there are all of abstract interfaces defined in declaration files, and we should not care implementations most of the time. But we will be frustrated sometimes if we want to inspect or suspect something under the hood. Haven't you guys had the same frustrating experience and then tried searching from all project files ?
So, from a VS Code user's view, I really hope there is an option for this purpose.
P.S. declarationMap maybe a ideal solution at this point, since the lack of map files in JavaScript ecosystem, such as DefinitelyTyped
duplicate of microsoft/vscode#68782 but that was closed without fix.
Steps to Reproduce:
lib.js
test.js
cmd+click works and jumps to definition.
now add a type definition file
lib.d.ts
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.