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

Incorrect tool-tip and definition path for import statements in js file #25197

Closed
ghost opened this issue Apr 22, 2017 · 1 comment
Closed

Incorrect tool-tip and definition path for import statements in js file #25197

ghost opened this issue Apr 22, 2017 · 1 comment
Assignees
Labels
*as-designed Described behavior is as designed javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@ghost
Copy link

ghost commented Apr 22, 2017

  • VSCode Version: Code 1.11.2 (6eaebe3, 2017-04-13T08:03:11.395Z)
  • OS Version: Windows_NT ia32 10.0.14393
  • Extensions:
Extension Author Version
xml DotJoshJohnson 1.7.0
EditorConfig EditorConfig 0.9.3
java redhat 0.1.0
html-preview-vscode tht13 0.1.1
cordova-tools vsmobile 1.2.7

Steps to Reproduce:

  1. Clone https://github.com/reactjs/react-redux (edit: and run npm install)
  2. Open the new repo folder with vscode.
  3. Edit the file src/components/connectAdvanced.js.
  4. Hover your mouse pointer over the string 'invariant' on the line that says import invariant from 'invariant'.
  5. Press F12 or otherwise activate the Go to definition command.

In step 4, I expected to see a tool-tip displaying the path to my local node_modules directory inside of my repo. Instead, I was shown a path to the global node_modules/@types directory on my system.

Likewise in step 5, when I pressed F12 vscode opened a index.d.ts instead of opening the local node_modules/invariant/index.js file.

Knowing the types that vscode is using to display Intellisense is not really useful to me because they almost never match the version of the code that I'm actually working with. I would strongly prefer to at least be able navigate to the actual implementation easily instead of to the .d.ts definition file.

Thank you.

@mjbvz mjbvz self-assigned this Apr 24, 2017
@mjbvz mjbvz added *as-designed Described behavior is as designed javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Apr 24, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 24, 2017

Thanks for the suggestion.

This is currently a limitation of how the TypeScript server that powers both our JS and TS intellisense works. We use d.ts files for module intellisense in order to provide rich suggestions without having to parse or understand the JavaScript implementation. This is done both for performance reasons and to leverage TS language features when describing JavaScript APIs

Ideally the d.ts files should be transparent in this whole process however. I know the TS team has discussed improving this and here are a few related issues on the TypeScript side:

microsoft/TypeScript#14479
microsoft/TypeScript#6209

Closing this as upstream since there is not much we can do on the VSCode side to fix this. I'll make sure the TS team is aware of the issue

Thanks

@mjbvz mjbvz closed this as completed Apr 24, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

1 participant