Home > Mobile >  svelte in vscode is not formatting
svelte in vscode is not formatting

Time:01-16

VSCode is not formatting any *.svelte files for me.

If I format this file, nothing happens. enter image description here

Env:

I have installed the Svelte for VS Code extension. I have tried with all my user settings turned off. All other .vscode settings are working besides svelte formatting.

.vscode/settings.json

{
"explorer.sortOrder": "filesFirst",
"workbench.editor.labelFormat": "short",
"[svelte]": {
    "editor.defaultFormatter": "svelte.svelte-vscode"
},
"svelte.enable-ts-plugin": true,
"svelte.plugin.svelte.defaultScriptLanguage": "ts",
}

/app/.prettierrc

{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

What am I missing?

CodePudding user response:

The trick here is to remove "plugins": ["prettier-plugin-svelte"], from the .prettierrc

I found the solution from https://github.com/sveltejs/language-tools/issues/1820

  • Related