You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to use plugin with Prettier 2.0 (TypeError: locEnd is not a function) #1352
Just happen to have bad timing on my part and was troubleshooting getting the plugin working. In the end i realized that a new version of Prettier was just published and it seems to break this plugin. I didn't see another issue open for this so i hope this isn't a dupe.
Error
yarn prettier tests/Feature/ExampleTest.php --check
yarn run v1.22.4
$ prettier tests/Feature/ExampleTest.php --check
Checking formatting...
tests/Feature/ExampleTest.php[error] tests/Feature/ExampleTest.php: TypeError: locEnd is not a function
[error] at getNextNonSpaceNonCommentCharacterIndex (/Users/jeffbeltran/code/foo/node_modules/prettier/index.js:12223:70)
[error] at handleLastFunctionArgComments (/Users/jeffbeltran/code/foo/node_modules/@prettier/plugin-php/src/comments.js:285:25)
[error] at handleOwnLineComment (/Users/jeffbeltran/code/foo/node_modules/@prettier/plugin-php/src/comments.js:45:5)
[error] at /Users/jeffbeltran/code/foo/node_modules/prettier/bin-prettier.js:13942:11
[error] at Array.forEach (<anonymous>)
[error] at Object.attach (/Users/jeffbeltran/code/foo/node_modules/prettier/bin-prettier.js:13913:12)
[error] at attachComments (/Users/jeffbeltran/code/foo/node_modules/prettier/bin-prettier.js:14771:14)
[error] at coreFormat (/Users/jeffbeltran/code/foo/node_modules/prettier/bin-prettier.js:14802:23)
[error] at format (/Users/jeffbeltran/code/foo/node_modules/prettier/bin-prettier.js:15024:75)
[error] at formatWithCursor (/Users/jeffbeltran/code/foo/node_modules/prettier/bin-prettier.js:15040:12)
All matched files use Prettier code style!
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Fix
downgrading to 1.19.1 fixes this error.
Reacted by u3u, Gustav Hansen, Aarni Koskela, Milos Hrelja, Kristijan, Alec Rust, Matthias Günter, John Gile, Derek Parsons and Kay Gosho
@entozoon Thats probably because the brach has been merged and deleted. Until a new version has been released, you’ll have to install the master branch. I’m on my phone right now so I can’t test, but it’s probably
😊 Thank you so much @entozoon! I'll use this opportunity to forward your praise to everyone else who helped make this happen, especially @ichiriac@loilo and @evilebottnawi: It's fun to work with you on this, you rock! 💯
Activity
czosel commentedon Mar 23, 2020
Thanks for the bug report! I already expected this to happen when I saw the release on twitter the other day, but you're the first to report it 😉
czosel commentedon Mar 25, 2020
I opened a PR to fix this, if you want to try it run
yarn add czosel/plugin-php#prettier-2.0🎉kevinpainchaud commentedon Mar 28, 2020
It works for me. Thank you very much !
entozoon commentedon Mar 29, 2020
@czosel Your #prettier-2.0 branch was working when you suggested it a few days ago but isn't anymore.
And the main repo doesn't fix the problem either
czosel commentedon Mar 29, 2020
@entozoon Thats probably because the brach has been merged and deleted. Until a new version has been released, you’ll have to install the master branch. I’m on my phone right now so I can’t test, but it’s probably
yarn add @prettier/plugin-php#master
czosel commentedon Mar 31, 2020
We just released
v0.14.0which fixes this issue, and many more! 🎉https://github.com/prettier/plugin-php/releases
entozoon commentedon Apr 1, 2020
Fantastic work @czosel, you're a legend. Can confirm it works perfectly!
czosel commentedon Apr 1, 2020
😊 Thank you so much @entozoon! I'll use this opportunity to forward your praise to everyone else who helped make this happen, especially @ichiriac @loilo and @evilebottnawi: It's fun to work with you on this, you rock! 💯