Skip to content

Extension ignores the config setting, can't explicitly load root config #231

@aorcsik

Description

@aorcsik

Even if I explicitly set the config settings.json, it is not passed as a command-line parameter to the executable.

I had to do a workaround by creating a wrapper script that always adds the config file sitting next to it:

settings.json

"php-cs-fixer.executablePath": "${workspaceFolder}/php-cs-fixer-wrapper.sh",

php-cs-fixer-wrapper.sh

#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
exec "$SCRIPT_DIR/vendor/bin/php-cs-fixer" "$@" --config="$SCRIPT_DIR/.php-cs-fixer.php"

Adding the config file explicitly is a must in VSCode, since the tool runs on temp files created by the IDE and can't find config files relative to them. This caused it to switch into interactive mode, asking about risky rules, then timing out and generating .php-cs-fixer.dist.php wherever the saved file was. It was long, annoying, and didn't even fix the file. The above workaround fixed it, but fixing the issue with passing config parameters would be the real solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions