Skip to content

Auto complete not working for packages except those under @types folder #30474

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

Closed
EnixCoda opened this issue Jan 19, 2019 · 2 comments
Closed
Labels
Duplicate An existing issue was already created

Comments

@EnixCoda
Copy link

  • VSCode Version: 1.30.2
  • OS Version: macOS v10.13.6

Auto complete is one of my favorite features of VS code. But sometimes it doesn't provide what I need.

Steps to Reproduce:

  1. Create a project with create-react-app: npx create-react-app test-auto-complete --typescript
  2. Create a empty file src/test.tsx.
  3. Make sure auto complete works: type isvalid and get following suggestions
    image
    Then confirm:
    image
  4. Install a typed package from npm. (I made one - safe-touch
  5. See if auto complete works for the package(type safe and expect suggestion of safeTouch):
    image
    Negative :(
  6. There is a difference between the types file of safe-touch and react. Safe-touch's is directly under node_modules while react's is under node_modules/@types/. Then I tried to make a folder under @types for the package, simply cp -r node_modules/safe-touch node_modules/@types.
  7. See if auto complete works now:
    image
    It works! 🎉🎉

So it seems that VS code is not able to auto complete types of node_modules/[package] even if the package is correctly typed?

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

@mjbvz mjbvz transferred this issue from microsoft/vscode Mar 18, 2019
@mjbvz mjbvz removed their assignment Mar 18, 2019
@mjbvz
Copy link
Contributor

mjbvz commented Mar 18, 2019

Confirmed with 3.4.0-dev.20190316

I believe this may be the same issue as #30033. Once you add import safeTouch from "safe-touch"; anywhere in the project, then we start suggesting it as an auto import in all ts/tsx files.

@EnixCoda
Copy link
Author

@mjbvz

Once you add import safeTouch from "safe-touch"; anywhere in the project, then we start suggesting it as an auto import in all ts/tsx files.

This makes sense and it works. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants