annsk / vscode-alignment

Align chars in selection.
MIT License
13 stars 5 forks source link

Aligning PHP array breaks code #5

Closed wUFr closed 8 years ago

wUFr commented 8 years ago
$config = array(
    "cache_dir" => $dir . "/dist/css",
    "compress" => false,
    "source_map" => false,
);

after align:

$config       = array(
    "cache_dir"  = > $dir . "/dist/css",
    "compress"   = > false,
    "source_map" = > false,
);

= > is not valid in PHP and will end up in Parse error: syntax error, unexpected '=', expecting ')' :)

Tested in Visual Studio Code 1.7.1 with this plugin: https://marketplace.visualstudio.com/items?itemName=annsk.alignment

annsk commented 8 years ago

You should add in your preferences:

"alignment.chars": {
        ":": {
            "spaceBefore": 0,
            "spaceAfter": 1
        },
        "=>": {
            "spaceBefore": 1,
            "spaceAfter": 1
        },
        "=": {
            "spaceBefore": 1,
            "spaceAfter": 1
        }
    }

=> isn't configured by default.

wUFr commented 8 years ago

added, thx for tip :)