Better Align PRO for Visual Studio Code
Achieve precise vertical alignment with or without text selection across any programming language, supporting alignment by any characters or words.
Key Features
- Works with code in any programming language
- Intelligent alignment with optional text selection
- Automatic alignment triggered when pressing Enter
How to Use
Position your cursor at the location where you want to align your code, then press the keyboard shortcut Alt + A or run the Align command from the Command Palette.
Visual Examples

Configuration Settings
betterAlign.surroundSpace
Default configuration:
betterAlign.surroundSpace : {
"colon" : [0, 1], // First value controls left spacing (can be negative).
// Second value controls right spacing (can be negative).
"assignment" : [1, 1], // Same spacing rules as above.
"arrow" : [1, 1], // Same spacing rules as above.
"comment" : 2 // Special setting for spacing between trailing comments and code.
// Negative values disable trailing comment alignment.
}
// Original code
var abc = {
hello: 1
,my :2//comment
,friend: 3 // comment
}
// "colon": [0, 1]
// "comment": 2
var abc = {
hello : 1
, my : 2 // comment
, friend: 3 // comment
}
// "colon": [1, 2]
// "comment": 4
var abc = {
hello : 1
, my : 2 // comment
, friend : 3 // comment
}
// "colon": [-1, 3]
// "comment": 2
var abc = {
hello: 1
, my: 2 // comment
, friend: 3 // comment
}
// "colon": [-1, -1]
// "comment": 2
var abc = {
hello:1
, my:2 //comment
, friend:3 // comment
}
// Original code
$data = array(
'text' => 'something',
'here is another' => 'sample'
);
// "arrow": [1, 3]
$data = array(
'text' => 'something',
'here is another' => 'sample'
);
Reporting Issues and Contributing
Found a bug? Please report it at https://github.com/chouzz/vscode-better-align/issues.
Interested in contributing? Fork the repository and send us pull requests.
License
This project is licensed under the Apache License 2.0
Acknowledgments
This codebase is built upon this repository. Special thanks to @WarWithinMe.