Skip to content

import fix / autocomplete requires type checking JS/JSX #36134

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

Open
hedgepigdaniel opened this issue Jan 10, 2020 · 2 comments
Open

import fix / autocomplete requires type checking JS/JSX #36134

hedgepigdaniel opened this issue Jan 10, 2020 · 2 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

@hedgepigdaniel
Copy link

Extracted issue from https://code.visualstudio.com/docs/nodejs/working-with-javascript#_type-checking-javascript

Auto complete of imports in JS/JSX files does not work properly unless type checking of JS/JSX files is explicitly enabled. This is counter intuitive, and forces the user to endure potentially unwanted type errors in order to have working autocomplete of imports.

It's extra confusing because the autocomplete does work for symbols exported from modules that are already imported (so it seems like it should work but is flaky). It took me a long time to find this problem.

@mjbvz mjbvz transferred this issue from microsoft/vscode Jan 10, 2020
@microsoft microsoft deleted a comment from vscodebot bot Jan 10, 2020
@mjbvz mjbvz removed their assignment Jan 10, 2020
@mjbvz
Copy link
Contributor

mjbvz commented Jan 10, 2020

Moving upstream for feedback

The reason we do this is that our IntelliSense can't understand certain JavaScript patterns. That makes it impossible to know if what our IntelliSense thinks is a missing symbol should be a real error (with a corresponding quick fix import) or if the symbol comes from somewhere else but our IntelliSense in not smart enough to pick it up (in which case an add missing import quick fix would get in the way and break the code). Requiring type checking is the current compromise

@RyanCavanaugh
Copy link
Member

@mjbvz I think your rationale is correct here, but could see this as a potential configuration point. That said, auto-import is always a best-effort feature and we're never going to be able to get to 100% for all use cases.

@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 Jan 10, 2020
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

3 participants