Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(css_formatter): format functions and binary expressions #1347

Merged
merged 2 commits into from
Dec 26, 2023

Conversation

faultyserver
Copy link
Contributor

Summary

#1285. Functions and binary expressions can now be formatted, and they should roughly match Prettier's output (the generated IR is very similar, at least, but I haven't stress-tested it yet). Hex colors are also formatted now, and will be printed in lowercase always, thanks to a new utility struct, FormatTokenAsLowercase. As mentioned in #1346, I think there should be a more generic way to lowercase keywords, but this struct is useful in the meantime for handling identifiers that need to only sometimes be converted.

Test Plan

Added tests mostly based off of Prettier's tests for functions. It seems like whitespace-separate parameters for functions aren't parsed quite yet, which leads to verbatim formatting for that in the one spec test for colors. All of the other formatting that changed previously for var and the like seems to be fixed now, as well.

Copy link

netlify bot commented Dec 26, 2023

Deploy Preview for biomejs canceled.

Name Link
🔨 Latest commit eac7570
🔍 Latest deploy log https://app.netlify.com/sites/biomejs/deploys/658b54c018947100082c88b7

@github-actions github-actions bot added A-Formatter Area: formatter L-CSS Language: CSS labels Dec 26, 2023
@faultyserver faultyserver merged commit 3d05420 into main Dec 26, 2023
18 checks passed
@faultyserver faultyserver deleted the faulty/css-functions branch December 26, 2023 22:53
@Conaclos Conaclos added the A-Changelog Area: changelog label Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Formatter Area: formatter L-CSS Language: CSS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants