-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
How to install Prettier PHP Plugin in Visual Studio Code #1721
Comments
Hi @alexbalak21, |
I have the same issue, happen to be working on a large PHP codebase and the formatting is killing me, any help adding the plugin to already installed prettier in vscode? |
I use Prettier to format on save on Vs Code. How do I add formatting php files on save ? (with Prettier PHP Plugin) I want it to format my php files on save automatically. |
For me, the plugin works as expected (tested using VScode 1.56.1 with the prettier extension v6.4.0). Try the following steps:
|
Thanks, @czosel, I succeeded in installing the PHP plugin but now it doesn't actually format code but gives a response on the terminal that it has formatted the code but with no effect on the code that is recognisable as change |
Hi @NateOs, can you share the detailed steps on how to reproduce this? |
Great, I have prettier v6.4.0 installed, Before following your install process I had already tried and failed to install, therefore prettier will give an error message when I tried to format PHP, the error went away after installing your way, but now I don't get any actual formatting although prettier on save will tell me in the terminal that everything is ok, also I am not using any prettier config files, just the extension settings in vs code |
Are you sure the file you’re trying to format is valid PHP? Can you post a screenshot? |
I installed it It then opens up the Extensions market at "category:formatters plaintext". This is for a doc that starts Help. |
Does the file you’re trying to format end with “.php”? Do you have the prettier extension for vscode installed? |
Yes. test.php.
Yes. |
Hmm, I haven’t seen this before. Probably it would be best if you ask about this over at https://github.com/prettier/prettier-vscode |
I'm a bit late to the party, but ....
|
@UnderDogg ... I couldn't remember if this plugin was installed (doesn't appear as an extension), so (re?)-ran In a PHP file, if I choose from the command palette "Format Document" (that's Prettier, right?), I still get: "There is no formatter for 'plaintext' files installed." I have resorted to installing other PHP formatters, which correctly format the document on save. I don't know why this one won't. Actually, I was just navigating to @czosel The docs say to run If I instead run Is that the way this should be working? |
I wouldn't know how to answer this one.
Or just find |
@robertandrews Yep, that's how it's supposed to be working. Inside the |
Installing locally and opening the |
Thank you. This worked for me. |
Setting |
I was running into a similar issue this morning. In my case it was because my I opened that subdirectory directly and Prettier started working correctly. |
Hello,
I am using Visual Studio Code for editing .php files.
How can I set up Prettier plugin to format php in vs code.
I tried to follow README.md but, I am not able to activate the code formatting on php.
Thank you for your help.
The text was updated successfully, but these errors were encountered: