kokororin / vscode-phpfmt

Integrates phpfmt into VS Code
https://marketplace.visualstudio.com/items?itemName=kokororin.vscode-phpfmt
BSD 3-Clause "New" or "Revised" License
130 stars 30 forks source link

Formatting deletes use statement #68

Closed mihazs closed 1 year ago

mihazs commented 5 years ago

Hi, everytime when i format the code, the extension delete the use statement:

<?php

use Phalcon\Cli\Task;
use App\DB\TenantManager; //this line is deleted always when i save or format

class DatabaseTask extends Task
{
    public function mainAction()
    {        
    echo 'This is the default task and the default action' . PHP_EOL;
    }
    /**
     * @param array $params
     */
    public function generateAction(array $params)
    {
        if (array_key_exists(0, $params)) {
            switch (strtolower($params[0])) {
                case 'main':

                    break;
            }
        }
    }
}
TheoDriutti commented 5 years ago

I have the same issue it's really annoying, if you figured out how to disable this transformation please let me know

TheoDriutti commented 5 years ago

Ok I found the answer. nsert this line in the vscode User Settings:

"phpfmt.passes": ["OnlyOrderUseClauses"].

mihazs commented 5 years ago

this is a workaround, not a solution