Ctrl + click to TypeScript implemenation Follow
If I do Ctrl + click on a method in JavaScript file, it jumps to TypeScript implementation. Is this right?
How to I go to JavaScript implementation with Ctrl + click?
Please sign in to leave a comment.
Yes, it's expected - WebStorm uses the TypeScript definition files to power its code completion for standard JavaScript objects and methods.
I'm not sure what implementation you are looking for... What JavaScript library is Date() defined in?
No, I just wanted to know is it right action. Thank you for answer.
By the way, I have another question.
In the callback function of `reduce()`, `x` is accumulated to `a` and `a` is returned to `sum1`.
But WebStorm mark `a` as unused value. Why? `a` is used as return value of `reduce()` method.
is not equal to
it's
i.e. you are implicitly returning an assignment
return a = a + x
Inspection says that value assigned to `a` is unused, and `return a += x` can be replaced with `return a + x`. See comments in WEB-12462
Note that returning assignment is considered a bad style. ESLint reports errors on such constructions (https://eslint.org/docs/rules/no-return-assign)
Elena Pogorelova How can we customise the way the IDE (PHPStorm in my case) handles CTRL + Click interaction? As shown in the OP, CTRL + Click will currently take a user to the type definition file, which I've personally never wanted to do, and always find it incredibly frustrating when ending up on a type definition file, and not the actual source file.
Here's another simple example:
When I CTRL + Click on the Messages.scss import, I get taken to the type definition for it.. I want to go to the source file instead..
I've tried playing around with Keymaps in settings:
How can we fix this issue?
There's a related issue on that: https://youtrack.jetbrains.com/issue/WEB-27982. Please vote for it to raise its priority and be notified of updates
Thanks Elena Pogorelova.. It appears that ticket was created 4 years ago, I don't think my casting a vote for it is going to do much :/.
In any event, when CTRL + Clicking on an imported node_module, I always get take to the `.d.ts` file rather than the source file, and trying all the different "Go To" things as mentioned previously doesn't help, I'm always taken to the Typescript definition file.. Can we customise/change this behaviour so we can actually get to source files without having to manually search for it?