Skip to content

Import module specifier: "shortest" doesn't pre-select the shortest (typescript) #42235

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
hugoblanc opened this issue Jan 6, 2021 · 2 comments
Assignees
Labels
Needs Investigation This issue needs a team member to investigate its status.

Comments

@hugoblanc
Copy link

  • VSCode Version: classic 1.52.1 and 1.53.0-insider
  • OS Version: Windows 10 pro - 20H2

Steps to Reproduce:

  1. Clone that repo
  2. Run, npm install
  3. Verify your VSCode module import preference is setup is "shortest"
  4. Open main.ts and observe line 5, the ideal shortest import (manually typed by me) import { BasicDTO } from "@repro-short-import/data";
  5. Open now app.component.ts and try to auto import BasicDTO from shared lib with ctrl+space.
  6. Optionnaly, use CTRL+. to try different import style and see that shortest is definitly not the first. Instead an absolut longer path is used import { BasicDTO } from 'libs/data/src/lib/data';

It is not due to the string length cause I got other repos where lib name is shorter than @repro-short-import/data;

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

I'm using the insider version for every day coding and I downloaded the last clean and fresh vscode classic version to test this. These errors are occurring on both.

Using other type of import module specifier will eventually solve this issue but will cause some others => always use absolute path even for file which should be relatively imported.

@mjbvz mjbvz transferred this issue from microsoft/vscode Jan 7, 2021
@mjbvz mjbvz removed their assignment Jan 7, 2021
@hugoblanc
Copy link
Author

I am not sure that it's typescript related. Just in case, I wrote "(typescript)" because that was happening in a typescript context.

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Jan 8, 2021
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.3.0 milestone Jan 8, 2021
@andrewbranch
Copy link
Member

This was fixed in #42614

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

4 participants