language-tools: Format on save not working as expected

Describe the bug When a .svelte document is formatted on save the indentation does not change.

To Reproduce

  1. Install Svelte Beta for VScode.
  2. Open any .svelte file
  3. Save (make sure “format on save” is enabled in VScode settings).

Expected behavior I expect the code to be formatted on save.

Screenshots An example of code not being formatted below. CleanShot 2020-06-24 at 12 17 15@2x

System (please complete the following information):

  • OS: Mac
  • IDE: VScode
  • Plugin/Package: Svelte Beta

Additional context I’m using this with .editorconfig.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Did you set the default to all the file type?

Yes i did. I’m pretty new to VSCode…
Now i use following Settings, which works like a charm:

  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[svelte]": {
    "editor.defaultFormatter": "svelte.svelte-vscode"
  },

Thank you all for solving this Issue!

Thanks for clarifying those points. If I get chance I’ll try re-installing VScode and trying to reproduce the issue.

I do have the same error. The code does not get modified on save.
This only occurs in .svelte files, other files will get auto-formatted on save.
My Output->Svelte only prints the Line Using Svelte v3.24.0 from ....
Output->Prettier keeps empty on .svelte files, but works as expected and fills output on other files (eg: js, ts, …)

Triggered via console prettier --write "**/*.{css,html,js,json,md,scss,svelte,ts,yml}", svelte files will get auto-formatted - but not after save in vs-code.