Skip to content

VSCode suggests circular import rather than direct with 1.60.0+ #46279

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
dariusj18 opened this issue Oct 8, 2021 · 4 comments
Closed

VSCode suggests circular import rather than direct with 1.60.0+ #46279

dariusj18 opened this issue Oct 8, 2021 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@dariusj18
Copy link

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

  • VS Code Version: 1.60.0
  • OS Version: Windows 10

Something changed about the way VSCode started doing it's auto import suggestions at 1.60.0 and this thread (microsoft/vscode#132299) has several people talking about it but it was closed because a few people had other issues because of a plugin.

VSCode will now only suggest importing variables from my index.ts files rather than the file in the same project.

Steps to Reproduce:

  1. Open attached repository (https://github.com/dariusj18/vscode_playground/tree/134657) using VSCode, no extensions required.
  2. Open file /src/common/types/test/test.ts and place cursor at the User types on line 5 and hit Ctrl+space to bring up suggestions.

Suggestion should not point to ../.. but ../user/user.

This also created situations with Prisma, the import suggestions now attempt to import .prisma/client rather than @prisma/client

The workaround is that I don't use the auto import and use the Quick fix suggestion list to find the desired path.

Also to be clear, the circular import portion of this isn't demonstrated by this example repo, but I was getting the error Class extends value undefined is not a constructor or null and solved it by manually changing the imports to point directly to the files rather than the re-exports.

@mjbvz mjbvz transferred this issue from microsoft/vscode Oct 8, 2021
@mjbvz mjbvz removed their assignment Oct 8, 2021
@mjbvz
Copy link
Contributor

mjbvz commented Oct 8, 2021

@andrewbranch I think TS 4.4 introduced some tweaks to auto import behavior. Could you take a look?

@andrewbranch
Copy link
Member

Sounds like a duplicate of #45953?

@dariusj18
Copy link
Author

dariusj18 commented Oct 8, 2021

That does seem like a dupe, strange I thought I searched the issues thoroughly. Oops, well, there's some additional info on this one that can be used to help.

Edit: Oh I see that is the Typescript repo

Edit: Oh I see that this was moved there too now.

@andrewbranch andrewbranch added the Duplicate An existing issue was already created label Oct 8, 2021
@andrewbranch
Copy link
Member

Thanks, the extra repro will be helpful 👍

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