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

Line Up

Olumuyiwa Agboola

|
1 install
| (0) | Free
Rearranges selected lines in ascending order of length, from shortest to longest.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Line Up

Rearranges selected lines in ascending order of length, from the shortest at the top to the longest at the bottom.

Perfect for using directives, imports, variable declarations, or anywhere else the order of lines doesn't matter.

using System.Threading.Tasks;                 using System;
using System;                           →     using System.Linq;
using System.Collections.Generic;             using System.Threading.Tasks;
using System.Linq;                            using System.Collections.Generic;

Usage

  1. Select the lines you want to line up. A partially selected line counts as a whole line.
  2. Press Ctrl + Shift + R, or run Line Up: Line Up Selected Lines from the Command Palette.

Notes:

  • Length ignores indentation and trailing whitespace.
  • Lines of equal length keep their original order.
  • Works with multiple selections; each selection is lined up separately.

Bonus for .NET Development

Lining up C# using directives on save

When you save a C# file that has unsaved changes, Line Up automatically lines up its using directives, no selection needed. Each group of consecutive usings is lined up on its own, so blank lines between groups are kept.

This only happens on an explicit save (not auto-save). To turn it off, set lineUp.usingsOnSave to false.

Lining up a whole project or solution

Run either command from the Command Palette:

  • Line Up: Line Up Using Directives in C# Files in Current Project
  • Line Up: Line Up Using Directives in C# Files in Solution

The project (.csproj) or solution (.sln or .slnx) is the nearest one above the file you're editing. If no file is open, Line Up looks in the workspace and asks you to choose when there are several.

A project's C# files are all the .cs files under its folder, except those in bin, obj, hidden folders and nested projects. A solution includes every C# project it lists. Files open in an editor are changed there, so you can undo; other files are updated on disk.

Changing the shortcut

Open Keyboard Shortcuts, search for line-up.lineUpSelectedLines, and assign the key binding you like for lining up selected lines. For lining up using directives in the C# files in a .NET project or solution, no keyboard shortcuts have been assigned. You can open Keyboard Shortcuts, and search for line-up.lineUpUsingsInProject or line-up.lineUpUsingsInSolution and assign the key bindings you like.

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