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

Custom Line Sort

CodingMarkus

| (0) | Free
A highly customizable line-sorting extension.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Custom Line Sort

A highly customizable line-sorting extension for VSCodium and Visual Studio Code (VS Code).

Open VSX Marketplace Version MIT License

Custom Line Sort gives you the usual line-sorting commands, but without forcing every possible sorting variant into your Command Palette. Choose which sort commands you actually want to use, hide the rest, and customize how certain sorting modes behave.

Features

  • Sort selected lines in ascending or descending order.
  • Sort selected lines lexically, naturally, or by line length.
  • Configure which sorting commands appear in the Command Palette.
  • Customize the behavior of supported sort modes.
  • Keep your Command Palette clean by exposing only the commands you need.
  • Designed to behave predictably with selections, line endings, and edge cases.

Why Custom Line Sort?

There are already many line-sorting extensions. Custom Line Sort focuses on giving you control over the sorting experience itself.

Instead of installing an extension that adds a fixed collection of commands, you decide which sorting operations should be available. For sort modes with configurable behavior, you can also adjust how the comparison is performed.

The result is a line sorter that can be as simple or as specialized as you want it to be.

Commands

Run Custom Line Sort commands from the Command Palette. The commands that appear depend on which sorting operations you enable in Settings.

Sorting algorithms

  • Lexicographically: Compares lines from left to right, comparing the UTF-16 code unit of each character. Unlike the case-insensitive variant, it treats uppercase and lowercase characters as different.

  • Lexicographically, Descending: Sorts lexicographically in reverse order.

  • Lexicographically, Case Insensitive: Sorts lexicographically ignoring the case. Lines that compare equally retain their relative order unless the case-sensitive fallback is enabled.

  • Lexicographically, Case Insensitive, Descending: Sorts case-insensitive lexicographically in reverse order.

  • Naturally: Sorts like a lexicographical sort, but compares each sequence of decimal digits by its numeric value. For example, value2 comes before value10.

  • Naturally, Descending: Sorts naturally in reverse order.

  • Naturally, Case Insensitive: Sorts naturally after converting lines to lowercase. Lines that compare equally retain their relative order unless the case-sensitive fallback is enabled.

  • Naturally, Case Insensitive, Descending: Sorts case-insensitive naturally in reverse order.

  • By Line Length: Sorts by the number of UTF-16 code units in each line. Lines with equal lengths use the configured primary and secondary fallbacks.

  • By Line Length, Descending: Sorts by line length in reverse order, while retaining the configured fallback behavior for equal-length lines.

The built-in sort in VSCodium and VS Code behaves like "Lexicographically, Case Insensitive", except when two lines differ only in letter case. In that situation, it applies the "Lexicographically" ordering in reverse: lowercase letters come before uppercase letters, whereas the lexicographical algorithm places uppercase letters first.

See sorting samples for a side-by-side comparison of the results.

Settings

Use the Enabled Sort Modes setting to choose which sorting commands appear in the Command Palette. All commands are enabled by default. You can also customize the behavior of supported sort modes.

Line-length sorting has a primary and a secondary fallback. The primary fallback can compare word lengths from either end, with shorter or longer words first, or skip directly to the secondary fallback. The secondary fallback can retain relative order or sort lexicographically or naturally, with optional case-insensitive comparison.

Natural sorting compares digit sequences by numeric value, so value2 appears before value10.

Compatibility

Custom Line Sort is compatible with VSCodium and Visual Studio Code (VS Code).

Download

Download the extension from

  • Codeberg
  • Open VSX
  • Visual Studio Marketplace

See the release history.

Request a feature

If you would like to have a different sort algorithm implemented, just let me know. Ideally, open a feature request on Codeberg to track progress, or contact me directly at hjaqu83g0@mozmail.com.

Development

See the development instructions.

License

MIT, see LICENSE.

My other projects

See also my other projects.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft