typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

Organize imports for TypeScript and JavaScript

Open saixiaoxi opened this issue 2 months ago • 6 comments

In this PR:

  • Port organize imports functionality for TypeScript and JavaScript
  • Preserve blank line groupings to respect user's logical organization
  • Support all import types: side-effect, type-only, namespace, default, named, and require

Imports are sorted by:

  1. Module type: absolute imports before relative imports
  2. Import kind: side-effect → type-only → namespace → default → named → require
  3. Alphabetically within each category

The feature is exposed via LSP workspace/executeCommand with command typescript-go.organizeImports and integrated into the VS Code extension as the "Sort Imports" command.

Fixes #1724

saixiaoxi avatar Sep 30 '25 09:09 saixiaoxi