Simple Line Sorter
A lightweight Visual Studio Code extension to quickly sort selected lines based on their length.
Perfect for organizing PHP use statements, import lists, namespaces, routes, configuration values, or any other line-based text.
Features
Current version (v0.0.1) includes:
- Sort lines from Longest → Shortest
- Sort lines from Shortest → Longest
- Works with any selected text, not limited to PHP files
- Preserves the selected block by replacing only the highlighted lines
Usage
- Select multiple lines in the editor.
Example:
use Filament\Schemas\Components\Section;
use Filament\Forms\Components\Select;
use Illuminate\Database\Eloquent\Model;
Right-click the selected text.
Choose:
Simple Line Sorter →
- Select one of the available actions:
- Longest → Shortest
- Shortest → Longest
The selected lines will be sorted instantly.
Example
Before
use Filament\Schemas\Components\Section;
use Filament\Forms\Components\Select;
use Illuminate\Database\Eloquent\Model;
Longest → Shortest
use Filament\Schemas\Components\Section;
use Illuminate\Database\Eloquent\Model;
use Filament\Forms\Components\Select;
Shortest → Longest
use Filament\Forms\Components\Select;
use Illuminate\Database\Eloquent\Model;
use Filament\Schemas\Components\Section;
Requirements
- Visual Studio Code 1.125.0 or newer.
Known Limitations
- Only the selected lines are sorted.
- Empty lines are included in the sorting process.
- Sorting is based on line length only.
Roadmap
Planned features for future releases include:
- Alphabetical sorting (A → Z / Z → A)
- Remove duplicate lines
- Remove empty lines
- Reverse line order
- Shuffle lines
- Natural sorting
Release Notes
v0.0.1
Initial release.
Features:
- Longest → Shortest
- Shortest → Longest
Feedback
If you encounter a bug or have a feature request, please open an issue on GitHub.
Contributions and suggestions are always welcome.