microsoft / microsoft/TypeScript
Add TS Server command for 'add all missing imports'
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Search terms
- code action
- source action
- Add missing imports
- getCombinedCodeFix
Feature request
Add a new TS Server command that triggers 'add all missing imports' for a given file.
Use case
VS Code allows users to configure code actions that are run on save. One of the supported code actions is source.addMissingImports which attempts to add all missing imports in a file. Users can also setup keybindings for these specific actions
To implement this, right now we request all code actions for the file and then try fetching the 'add all missing imports' combined fix for one of them. This is complicated and results in the TS Server doing extra work.
It would be better for us if we could ask the Typescript server: give me the edits that add the missing imports in this file
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TypeScript server's existing getCombinedCodeFix handling for the source.addMissingImports action. Trace how commands and file edits are exposed, then verify that the new command returns the edits for adding all missing imports in a given file without requiring the broader code-action request flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100