-
-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(css_formatter): keep @charset double quote in single quote config
- Loading branch information
1 parent
6c209ef
commit 5292897
Showing
6 changed files
with
70 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
use crate::{prelude::*, utils::string_utils::FormatLiteralStringToken}; | ||
use biome_css_syntax::{CssString, CssStringFields}; | ||
use crate::{prelude::*, utils::string_utils::{FormatLiteralStringToken, StringLiteralParentKind}}; | ||
use biome_css_syntax::{CssString, CssStringFields, CssSyntaxKind}; | ||
use biome_formatter::write; | ||
use biome_rowan::SyntaxNodeOptionExt; | ||
|
||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatCssString; | ||
impl FormatNodeRule<CssString> for FormatCssString { | ||
fn fmt_fields(&self, node: &CssString, f: &mut CssFormatter) -> FormatResult<()> { | ||
let CssStringFields { value_token } = node.as_fields(); | ||
|
||
write!(f, [FormatLiteralStringToken::new(&value_token?)]) | ||
if matches!(node.syntax().parent().kind(), Some(CssSyntaxKind::CSS_CHARSET_AT_RULE)) { | ||
write!(f, [FormatLiteralStringToken::new(&value_token?, StringLiteralParentKind::CharsetAtRule)]) | ||
} else { | ||
write!(f, [FormatLiteralStringToken::new(&value_token?, StringLiteralParentKind::Others)]) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters