microsoft / microsoft/TypeScript

Provide option to organize imports as part of format

Open
#46,217 8 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: Formatter In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Header added by @mjbvz

TypeScript Version: 4.4.2

Search Terms

  • format / formatting / formatter
  • organize imports / sort imports

This feature request is to provide a new option that would automatically run organize imports as part of format.

While VS Code could implement this itself today, handling this on the TS Server would have a few key advantages:

  • It would let us edit the document in a single go. Otherwise we have to first format the document and then organize imports. This would cause some flickering and may result in multiple undo stops
  • Other consumers of TS could benefit from the feature

Testing microsoft/vscode#48150

This would be awesome.

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

Start by tracing the TypeScript server's existing format and organize-imports requests, then determine how a format option could combine them. Check the related VS Code testing context mentioned in the issue. Done means the option performs both operations in one edit, with a single undo stop, while remaining useful to other TypeScript consumers.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.