fix: even better comment handling
This commit is contained in:
1 parent
47f3cc2529
commit
4471ccba49
8 files changed
+115
-73
No files matched your search
@@ -30,3 +30,13 @@ fn comment_case_work() {
|
||||
|
||||
println!("{}", out);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn comment_attr_case_work() {
|
||||
let src = include_str!("./samples/attrs.rsx");
|
||||
|
||||
let formatted = dioxus_autofmt::fmt_file(src);
|
||||
let out = dioxus_autofmt::apply_formats(src, formatted);
|
||||
|
||||
println!("{}", out);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#![allow(unused)]
|
||||
|
||||
const SRC: &str = include_str!("./samples/all.rsx");
|
||||
|
||||
fn body() -> &'static str {
|
||||
&SRC[6..SRC.len() - 3]
|
||||
}
|
||||
|
||||
fn unindented_body() -> String {
|
||||
body()
|
||||
.lines()
|
||||
.map(|line| match line.strip_prefix(" ") {
|
||||
Some(line) => line,
|
||||
None => line,
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn way_and_back() {
|
||||
let blocks = dioxus_autofmt::fmt_file(SRC).into_iter().next().unwrap();
|
||||
|
||||
println!("{}", blocks.formatted);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
rsx! {
|
||||
div {
|
||||
// My comment here 1
|
||||
// My comment here 2
|
||||
// My comment here 3
|
||||
// My comment here 4
|
||||
class: "asdasd",
|
||||
|
||||
// Comment here
|
||||
onclick: move |_| {
|
||||
let a = 10;
|
||||
let b = 40;
|
||||
let c = 50;
|
||||
},
|
||||
|
||||
// my comment
|
||||
|
||||
// This here
|
||||
"hi"
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,12 @@ rsx! {
|
||||
// body
|
||||
div { "text" }
|
||||
|
||||
div {
|
||||
// Attr
|
||||
class: "asdads",
|
||||
"health"
|
||||
}
|
||||
|
||||
div {
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user