vscode-php-cs-fixer
vscode-php-cs-fixer copied to clipboard
header_comment is inserted in all copy-paste and more
Hi,
I love the extension and it works wonderfully. I have a weird issue that started to happen at some point.
When I copy-paste any piece of code the header_comment is inserted before the text that I'm pasting. If I ctrl+z immediately, the header_comment is removed, but the pasted code stays.
As a workaround, I'm disabling the header_comment in the .php-cs-fixer.dist.php.
VSCode 1.64.2 PHP 7.4.16 vscode-php-cs-fixer v0.2.10
-
The issue also affects other copy-paste actions. For instance, you paste
use HasFactory;and it immediately disappears if theuse Illuminate\Database\Eloquent\Factories\HasFactory;is not declared before. -
And, if you paste
use Illuminate\Database\Eloquent\Factories\HasFactory;first, then it disappears because there is reference in the code.
-
about: "header_comment" can you replay the actions, and paste your config
.php-cs-fixer.dist.php -
maybe php-cs-fixer optimize the codes, and delete unused codes, you should change your php-cs-fixer config
if you have any problems about php-cs-fixer, maybe https://github.com/FriendsOfPHP/PHP-CS-Fixer has answer.
If I disable junstyle.php-cs-fixer as editor.defaultFormatter, and only fix manually, php-cs-fixer works perfectly.
It looks like the problem is the interaction between junstyle.php-cs-fixer and vscode. There are rules that can't be applied at every editing step.
I have the same issue.
Our best bet is probably just "editor.formatOnPaste": false.
You could also disable this just for php.
But it's not ideal...