Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange indentation behavior #150

Open
SirLouen opened this issue Nov 13, 2024 · 3 comments
Open

Strange indentation behavior #150

SirLouen opened this issue Nov 13, 2024 · 3 comments

Comments

@SirLouen
Copy link

This is my settings.json config

{
    "[php]": {
        "editor.defaultFormatter": "valeryanm.vscode-phpsab",
        "editor.formatOnSave": true
    },
    "phpsab.executablePathCBF": "./vendor/bin/phpcbf",
    "phpsab.executablePathCS": "./vendor/bin/phpcs",
    "phpsab.standard": "WordPress",
    "phpsab.snifferArguments": [
        "--ignore=*/wp-admin/*,*/wp-includes/*"
    ]
}

It's using WordPress Coding Standards

When I have for example this code:

if (! empty ( $attributes[''] ) ) {
}

And I save, since there is a WordPress CS rule that says that there should be a space between ( and ! it applies it correctly, but at the same time it applies one indentation to the whole code instead of just applying the space as expected and exiting

I'm assuming this is a bug.

@valeryan
Copy link
Owner

This extension is a wrapper for the phpcbf tool. If you have issues with the inner working of that you will need to report it to the phpcs/phpcbf devs.

@SirLouen
Copy link
Author

Maybe is not getting correctly the Wordpress CS for passing them to phpsab?
Are there any debug flags to check for this?

@valeryan
Copy link
Owner

You can see the commands that the extension is running by turning on debugging in settings and then looking in output in vscode and selecting this extension output.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants