microsoft / vscode-css-languageservice

CSS, LESS & SCSS language service extracted from VSCode to be reused, e.g in the Monaco editor.
MIT License
312 stars 176 forks source link

CSS formatting settings apply in CSS language mode, but not for HTML style tags #382

Closed starball5 closed 5 months ago

starball5 commented 6 months ago

I read here that this is the language service that provides support for CSS language features in HTML style tags. I also noticed that settings like css.format.braceStyle don't seem to apply in style tags in HTML. Is that by design? Is VS Code's builtin HTML language support extension using this service for formatting CSS in style tags? This was brought to my attention due to https://stackoverflow.com/q/77989348/11107541.

aeschli commented 5 months ago

This would have to be fixed in the HTML language server. Currently is uses the same formatter for both HTML and CSS.

It could use the CSS formatter settings, but the CSS and HTML are different extensions, where each can rely on different formatters that have incompatible settings.

So the better approach would be to add additional settings to the html settings.