Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Simple Line SorterNew to Visual Studio Code? Get it now.
Simple Line Sorter

Simple Line Sorter

welman91

|
4 installs
| (0) | Free
Simple Line sorter to sorting lines by length
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Simple Line Sorter

Sort selected lines by length. Align PHP-style key => value arrays.

No settings. No dependencies. Selection-only.

Features

  • Longest → Shortest: sort selected lines by trim().length, descending.
  • Shortest → Longest: sort selected lines by trim().length, ascending.
  • Align Array =>: pad keys so => arrows line up. Indentation preserved. Lines without => pass through untouched.

Usage

  1. Highlight lines in editor.
  2. Right-click → Simple Line Sorter submenu (visible only with active selection).
  3. Pick command. Or open Command Palette (Ctrl+Shift+P) and search title.
Command ID (declared) Title Status
simple-line-sorter.sortLongToShort Longest → Shortest works
simple-line-sorter.sortShortToLong Shortest → Longest works
simple-line-sorter.alignArray Align Array => broken, see Known Issues

Empty selection → info message, no-op. Align with zero => lines → No key => value pair found., no-op.

Examples

Sort longest → shortest (length measured after trim()):

# before
a
abcd
ab

# after
abcd
ab
a

Align =>:

// before
$name => 'A',
$longer_key => 'B',
id => 3,

// after
$name       => 'A',
$longer_key => 'B',
id           => 3,

Requirements

  • VS Code ^1.125.0. No other requirements.

Known Issues

  • Align Array menu entry broken. package.json declares line-sorter.alignArray, but src/extension.ts registers simple-line-sorter.alignArray. IDs must match. Submenu item does nothing until unified. Sort commands unaffected.
  • CRLF normalized to LF. Split on /\r?\n/, rejoin with '\n'.
  • Length = trim().length. Leading/trailing whitespace ignored for ordering, but kept in output.
  • In-place Array.sort. Stable in modern V8, but equal-length order should not be relied on.

Release Notes

See CHANGELOG.md.

Source

  • Repo: https://github.com/welman91/simple-line-sorter-vscode-extension
  • Entry: src/extension.ts → bundle dist/extension.js
  • License: MIT
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft