Better vertical alignment with or without selection in any language, for any characters or words.
- 🌐 Multi-language Support - Align code in any programming language
- 🎯 Smart Alignment - Align with or without text selection
- ⚡ Auto Align - Automatically align after typing
Enter
Place your cursor at the position where you want alignment, then:
- Press
Alt + A(Windows/Linux) orOption + A(Mac) - Or invoke the
Aligncommand via Command Palette (Ctrl+Shift+P/Cmd+Shift+P)
Control the spacing around alignment characters.
Default Configuration:
Configuration Options:
| Key | Type | Description |
|---|---|---|
colon |
[number, number] |
Spacing around : (e.g., in objects/maps) |
assignment |
[number, number] |
Spacing around = |
arrow |
[number, number] |
Spacing around => or -> |
comment |
number |
Space before trailing comments (negative = no alignment) |
Original Code:
var abc = {
hello: 1
,my :2//comment
,friend: 3 // comment
}With "colon": [0, 1] and "comment": 2:
var abc = {
hello : 1
, my : 2 // comment
, friend: 3 // comment
}With "colon": [1, 2] and "comment": 4:
var abc = {
hello : 1
, my : 2 // comment
, friend : 3 // comment
}With "colon": [-1, 3] and "comment": 2:
var abc = {
hello: 1
, my: 2 // comment
, friend: 3 // comment
}Original Code:
$data = array(
'text' => 'something',
'here is another' => 'sample'
);With "arrow": [1, 3]:
$data = array(
'text' => 'something',
'here is another' => 'sample'
);- Found a bug? Open an issue
- Want to contribute? Fork the repo and submit a pull request
This work is licensed under the Apache License 2.0.
The codebase is based on better-align. Special thanks to @WarWithinMe.
