Description
- VSCode Version: 1.44.2
- OS Version: Ubuntu
Steps to Reproduce:
- Go to a nodejs project that has multiple dependencies in node_modules
- Hit go to definition on a javascript
require
statement - Expect to be taken to javascript source code for that module
- Sometimes taken to foreign
.d.ts
file.
Does this issue occur when all extensions are disabled?: Yes
Example go to definition that works
Example of go to definition thats 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
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
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.