Enable Go to Implementation in Typescript Editors
Could you provide a way for Typescript Editors to list the implementations of a type? This would definitely help developer productivity to be able to find implementations of types faster.
For example, in the Atom Editor atom-typescript plugin you can press F12 to 'Go to Declaration' which as currently implemented you often arrive at the typescript .d.ts file which has the function signature but not the actual implementation.
Since the Typescript parser often generates the d.ts files from the .ts implementation files. Could that association between the d.ts and .ts files be preserved (perhaps output with a typescript compiler option) so that Typescript editors could take developers to a list of the implementing classes or functions?
I opened a similar request for the Atom-typescript editor, but they indicate that they cannot implement this without Typescript parser support: TypeStrong/atom-typescript#790
This is really crucial. I want simple thing: CTLR+Click and navigate to node_modules/library/source.js or source.ts file. Opensource project with 60 node_modules dependencies and you are back to using notepad with explorer.
When I right-clicked on a component I saw: "Go to Definition" and "Go to Type Definition". I thought "Great, this has been well designed, the solution to my problem is just here!". Then I clicked on "Go to Definition" and... landed to the Type Definition.
This is really crucial. I want simple thing: CTLR+Click and navigate to node_modules/library/source.js or source.ts file. Opensource project with 60 node_modules dependencies and you are back to using notepad with explorer.
+1 Same need.
With all due respect, the fact that this isn't implemented is incredible. Such a basic, relatively easy to build feature that would save people tons of time.
With all due respect, the fact that this isn't implemented is incredible. Such a basic, relatively easy to build feature that would save people tons of time.
+1
Well, in the meantime when this feature is not yet available, is there any better workaround beside searching for the whole node_modules ? It really inconvenience...
For example, I go to the definition and it led me to node_modules/@com.abc/sample/lib/core/internal/abc.d.ts when the one I want is actually located at node_modules/@com.abc/sample/src/core/internal/abc.ts
@Happin3ss
is there any better workaround beside searching for the whole node_modules ?
The current solution AFAIK is declaration maps. These are sourcemaps that map .d.ts files to the corresponding TS source. If you can convince the libraries that you depend on to implement declaration maps (which I think effectively requires publishing .d.ts inside the library package as opposed to relying on @types) then you'll be able to automatically jump from your client code to the original TS (or even JS if using the TS compiler on JS?) source code.
What I've been doing is gradually filing PRs against my most important dependencies (at least the ones that are authored in TS) to get them to add declaration maps.
Obviously it'd be better if changing the library weren't required.
Another workaround (if changing the library isn't possible) works in the case where the library bundles .d.ts inside the package but doesn't have declaration maps. In that case, I'll use Go To Definition to get to the type declaration, then I'll click the Explorer button in VSCode to show the folder sidebar. That usually gets me very close to the src folder for the package, so instead of having to search through all of node_modules, I can just browse into the right folder and open the correct file. This is dependent on clear file naming, etc. and is not a panacea.
Just to be 100% clear-- I'd love to see a better solution for libraries, esp. those where .d.ts is authored separately from the package.
Not sure if I've missed it, but it would be really useful for understanding what's happening to have actual minimal examples of sources, declarations and declaration maps. I've never seen either Go to Definition, Go to Type Definition, or Go to Implementations actually go to anything but a .d.ts file for transpiled TS. I just tried to make a simple example, and it doesn't work; I can't get VS Code to go to anything but the .d.ts file, even though the .d.ts.map is next to it. I've also found someone else with the same issue who was ignored.
It's understandable that supporting external typings like @types would be hard, but what does it say that even the "happy path" can't be made to work?
There are many libraries that generate declaration files but not declaration maps, and it's unclear what the argument would be for enabling them. This option has been added without a clear explanation, at least one that I'd be able to find.
Yes, I confirm that declaration maps are not solving the problem. My project has got declaration maps but vscode does not navigate beyond .d.ts files.
It sure would be great if this happened.
if there is an "elephant in the room" of issues for ms vscode devs, this is it.
Any updates on this one? I just decided to make a big step: move from JS to TS. I thought - "what am I doing wrong?" but actually, it's unexpected behavior of VSCode
Any updates on this one? I just decided to make a big step: move from JS to TS. I thought - "what am I doing wrong?" but actually, it's unexpected behavior of VSCode
It was a long history since this behavior had been raised. Well, nothing going on here. No plan so far. For me, I keep using vscode as a kind of editor as it is, and Intellij products (IDEA) for my coding stuffs even I don't like it so much.
Opened for 5 years, hope it will be fixed in 2025
I've created failing tests in #39426 but I don't know how to implement it
Just another miserable comment from ts dev going through hell everyday to find definitions
This is crazy... I thought I was just a TS noob, but now I see that the behavior I’m getting is actually “standard”???? So frustrating, every other IDE/language I’ve used has this implemented at initial release... :( I love VS code but honesty this could be a deal breaker
Can anyone explain why go to definition/implementation features in VSCode with Python extensions for, huh, Python language works better (it's works at least) then for JS having native built-in solutions?
So what is going on? I am using scss.d.ts for css modules and can't jump to scss.
Also when creating simple .js and accordingly d.ts, I cannot jump straight to js
why not use webstorm? it can solve this problem!!! my version 2020.1