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
why not use webstorm? it can solve this problem!!! my version 2020.1
Because it's not open-source solution and not free
Please fix this.
It's absolutely clear, that this problem can be fixed only if some manager from Microsoft takes over, this problem has to be managed and coordinated, a manager develops a workflow and assigns work to coders. ☝ This problem has to be sent to the management to take over and they decide how it will be implemented. So if is here somebody competent from Microsoft, he can give a shot. 😊
+1, the absence of this feature makes it very difficult to be productive in a Typescript codebase. VS Code provides "Go to definition", "go to type definition", and "go to implementations". Currently, all three do what I expect from "go to type definition", and none of them go to the implementation.
Can it be fixed in 2021 ?
Can it be fixed in 2021 ?
Based on my 4+ years experience following this issue, NO My suggestion for you again, is change your IDE to Jetbrains's if that feature is essential for you (like what I did). Otherwise, just accept it as it's the down side for a free and opens source product 😄 Your voice is listened, but not always.
I'm joining the party. Maybe in this case noise and jokes on GitHub are okay.
Any workarounds to go to implementation and not type apart from manually navigating or project wide search?
Today, I got the latest VsCode update and it has become a bigger problem. Now, When I do Go To Definition on a React Component, it goes to node_modules\@types\react\index.d.ts:547 for EVERY component.
I'm switching editors for typescript if this won't be fixed soon. This feature is highly needed, I use it hundreds of times per day.
Edit: It seems to be a tradeoff, now it does go to definition instead of type definition with objects and if you go to definition on the import of a component, it does show the implementation instead of the type. So it's still workable but it also still needs more improvement.
Today, I got the latest VsCode update and it has become a bigger problem. Now, When I do Go To Definition on a React Component, it goes to
node_modules\@types\react\index.d.ts:547for EVERY component.I'm switching editors for typescript if this won't be fixed soon. This feature is highly needed, I use it hundreds of times per day.
Edit: It seems to be a tradeoff, now it does go to definition instead of type definition with objects and if you go to definition on the import of a component, it does show the implementation instead of the type. So it's still workable but it also still needs more improvement.
yes is VERY ANNOYING, i want to go to component declaration and not the type definitions vscode older version was working
@ThaJay I'm seeing this one as well, was kind of annoying and strange. The thing that's most disappointing is that it worked great for many months.
I wonder if there is any way to tweak things in settings to get this to work? cc @gino8080
One workaround I found is to do CMD + F12 instead, which will go right to the implementation.
Today, I got the latest VsCode update and it has become a bigger problem. Now, When I do Go To Definition on a React Component, it goes to
node_modules\@types\react\index.d.ts:547for EVERY component.I'm switching editors for typescript if this won't be fixed soon. This feature is highly needed, I use it hundreds of times per day.
Edit: It seems to be a tradeoff, now it does go to definition instead of type definition with objects and if you go to definition on the import of a component, it does show the implementation instead of the type. So it's still workable but it also still needs more improvement.
Did you manage to find a way to go to proper definition? I'm using react and whatever piece of imported code I try to get the definition of, it no matter what sends me to node_modules\@types\react\index.d.ts.
@wtfzambo I use goto definition on a variable that is not in JSX and it works most of the time (like the import statement or somewhere else in the file). But clicking a component name in a JSX part leads me to node_modules\@types\react\index.d.ts
@ThaJay ah crap, nvm then, I have everything in JSX so I guess I'm out of luck for the time being >.<
@ThaJay @wtfzambo Just click on the component once in the editor, then press CMD + F12. Best workaround for the time being.
@andrewmartin I tried that, but it still sends me to index.d.ts. See:

==>
But then at this point I'm thinking I am not fully understanding how this whole thing works, since coming from python, if I F12 upon anything I'd just get sent to the source code of whatever I'm using.
The one of must have features of each IDE is 6 year in backlog still?
@andrewmartin Thank you, I understand now.
Nice that it has been fixed. On to the actual question then, I want to set my ctrl+click gesture to goto actual implementation and ctrl+f12 shortcut to goto type definition.
There does not seem to be an option to change the command for the ctrl+click gesture.
btw, it may not be the most correct, but going to the prop type / interface would be a lot more useful than going to the component type in this case. I do believe that's what happened before the recent update.
@wtfzambo it looks to me like you're trying to go to the definition of a <div> element. <div> comes from React. Try putting your cursor on the word <Navbar /> in the consumer (wherever you use Navbar in your app), then press CMD + F12.
@Zx-EvM this worked fine before and still technically works. Just need a way to configure the CTRL + CLICK gesture as @ThaJay just mentioned. I think it may be possible actually, so I'm digging in a little more...
@andrewmartin you're right sorry, I should have been more specific. It works for custom components (such as my <Navbar />) but it doesn't work for stuff that I import from node_modules.
But I guess I was expecting a python-like behavior that in JS is not really a thing, as one of my colleagues explained to me.