microsoft / microsoft/TypeScript

VSCode version 1.58.2 Not able to add new imports in Typescript rush monorepos

Open
#45,300 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: LS: Auto-import Needs Investigation
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

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

  • VS Code Version: 1.58.2
  • OS Version: macOS Big Sur 11.4
  • Extension ids: [coenraads.bracket-pair-colorizer, wmaurer.change-case, streetsidesoftware.code-spell-checker, dbaeumer.vscode-eslint, file-icons.file-icons, eamodio.gitlens, esbenp.prettier-vscode, netcorext.uuid-generator, vscodevim.vim]

Steps to Reproduce:

  1. Create an interface Foo in a new location
  2. Create a class that depends on the Foo interface and try to auto import the definition through the VSCode auto import feature (highlight the interface and use command + . to open the suggested actions)
  3. The only option it will give the user if nothing has been imported from this location before is to extract to a type alias
  4. If something had been imported from the same location however, it can add the import to the existing list of imports

What should happen:

VSCode should suggest creating a new import statement for that interface at the top of the class file

What actually happens:
using command + . yields only the option to Extract to type alias.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the problem in VS Code 1.58.2 using a TypeScript Rush monorepo, with extensions disabled, and compare a new import location with one already imported. Trace the TypeScript auto-import and suggested-actions behavior; done means Command+‍. offers an import statement for the interface while retaining existing import suggestions.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.