Comments (7)
Hi @mermshaus, thanks for the bug report! It seems that plugins now have to be registered explicitly, e.g. by passing --plugin=@prettier/plugin-php
. See here for details and alternatives. We'll have to update our docs to reflect this.
@fisker has the implicit plugin registration been dropped?
from plugin-php.
The plugin search feature has been removed.
from plugin-php.
@coffebar Yes, it still works for me. To avoid derailing this issue, I put more info here. I hope it may be of help to you.
from plugin-php.
Hi everyone,
thanks for the quick help! Adding the plugin configuration/CLI arguments solves this issue.
There is one thing of note: If you have a global installation of prettier, plugin configuration wonโt work (right now), at least not by simply specifying the package name. Itโs possible to use an absolute path to a pluginโs entry point to work around this. E.g. prettier --plugin /usr/lib/node_modules/@prettier/plugin-php/src/index.js
.
from plugin-php.
@mermshaus I have tried your workaround with plugin-php
and I see the error message is gone, but it's not gonna work: no formatting.
Is it still work for you?
test.php
<?php
if(1 ){ echo 2; }
?>
prettier --log-level debug test.php \
--plugin /home/abc/.node_modules/lib/node_modules/@prettier/plugin-php/src/index.js \
--parser php
Output:
[debug] normalized argv: {"":["test.php"],"cache":false,"color":true,"editorconfig":true,"logLevel":"debug","plugins":["/home/abc/.node_modules/lib/node_modules/@prettier/plugin-php/src/index.js"],"parser":"php","configPrecedence":"cli-override","debugRepeat":0,"ignorePath":[".gitignore",".prettierignore"],"_":["test.php"],"__raw":{"_":["test.php"],"cache":false,"color":true,"editorconfig":true,"log-level":"debug","plugin":"/home/abc/.node_modules/lib/node_modules/@prettier/plugin-php/src/index.js","parser":"php","config-precedence":"cli-override","debug-repeat":0,"ignore-path":[".gitignore",".prettierignore"]}}
[debug] resolve config from '/home/abc/test.php'
[debug] loaded options `{"parser":"php","plugins":["/home/abc/.node_modules/lib/node_modules/@prettier/plugin-php/src/index.js"],"useTabs":false,"tabWidth":2}`
[debug] applied config-precedence (cli-override): {"parser":"php","plugins":["/home/abc/.node_modules/lib/node_modules/@prettier/plugin-php/src/index.js"],"tabWidth":2,"useTabs":false}
<?php
if(1 ){ echo 2; }
?>
from plugin-php.
@coffebar Specifying the full plugin path works for me, but I find this to be an annoying regression as this wasn't required previously with prettier v2
from plugin-php.
Downgraded to v2 since phpStorm uses global prettier & php plugin instances ๐๐ผ
from plugin-php.
Related Issues (20)
- `npx prettier . --check` doesn't check php files HOT 3
- Class and method braces with no body split onto multiple lines HOT 2
- Brackets vanish in Recursive IIFE
- Attributes removed since 0.19.2 if method argument has an attribute with attributes in them and arrays and some new lines
- Comments in attributes (e.g. for an array item) are weirdly moved to somewhere completely else HOT 2
- Some comment positions inside attributes can result in prettier failing with an exception
- Docs: specify if prettier follow psr-12 or something else
- Syntax error when attributes are defined to enum cases
- Class Constants Types PHP 8.3 support HOT 5
- [bug] singleQuote option from API call does not work on latest release
- INC file extension not recognized
- Issue HOT 1
- Adjobscc.io
- Allow attributes to be placed above constructor properties HOT 1
- Invoked import/require callable removes necessary parentheses
- Nguyenthaocc727
- parentheses bug. HOT 2
- does not respect prettier printWidth in overrides since v0.22.0 HOT 2
- Removes brackets from require_once which changes the evaluation of the expression (Laravel 11 index.php)
- Symfony #[Route] Formatting Bug HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin-php.