From ccace3f06f4bc289f787501e1bd0f8075fb61b65 Mon Sep 17 00:00:00 2001 From: Thibaut Decombe <68703331+UnknownPlatypus@users.noreply.github.com> Date: Fri, 30 Aug 2024 09:55:09 +0200 Subject: [PATCH] feat: update whitespace-sensitivity detection (#45) --- .../tests/integration/biome/quotes.vue.snap | 3 +- .../integration/dprint_ts/quotes.vue.snap | 5 +-- markup_fmt/src/helpers.rs | 7 ++- .../tests/fmt/html/attributes/boolean.snap | 45 +++++++++++-------- .../fmt/html/tags/menu.small-print-width.snap | 12 +++-- .../html/tags/search.small-print-width.snap | 4 +- .../tests/fmt/html/tags/tags.default.snap | 10 +++-- .../fmt/html/tags/tags.small-print-width.snap | 20 ++++++--- .../tests/fmt/html/tags/tags2.default.snap | 10 +---- .../html/tags/tags2.small-print-width.snap | 6 ++- .../html/whitespace/display-inline-block.snap | 25 ++++++----- .../tests/fmt/vue/quotes/mixed.double.snap | 5 +-- .../tests/fmt/vue/quotes/mixed.single.snap | 5 +-- 13 files changed, 94 insertions(+), 63 deletions(-) diff --git a/dprint_plugin/tests/integration/biome/quotes.vue.snap b/dprint_plugin/tests/integration/biome/quotes.vue.snap index 3e9ca7b..082bda6 100644 --- a/dprint_plugin/tests/integration/biome/quotes.vue.snap +++ b/dprint_plugin/tests/integration/biome/quotes.vue.snap @@ -7,7 +7,8 @@ source: dprint_plugin/tests/integration.rs + > + diff --git a/dprint_plugin/tests/integration/dprint_ts/quotes.vue.snap b/dprint_plugin/tests/integration/dprint_ts/quotes.vue.snap index 1c58d00..179ab63 100644 --- a/dprint_plugin/tests/integration/dprint_ts/quotes.vue.snap +++ b/dprint_plugin/tests/integration/dprint_ts/quotes.vue.snap @@ -5,9 +5,8 @@ source: dprint_plugin/tests/integration.rs
- + diff --git a/markup_fmt/src/helpers.rs b/markup_fmt/src/helpers.rs index 2b55b68..95f04de 100644 --- a/markup_fmt/src/helpers.rs +++ b/markup_fmt/src/helpers.rs @@ -4,10 +4,13 @@ pub(crate) fn is_component(name: &str) -> bool { name.contains('-') || name.contains(|c: char| c.is_ascii_uppercase()) } -static NON_WS_SENSITIVE_TAGS: [&str; 69] = [ +static NON_WS_SENSITIVE_TAGS: [&str; 74] = [ "address", "blockquote", + "button", + "caption", "center", + "colgroup", "dialog", "div", "figure", @@ -25,6 +28,7 @@ static NON_WS_SENSITIVE_TAGS: [&str; 69] = [ "p", "plaintext", "pre", + "progress", "search", "object", "details", @@ -37,6 +41,7 @@ static NON_WS_SENSITIVE_TAGS: [&str; 69] = [ "head", "link", "meta", + "meter", "noembed", "noframes", "param", diff --git a/markup_fmt/tests/fmt/html/attributes/boolean.snap b/markup_fmt/tests/fmt/html/attributes/boolean.snap index 3f27d29..cef57e0 100644 --- a/markup_fmt/tests/fmt/html/attributes/boolean.snap +++ b/markup_fmt/tests/fmt/html/attributes/boolean.snap @@ -5,24 +5,33 @@ source: markup_fmt/tests/fmt.rs - - - - - - - - - + + + + + + + + + diff --git a/markup_fmt/tests/fmt/html/tags/menu.small-print-width.snap b/markup_fmt/tests/fmt/html/tags/menu.small-print-width.snap index 4a1868c..d16cf0d 100644 --- a/markup_fmt/tests/fmt/html/tags/menu.small-print-width.snap +++ b/markup_fmt/tests/fmt/html/tags/menu.small-print-width.snap @@ -7,7 +7,9 @@ source: markup_fmt/tests/fmt.rs > + Copy + @@ -15,7 +17,9 @@ source: markup_fmt/tests/fmt.rs > + Cut + @@ -23,7 +27,9 @@ source: markup_fmt/tests/fmt.rs > + Paste + diff --git a/markup_fmt/tests/fmt/html/tags/search.small-print-width.snap b/markup_fmt/tests/fmt/html/tags/search.small-print-width.snap index a3a825e..552f701 100644 --- a/markup_fmt/tests/fmt/html/tags/search.small-print-width.snap +++ b/markup_fmt/tests/fmt/html/tags/search.small-print-width.snap @@ -58,7 +58,9 @@ source: markup_fmt/tests/fmt.rs > + Go! + diff --git a/markup_fmt/tests/fmt/html/tags/tags.default.snap b/markup_fmt/tests/fmt/html/tags/tags.default.snap index 21c2878..7ee84a8 100644 --- a/markup_fmt/tests/fmt/html/tags/tags.default.snap +++ b/markup_fmt/tests/fmt/html/tags/tags.default.snap @@ -133,14 +133,16 @@ source: markup_fmt/tests/fmt.rs
"" is the property bound title.
diff --git a/markup_fmt/tests/fmt/html/tags/tags.small-print-width.snap b/markup_fmt/tests/fmt/html/tags/tags.small-print-width.snap
index 47c5efb..ec131ef 100644
--- a/markup_fmt/tests/fmt/html/tags/tags.small-print-width.snap
+++ b/markup_fmt/tests/fmt/html/tags/tags.small-print-width.snap
@@ -374,7 +374,9 @@ source: markup_fmt/tests/fmt.rs
/>
+ 12345678901234567890
+
Disabled
- Cancel
+ Disabled
+ Cancel
+
+ 12345678901234567890
+
Disabled
- Cancel
+ Disabled
+ Cancel
+