Line Sort

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