Configuration help
See original GitHub issueHi! Sorry if this is really basic, but I have difficulties configuring prettier-plugin-svelte with a configuration file in VS Code. The Svelte extension is installed and I created a prettierrc.json
file like so:
{
"trailingComma": "es5",
"tabWidth": 2,
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"printWidth": 80,
"singleQuote": false,
"svelteSortOrder" : "scripts-markup-styles",
"svelteStrictMode": true,
"svelteBracketNewLine": false,
"svelteAllowShorthand": false
}
Some configuration is for standard Prettier with JS. However, whatever the values I use for the svelte options, it doesn’t seem to make any difference when I format a .svelte file. For example, even with "svelteAllowShorthand: false"
, the shorthand {id}
won’t be reformatted to id={id}
:
<div class="ui input" class:transparent="{!focussed}" {id}>
Thanks for your kind help!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Configuration Editor for Firefox - Mozilla Support
The Configuration Editor (about:config page) lets you view, change, or reset advanced preference settings in Firefox. Learn more.
Read more >Learn about the Android Device Configuration Service
The Android Device Configuration Service periodically sends data from Android devices to Google. This data helps Google ensure that your device remains ...
Read more >Find help for using Configuration Manager - Microsoft Learn
There are several resources that you can use to find help with Configuration Manager. Whether you're just getting started or an experienced ...
Read more >Configuration help - Selenium
Configuration help. Get information about all the available options to configure Grid. The help commands display information based on the ...
Read more >OCLC Service Configuration guide
In OCLC Service Configuration, manage your institution's IP address ranges and attributes for OCLC products and services.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In case anyone else stumbles upon this (I wasn’t able to enable “Format on Save”): Since the launch of the official svelte vs-code plugin, the defaultFormatter is no longer called
JamesBirtles.svelte-vscode
butsvelte.svelte-vscode
.So this works for me in
.editor/settings.json
:Well, I’ve finally found how to configure VSCode to format Svelte files properly. This article (VS Code Set Up at the bottom) helped me find the missing piece in the process. I only needed the
svelte-vscode
extension, then specify the default formatter for Svelte files in VS Code settings:Now, when I use the
Format document
command (with keyboard shortcut) or when I save withFormat on save
setting enabled, everything falls neatly into place. Great!And if, like me, you didn’t know how to open the settings as JSON to specify this configuration, when in the settings window, there’s a button in the upper right corner that allows to do so.
Seems to be working just fine now… I didn’t see any mention of this in this extension’s documentation, nor in svelte-vscode one. Would be a great addition!