prettier-plugin-svelte: Formatting doesn't work (with newly released Prettier v2.1.0)
With Prettier v2.1.0, VSCode stops formatting .svelte
files and the Svelte VSCode extension runs into Error: unknown node type: undefined
pointing to prettier-plugin-svelte
in the stacktrace as culprit.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 20 (3 by maintainers)
Commits related to this issue
- (fix) Make isASTNode function work with prettier 2.1.x This change alters the code such that we are independent of property-changes of both Svelte and Prettier by adding a `__isRoot`-property to the ... — committed to dummdidumm/prettier-plugin-svelte by deleted user 4 years ago
- (fix) Make isASTNode function work with prettier 2.1.x (#125) This change alters the code such that we are independent of property-changes of both Svelte and Prettier by adding a `__isRoot`-property ... — committed to sveltejs/prettier-plugin-svelte by dummdidumm 4 years ago
@michaelwooley cool
Edited : Seems still not working for me (no formatter found etc)
My settings :
What is your configuration @michaelwooley ?
My configuration that works currently :
But I think format on save not working
I was having this same issue and found if I removed the .prettierrc file, then it started working as normal.
Edit: I commented out “plugins”: [“prettier-plugin-svelte”] from the .prettierrc file and saved and the formatting seems to work with just that. Hope this helps!
How to get this working again
101.11.0
or higher installedpackage.json
: If you havesvelte-check
/prettier-plugin-svelte
/svelte-language-server
in there, set them to the latest version. If you don’t have them in there, you don’t have to install themnpm i
/yarn install
)More indepth
We deployed an update of the VSCode extension which contains the v1.1.1 of
prettier-plugin-svelte
. It leaves Prettier at2.0.5
to wait for some more bug fixes, but if you have a different Prettier version in your workspace then that one is used instead.To get formatting again, you also have to update your
prettier-plugin-svelte
version in your workspace, which you have installed if you installedsvelte-check
. Simply updatesvelte-check
for that. If you did not installsvelte-check
orprettier-plugin-svelte
directly, you can skip this.For context, this gist contains my: