@sandlada/symbol-align

Make the code
line up.

Line up =, :, => and other punctuation into clean columns. This playground runs the real alignment core in your browser — paste a snippet and every keystroke updates the result.

Only spaces are ever inserted. Strings, comments and the meaning of your code stay untouched.

Symbol alignment playground

Scope
Declarations
Anchor

Semicolons separate groups, commas separate members. Members use one to sixty-four characters without spaces.

Symbols

Toggle any symbol, or add your own.

Use one to eight non-whitespace characters, for example => or //.

Source

C#


Aligned

Live

inserted spaces


                        

Ready

One job. Done precisely.

This is not a code formatter. It does not reorder, rewrap or rename anything. It reads the snippet, finds the symbols you choose, and inserts spaces until those symbols share a column — then it stops.

Code, not strings

A single-pass lexical scanner tracks string literals and comments across lines. An = inside a string, a comment or an interpolated hole never becomes a target.

Whole operators stay whole

A symbol that is only a fragment of a longer operator is rejected. Aligning = never splits =>, == or := apart.

Stable by construction

Passes repeat to a fixpoint. If a conflicting symbol order would keep moving, the aligner under-aligns rather than mutating the snippet or diverging on the next run.

Four alignments that earn their keep.

Equals signs, trailing comments, declaration columns and match arms cover almost every snippet that reaches this page. Each pair below is the literal output of the core — the test suite re-runs the aligner over this markup, so an example can never drift from the real behaviour.

Equals signs

JavaScript · symbols: =

const name = 'ada';
const greeting = 'hello';
const retries = 3;
const name     = 'ada';
const greeting = 'hello';
const retries  = 3;

Trailing comments

JavaScript · symbols: //

const port = 5173; // dev server
const host = 'localhost'; // bind address
const port = 5173;        // dev server
const host = 'localhost'; // bind address

Declaration columns

C# · declaration columns on, symbols: =

public string Name = "ada";
public int Id = 1;
public string Name = "ada";
public int    Id   = 1;

Match arms

Rust · symbols: =>

0 => "zero",
10 => "ten",
_ => "many",
0  => "zero",
10 => "ten",
_  => "many",

57 language profiles. One grammar of whitespace.

Every profile knows its own comment markers, string delimiters and operator table. The same core powers the CLI and the VS Code extension; this page imports the source directly, so it doubles as a live test bench.

Questions, answered.

Short answers about privacy, scope and what the aligner will — and will not — change.

Does my code leave the browser?

No. Alignment runs locally in this tab. There is no server, no upload and no tracking script.

Is this a code formatter?

No. It only inserts spaces in front of the symbols you select. It never removes characters, reorders code, changes quotes or touches string content. Use it to align equals signs, colons, arrows or trailing comments without reformatting the rest of the snippet.

Why is my snippet unchanged?

The selected symbols may not occur in the same blank-line block or indentation level. Try the File scope, select another symbol such as :, or check whether the snippet is already aligned. If no symbols are selected, the output is identical to the source by design.

Can I align comments and arrows?

Yes. Toggle //, #, =>, -> or add any punctuation token with the custom symbol field. Word symbols such as readonly are supported too.

What are declaration columns and custom groups?

Typed declarations can line their modifiers, types and names into a grid: set Declarations to Off to compare that with plain symbol alignment, and use Anchor to align the start or the end of the type cell. Custom groups align alternative tokens such as MY_STATE1 and MY_STATE2 into one column; semicolons separate groups and commas separate members.

Which languages are supported?

57 profiles, from C#, TypeScript and Python to SQL, YAML, Terraform and Makefile. The selector in the toolbar is generated from the same profile table as the library, so every profile the core supports is available here.