Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add navigation path for going to JS node_modules definitions instead of .d.ts declarations #37777

Closed
davidmurdoch opened this issue Apr 2, 2020 · 11 comments
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@davidmurdoch
Copy link

Issue Type: Bug

When I "go to definition" of module in a JavaScript project it jumps to the TypeScript types file, if available, not the actual definition. If the TypeScript types are not available it will work as expected.

In the past, VSCode maintainers have commented:

It's not that TypeScript types are blocking you from jumping to the implementation
microsoft/vscode#68782 (comment)

and

In general, you cannot jump to the js implementation of a npm module
microsoft/vscode#68782 (comment)

and

it's that there in general is not logic to examine the code of an arbitrary node module and figure out which external invocations map to which implementations in the module.

microsoft/vscode#68782 (comment)

but that's is so clearly just flat-out wrong. There is a separate command for navigating to TypeScript types in the Right-Click context menu: "Go to Type Definition", it appears directly beneath "Go to Definition".

To reiterate: if the TypeScript file is removed everything works as expected.

People don't want to browse TypeScript definition files when stepping through source definitions. Abstractions are leaky. We need to find out why.

VS Code version: Code 1.43.2 (0ba0ca52957102ca3527cf479571617f0de6ed50, 2020-03-24T07:52:11.516Z)
OS version: Linux x64 5.0.0-16-generic

@davidmurdoch davidmurdoch changed the title "Go to definition" not working for required JavaScript node_modules "Go to definition" not working for JavaScript node_modules Apr 2, 2020
@mikeseese
Copy link

People don't want to browse TypeScript definition files when stepping through source definitions. Abstractions are leaky. We need to find out why.

I'd like to add that sometimes I do like to browse TS definition files when knowing what types I have to deal with during development; but I do agree I'd like to browse through the code during debugging.

@mjbvz mjbvz self-assigned this Apr 2, 2020
@mjbvz mjbvz transferred this issue from microsoft/vscode Apr 3, 2020
@mjbvz mjbvz removed their assignment Apr 3, 2020
@mjbvz
Copy link
Contributor

mjbvz commented Apr 3, 2020

Moving this feedback upstream

@microsoft microsoft deleted a comment from vscodebot bot Apr 3, 2020
@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript labels Apr 22, 2020
@RyanCavanaugh RyanCavanaugh changed the title "Go to definition" not working for JavaScript node_modules Add navigation path for going to JS node_modules definitions instead of .d.ts declarations Apr 22, 2020
@sheerun
Copy link

sheerun commented Jun 30, 2020

The providers for "Go to Definition", "Go To Type Definition", and "Go To Implementation" currently do the same thing. It's visible on this screencast where I call them in turn: https://asciinema.org/a/619AvvIQjd3zG7IV5MoLafVec

I'd expect that only "Go to Type Definition" goes to d.ts files. Maybe "Go To Definition" and for sure "Go to Implementation" should go to JS files if they are the only ones with implementation. This is very serious issue because it makes it really hard to debug code of dependencies.

@davidmurdoch
Copy link
Author

Any way to get this bumped to a higher priority? I go a little bit more insane every day over this 🤪

Also, the issues label is wrong. This has got to be considered a bug?

Also, not sure how this is a TypeScript issue, seems more like a VSCode issue to me.

@sheerun
Copy link

sheerun commented Oct 22, 2020

It is typescript issue and it even has failing test: #39426

@fabOnReact
Copy link

fabOnReact commented Mar 23, 2021

this issue affects a lot of OpenSource contributors when they try to troubleshoot issues in OpenSource repositories. I will try generating ctags to navigate the node modules https://github.com/jb55/typescript-ctags

@powext
Copy link

powext commented Aug 31, 2022

Definitely waiting for this!

@IllusionMH
Copy link
Contributor

Is this issue still relevant?

Go to Source Definition available in VS Code from early June
https://code.visualstudio.com/updates/v1_68#_go-to-source-definition

@fabOnReact
Copy link

fabOnReact commented Sep 1, 2022

UPDATE: goToSourceDefinition was also added to neoclide/coc-tsserver#384. The issue was also solved with neovim. Thanks 🙏

@davidmurdoch
Copy link
Author

Now that "Go To Source Definition" can be set as the preferred mode for "Go To Definition" (see #49003 (comment)) I think this can be closed.

@fabOnReact
Copy link

fabOnReact commented Jul 31, 2024

using the vim plugin coc-tsserver when I navigate to useRef, the file is still minified and unreadable.

Screen.Recording.2024-07-31.at.1.41.18.PM.mov

neoclide/coc-tsserver#449

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

9 participants