Skip to content

svelte-vscode's readme is confusing because it is incomplete and/or outdated, Edit: actually the entire prettier setup is confusing #2234

@205g0

Description

@205g0

you must have in your .prettier.rc:

  "plugins": ["prettier-plugin-svelte"], // this is surprisingly not needed, still you need to npm i that, match the version of your prettier version
  "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] this is needed!

(this is stated in prettier-plugin-svelte readme but latter is not the one you see when installing the extension and also there they ask to put the plugins line which is also not needed)

what the svelte-vscode readme states: adjust your VS Code settings:

 "[svelte]": { // not needed
   "editor.defaultFormatter": "svelte.svelte-vscode" / not needed
 },

is not needed and doesn't help without the .prettier.rc additions above

and most important: since prettier isn't formatting your .svelte files but this plugin does, do not be confused by this:
image
THIS IS NORMAL for svelte files yeah super confusing ux but yeah, i still find the reasoning more than confusing, so prettier does not deal with your svelte file directly but behind the curtains it does (just not as the prettier extension 39.4 million users have installed)

since this readme is also used in the store and it's the first thing you see once you install it, i find that the current version should be updated because i wasted one hour to get this working. in contrast most lang-tools for other langs just work in vs code after one click

but that's your call, i can do the pr if time is short on your side

Reproduction

n.a.

Expected behaviour

n.a.

System Info

n.a.

Which package is the issue about?

svelte-vscode

Additional Information, eg. Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions