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

Detect global installation of prettier/plugin-php #2564

Closed
mandrasch opened this issue May 30, 2022 · 5 comments
Closed

Detect global installation of prettier/plugin-php #2564

mandrasch opened this issue May 30, 2022 · 5 comments
Labels
locked Please open a new issue and fill out the template instead of commenting.

Comments

@mandrasch
Copy link

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!

@davidbdyer
Copy link

davidbdyer commented Jun 11, 2022

I'm experiencing the same issue with @prettier/plugin-php@0.18.8 and prettier-plugin-css-order@1.2.0.

I'm on Mac OS 12.4.

It would be nice to not have to install the NPM libraries locally for every project.

@ntotten
Copy link
Member

ntotten commented Aug 20, 2022

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

@ntotten ntotten closed this as completed Aug 20, 2022
@davidbdyer
Copy link

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

@mandrasch
Copy link
Author

mandrasch commented Aug 26, 2022

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)

@github-actions
Copy link

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 github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Nov 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

3 participants