junstyle / vscode-php-cs-fixer

PHP CS Fixer extension for VS Code
https://marketplace.visualstudio.com/items?itemName=junstyle.php-cs-fixer
MIT License
357 stars 45 forks source link

Fixer removes indent on semicolon usage #185

Closed iainhallam closed 2 years ago

iainhallam commented 2 years ago

I'm using php-cs-fixer v0.3.5.

When I type the semicolon at the end of a line in an otherwise well-formatted file (I have the ikappas.phpcs extension as well), php-cs-fixer strips the indentation from the start of the line I've just typed. Disabling all extensions, then re-enabling just php-cs-fixer still shows the problem. I've removed my phpcs.xml from the root of the project, but that doesn't help.

Example:

    public function getSort()
    {
        return 55
    }

Type ;:

    public function getSort()
    {
return 55;
    }

I have the following in my settings for php-cs-fixer:

    "php-cs-fixer.autoFixBySemicolon": true,
    "php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar",
    "php-cs-fixer.lastDownload": 1661189450564,

Pressing Ctrl-Z undoes the faulty indentation, but this is a pain to have to do so I'm just disabling the feature for now.

Using "php-cs-fixer.onsave": true doesn't cause the same loss of indentation.

Any thoughts on why this is happening?

junstyle commented 2 years ago

fix, updated v0.3.6

iainhallam commented 2 years ago

Cool; that's fixed it, thanks.