Skip to content

Forward css.format.* settings to js-beautify's CSS sub-formatter#238

Merged
aeschli merged 1 commit intomicrosoft:mainfrom
NikhiltGhalme:fix/forward-css-format-options
Apr 10, 2026
Merged

Forward css.format.* settings to js-beautify's CSS sub-formatter#238
aeschli merged 1 commit intomicrosoft:mainfrom
NikhiltGhalme:fix/forward-css-format-options

Conversation

@NikhiltGhalme
Copy link
Copy Markdown
Contributor

The HTML formatter uses js-beautify which already supports CSS formatting options via a css sub-object, but HTMLFormatConfiguration never passed them through. This caused css.format.newlineBetweenSelectors, newlineBetweenRules, and other CSS settings to be ignored when formatting embedded CSS in <style> tags.

  • Add EmbeddedCSSFormatConfiguration interface to HTMLFormatConfiguration
  • Map camelCase CSS options to snake_case js-beautify options in htmlFormatter
  • Add css property to IBeautifyHTMLOptions type declaration
  • Add tests for embedded CSS formatting options

Fixes microsoft/vscode#283316

The HTML formatter uses js-beautify which already supports CSS formatting
options via a css sub-object, but HTMLFormatConfiguration never passed them
through. This caused css.format.newlineBetweenSelectors, newlineBetweenRules,
and other CSS settings to be ignored when formatting embedded CSS in
<style> tags.

- Add EmbeddedCSSFormatConfiguration interface to HTMLFormatConfiguration
- Map camelCase CSS options to snake_case js-beautify options in htmlFormatter
- Add css property to IBeautifyHTMLOptions type declaration
- Add tests for embedded CSS formatting options

Fixes microsoft/vscode#283316
@NikhiltGhalme
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@aeschli aeschli enabled auto-merge (squash) April 10, 2026 08:02
@aeschli
Copy link
Copy Markdown
Collaborator

aeschli commented Apr 10, 2026

Thanks @NikhiltGhalme !

@aeschli aeschli merged commit a2b1815 into microsoft:main Apr 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

css formating config not apply to style tag in html during format html file.

3 participants