plugin-php icon indicating copy to clipboard operation
plugin-php copied to clipboard

Format On Save not working on VSCODE (Windows 10)

Open jbersamin-vitech opened this issue 4 years ago • 2 comments

I tried to search on close/open issues but no avail.

What is wrong with my settings? Please help. Thanks

Prettier 2.2.1

PHP Plugin 0.16.1

package.json

    "devDependencies": {
        "@prettier/plugin-php": "^0.16.1",
        "axios": "^0.21",
        "laravel-mix": "^6.0.6",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "prettier": "^2.2.1"
    }

.prettierrc.json:

{
    "useTabs": true,
    "overrides": [
        {
            "files": ["*.p"],
            "options": {
                "parser": "php",
                "phpVersion": "7.4",
                "braceStyle": "1tbs",
                "embeddedLanguageFormatting": "off",
                "singleQuote": true
            }
        }
    ]
}

My VS Code Settings:

    "editor.formatOnSave": false,
    "[php]": {
        "editor.formatOnSave": true,
        "editor.formatOnPaste": true
    },
    "editor.defaultFormatter": "esbenp.prettier-vscode",

Expected behavior:

jbersamin-vitech avatar Feb 04 '21 15:02 jbersamin-vitech

hi @jbersamin-vitech ,

(I don't know much about this but) this line of your .prettierrc.json stood out to me:

"files": ["*.p"],

should it be *.php ?

(or maybe your php files have a .p extension)

nicoder avatar Feb 05 '21 05:02 nicoder

@nicoder I tried to change it to .php and still not working. If I could just see any errors in the output inside the VSCODE. I could have fix this.

jbersamin-vitech avatar Feb 10 '21 13:02 jbersamin-vitech