Skip to content

Go to definition for nodejs javascript file broken by existance of .d.ts #38474

Closed
@Raynos

Description

@Raynos
  • VSCode Version: 1.44.2
  • OS Version: Ubuntu

Steps to Reproduce:

  1. Go to a nodejs project that has multiple dependencies in node_modules
  2. Hit go to definition on a javascript require statement
  3. Expect to be taken to javascript source code for that module
  4. Sometimes taken to foreign .d.ts file.

Does this issue occur when all extensions are disabled?: Yes

Example go to definition that works

uuid-works

Example of go to definition thats broken

promise-broken

Example of go to definition can be made to work for is-promise

The is-promise javascript library has an index.d.ts file which breaks go to definition because it exists.

I can remove this file by running rm node_modules/is-promise/index.d.ts

promise-working

It's really frustrating that go to definition only works if the index.d.ts does not exist.

One work around would be to rm ./node_modules/**/*.d.ts

Possible duplicate

microsoft/vscode#82054

This issue is very similar to the above.

It was closed because

The reason why we cannot jump to 3rd party JS is that JS's dynamic nature makes it impossible

This is not correct, i manually deleted the index.d.ts file from node_modules/is-promise and got exactly the behavior that i wanted.

The vscode go to definition for nodejs javascript works in almost all cases except when a .d.ts file exists.

It would be great if vs code has a flag to ignore *.d.ts files for when going to definition in a javascript project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureFix AvailableA PR has been opened for this issueSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions