Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Line SortNew to Visual Studio Code? Get it now.
Line Sort

Line Sort

Lafitte Mehdy

|
3 installs
| (0) | Free
Get your lines straight, all neat and alphabetically in one quick hit
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Line Sort

CI

Get your lines straight. Alphabetically, of course. One quick hit to sort multiple lines or elements within a single line.

Usage

  • Multi-line: Select a block of text to sort each line alphabetically.
  • Inline: Place your cursor on a line (or select part of it) to sort elements within that line.

Trigger the command via:

  • Ctrl+Alt+S (or Cmd+Alt+S on Mac)
  • Right-click → "Alphabetize Lines or Inline Elements"
  • Command Palette → "Alphabetize Lines or Inline Elements"

Features

Multi-line Sorting

Sorts selected lines in case-sensitive ASCII order. Special characters, numbers, and uppercase letters come before lowercase letters.

Before:          After:
zebra            !exclaim
Apple            123
banana           @mention
@mention         Apple
123              Banana
!exclaim         banana
Banana           zebra

Inline Element Sorting

Automatically detects and sorts comma, semicolon, pipe, or space-separated lists on a single line.

  • Smart Detection: Works with lists inside brackets [], curly braces {}, parentheses (), and quotes "" or ''.
  • Prefix Preservation: Keeps prefixes like const arr = intact.
  • Consistent Spacing: Automatically normalizes spacing for clean, readable output.
// Before
const tags = ['zebra', 'alpha', 'mango'];
const values = '10, 5, 100, 1';
const params = 'd|a|c|b';

// After
const tags = ['alpha', 'mango', 'zebra'];
const values = '1, 10, 100, 5';
const params = 'a | b | c | d';

Requirements

VS Code 1.105.0+

Release Notes

0.0.2

Enhanced inline sorting with improved reliability:

  • Inline element sorting for comma, semicolon, pipe, and space-separated lists
  • Smart auto-detection - automatically chooses multi-line vs inline sorting
  • Normalized spacing for consistent, predictable output
  • Empty element filtering prevents malformed results
  • Works without selection - sorts current line when no text is selected
  • Improved delimiter detection and pattern matching

0.0.1

Initial release. Straightens out your lines fast.


MIT License

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft