feat: fix bug with applying multiple edits in sequence

This commit is contained in:
Jonathan Kelley committed 2022-04-26 18:45:27 -04:00
1 parent 84f0245f6c
commit 201dcc144d
4 files changed
+120 -16

No files matched your search

+37 -1
View File
@@ -3,9 +3,13 @@ use super::*;
/// Build the Rust WASM app and all of its assets.
#[derive(Clone, Debug, Parser)]
pub struct Autoformat {
/// Input file
/// Input rsx (selection)
#[clap(short, long)]
pub raw: Option<String>,
/// Input file
#[clap(short, long)]
pub file: Option<String>,
}
impl Autoformat {
@@ -20,6 +24,38 @@ impl Autoformat {
}
}
if let Some(file) = self.file {
let edits = dioxus_autofmt::get_format_blocks(&file);
let as_json = serde_json::to_string(&edits).unwrap();
println!("{}", as_json);
}
Ok(())
}
}
#[test]
fn spawn_properly() {
let out = Command::new("dioxus")
.args([
"fmt",
"-f",
r#"
//
rsx! {
div {}
}
//
//
//
"#,
])
.output()
.expect("failed to execute process");
dbg!(out);
}