prettier-vscode icon indicating copy to clipboard operation
prettier-vscode copied to clipboard

Detect global installation of prettier/plugin-php

Open mandrasch opened this issue 3 years ago • 1 comments

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!

mandrasch avatar May 30 '22 09:05 mandrasch

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.

davidbdyer avatar Jun 11 '22 21:06 davidbdyer

Not something i am planning on doing as the official recommendation is against using global extensions: https://prettier.io/docs/en/install.html

ntotten avatar Aug 20 '22 19:08 ntotten

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"
}

davidbdyer avatar Aug 20 '22 20:08 davidbdyer

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)

mandrasch avatar Aug 26 '22 13:08 mandrasch

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.

github-actions[bot] avatar Nov 25 '22 00:11 github-actions[bot]