Skip to content

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

Closed
@hugoblanc

Description

@hugoblanc
  • 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.

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions