Arrange Selection

Visual Studio Code extension to sort, shuffle, reverse, or filter selected lines or characters.
Features
Arranging lines
Reversing lines: arrange-selection.reverseLines

Sorting lines: arrange-selection.sortLines & arrange-selection.sortLinesDescending

Sorting lines by line length: arrange-selection.sortLinesByLength & arrange-selection.sortLinesByLengthDescending

Shuffling lines: arrange-selection.shuffleLines

Filtering duplicate lines: arrange-selection.filterDuplicateLines
- Keeps only the first unique line(s)

Arranging characters
A character being a grapheme, so composite characters should be arranged as one.
Reverse characters: arrange-selection.reverseCharacters

Sorting characters: arrange-selection.sortCharacters & arrange-selection.sortCharactersDescending

Shuffling characters: arrange-selection.shuffleCharacters

Filtering duplicate characters: arrange-selection.filterDuplicateCharacters
- Keeps only the first unique character(s)

Command
All commands are available in both the context menu (visible only if something is selected) and the command palette (⇧+⌘+P, Ctrl+Shift+P, or F1).

Keybinds
Nothing is bind by default, however, they can be added to the corresponding command.

Extension Settings
Setting |
Description |
arrangeSelection.arrangeOnEmptySelection |
When nothing is selected, specifies whether to arrange the entire document |
arrangeSelection.arrangeAcrossMultipleSelection |
When there are multiple selections, specifies whether to arrange them independently or as a whole |
arrangeSelection.selectDuplicates |
When filtering duplicates lines or characters, specifies whether to delete or select the duplicates |
arrangeSelection.lines.ignoreIndent |
When sorting lines, specifies whether to ignore whitespace to the left of each line |
arrangeSelection.lines.useNaturalSortOrder |
When sorting lines, specifies whether to use natural sort order |
arrangeSelection.characters.ignoreLineBreaks |
When arranging characters, specifies whether to skip/ignore newline control characters |
| |