prettier-vscode
prettier-vscode copied to clipboard
Detect global installation of prettier/plugin-php
Is your feature request related to a problem? Please describe.
The php plugin for prettier (https://github.com/prettier/plugin-php) is supported by prettier-vscode, but only when plugin-php is installed locally via yarn/npm:
npm install --save-dev prettier @prettier/plugin-php
A global installation is not detected by prettier-vscode:
npm install --global prettier @prettier/plugin-php
This is also mentioned here: https://github.com/prettier/plugin-php#vscode
Describe the solution you'd like
It would be great if a global installation of prettier/plugin-php could be used when no local package is detected. It would make it a lot easier to use this extension throughout multiple (PHP) projects. Currently for every project you need to run npm install --save-dev prettier @prettier/plugin-php and npm install, even if no other npm packages are used by the project.
(Additionally it would be totally awesome if the php plugin could be installed inside of the vscode extension of course. I don't know the technical details of this extension yet.)
Describe alternatives you've considered None
Additional context Thanks very much for providing this extension!
I'm experiencing the same issue with @prettier/[email protected] and [email protected].
I'm on Mac OS 12.4.
It would be nice to not have to install the NPM libraries locally for every project.
Not something i am planning on doing as the official recommendation is against using global extensions: https://prettier.io/docs/en/install.html
I figured a work around by adding this to my workspace settings json. I've stopped using prettier except for one or two file types anyways. I don't care for some of its opinions.
{
"prettier.prettierPath": "/usr/local/lib/node_modules/prettier"
}
Not something i am planning on doing as the official recommendation is against using global extensions: https://prettier.io/docs/en/install.html
Thanks very much for reply and clarification!
(For interested readers: There is also a setting prettier.resolveGlobalModules for the vscode prettier plugin. It is not recommend (!), but can be used as workaround for certain use cases. Did not test it myself, found it here)
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.