Closed xbot closed 1 year ago
Maybe you should setting rootPatterns
option.
By default linters and formatters take the stdout output but php-cs-fixer does not print the results in stdout then it does not work.
To make it work you have to deactivate the isStdout
option and activate the doesWriteToFile
option
This is my configuration for php-cs-fixer
"php-cs-fixer": {
command: "./vendor/bin/php-cs-fixer",
args: ["fix", "--using-cache=no", "--no-interaction", "%file"],
isStdout: false,
doesWriteToFile: true,
}
The %file
arg is the full path of the current file, this is used when doesWriteTofile
is set to true
@iamcco @dsolay Still not working. The settings now are:
"diagnostic-languageserver.filetypes": {
"php": ["phpstan"]
},
"diagnostic-languageserver.formatters": {
"php-cs-fixer": {
"command": "./vendor/bin/php-cs-fixer",
"args": ["fix", "--ansi", "%file"],
"rootPatterns": [".git"],
"isStdout": false,
"doesWriteToFile": true
}
},
"diagnostic-languageserver.formatFiletypes": {
"php": ["php-cs-fixer"],
"python": ["black"]
},
The following command works under my project root:
./vendor/bin/php-cs-fixer fix --ansi
But nothing happened after executing
:call CocAction('format')
.The related settings in coc-settings.json are: