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

Migrate to Prettier v3 #2762

Closed
sosukesuzuki opened this issue Oct 23, 2022 · 8 comments
Closed

Migrate to Prettier v3 #2762

sosukesuzuki opened this issue Oct 23, 2022 · 8 comments
Labels
enhancement locked Please open a new issue and fill out the template instead of commenting.

Comments

@sosukesuzuki
Copy link
Member

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
N/A

Describe the solution you'd like
A clear and concise description of what you want to happen.
N/A

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
N/A

Additional context
Sorry ignoring the issue template..

Hi, I am a maintainer at Prettier.

The Prettier team is currently working on v3 (still alpha).
v3 will include breaking changes. (Detailed changelog is here: https://github.com/prettier/prettier/releases/tag/3.0.0-alpha.1)

For example, the all of public APIs will be async (changelog) and exported file structures are changed (changelog). prettier-vscode will probably affected by these changes.

If you have any questions, feel free to mention us. We can help you.

If you have already migrated to Prettier v3, sorry but please close this issue.

@kachkaev
Copy link
Member

kachkaev commented Nov 5, 2022

👋 @ntotten! If you need a test repo, feel free to use gicentre/prettier-plugin-elm. I bumped this project to Prettier 3.0.0-alpha.4 in gicentre/prettier-plugin-elm#36. Also using prettier-plugin-packagejson internally to keep dependencies sorted. This plugin gets picked up by V3 in CLI, just as before (yarn fix:prettier). VSCode formatting does nothing, probably because format returns a promise instead of a string.

@polRk
Copy link

polRk commented Nov 19, 2022

Instead change the require of prettier.config.js in /Users/20265375/.vscode/extensions/esbenp.prettier-vscode-9.9.0/node_modules/prettier/third-party.js to a dynamic import() which is available in all CommonJS modules.

@Janther
Copy link

Janther commented Dec 30, 2022

I'm developing on a project that is using 3.0.0-alpha.4 and this extension stopped working because of what @kachkaev said

VSCode formatting does nothing, probably because format returns a promise instead of a string.

it could also be that Prettier V3 uses ESM and Prettier V2 uses commonJs.

Maybe a quick fix for now could be to check the version of prettier installed in the local project, you could do it just by reading the package.json file first and if it's 3.0.0 just use the Prettier version in your extension until you fully support V3.

@kachkaev
Copy link
Member

kachkaev commented Dec 30, 2022

Maybe a quick fix for now could be to check the version of prettier installed in the local project

Not sure if there is a need for that. If a new version of VSCode extension uses await format(...), that should work for any version of Prettier. Using await notAPromise is OK.

@kachkaev
Copy link
Member

#2947 by @sosukesuzuki is a step in this direction. It unlocks usage of Prettier v3 by the extension and should unblock folks why are using 3.0.0 alpha locally.

@ntotten
Copy link
Member

ntotten commented Apr 22, 2023

This is shipped in the latest release.

@ntotten ntotten closed this as completed Apr 22, 2023
@kachkaev
Copy link
Member

kachkaev commented Apr 22, 2023

@ntotten I guess that this issue is about using Prettier 3 internally, i.e. when local or global Prettier is not found. 9.12.0 adds support for Prettier 3, but does not embed Prettier 3 into the extension.

UPD Prettier 3 does not work in 9.12.0, see #2947 (comment) and below

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

No branches or pull requests

5 participants