Treat float values as atoms in CSS

Otherwise we treat `0.5em` as two atoms, unlike `1em` which was
already a single atom.
pull/70/head
Wilfred Hughes 2021-12-04 18:34:24 +07:00
parent 9fbb1a2b78
commit e00f94fed8
4 changed files with 11 additions and 1 deletions

@ -11,6 +11,8 @@ Expanded filename associations, so difftastic recognises more files.
Improved parsing for regex and template string literals in JavaScript
and TypeScript.
Improved parsing for float values in CSS.
Improved word diffing on punctuation in comments.
When logging is enabled (e.g. `RUST_LOG=warn`), difftastic now warns

@ -13,3 +13,7 @@ world */
color: blue;
font-family: "After";
}
.another {
margin-left: 1em;
}

@ -12,3 +12,7 @@ world */
color: yellow;
font-family: "Before";
}
.another {
margin-left: 0.5em;
}

@ -136,7 +136,7 @@ pub fn from_extension(extension: &OsStr) -> Option<TreeSitterConfig> {
"css" => Some(TreeSitterConfig {
name: "CSS",
language: unsafe { tree_sitter_css() },
atom_nodes: (vec!["integer_value"]).into_iter().collect(),
atom_nodes: (vec!["integer_value", "float_value"]).into_iter().collect(),
delimiter_tokens: (vec![("{", "}"), ("(", ")")]),
highlight_queries: include_str!("../vendor/highlights/css.scm"),
}),