wip: more tweaks

This commit is contained in:
Jonathan Kelley committed 2022-11-14 18:09:09 -08:00
1 parent baab2b9b4f
commit 7a6b58d793
4 files changed
+25 -5

No files matched your search

+4 -2
View File
@@ -46,8 +46,10 @@ flate2 = "1.0.22"
tar = "0.4.38" tar = "0.4.38"
tower = "0.4.12" tower = "0.4.12"
dioxus-rsx = { git = "https://github.com/dioxuslabs/dioxus.git" } dioxus-rsx = { path = "../../dioxus/packages/rsx" }
dioxus-autofmt = { git = "https://github.com/dioxuslabs/dioxus.git" } dioxus-autofmt = { path = "../../dioxus/packages/autofmt" }
# dioxus-rsx = { git = "https://github.com/dioxuslabs/dioxus.git" }
# dioxus-autofmt = { git = "https://github.com/dioxuslabs/dioxus.git" }
[[bin]] [[bin]]
path = "src/main.rs" path = "src/main.rs"
+1 -1
View File
@@ -14,7 +14,7 @@ export async function activate(context: vscode.ExtensionContext) {
} }
context.subscriptions.push( context.subscriptions.push(
vscode.commands.registerTextEditorCommand('editor.action.clipboardPasteAction', onPasteHandler), // vscode.commands.registerTextEditorCommand('editor.action.clipboardPasteAction', onPasteHandler),
vscode.commands.registerCommand('extension.htmlToDioxusRsx', translateBlock), vscode.commands.registerCommand('extension.htmlToDioxusRsx', translateBlock),
vscode.commands.registerCommand('extension.htmlToDioxusComponent', translateComponent), vscode.commands.registerCommand('extension.htmlToDioxusComponent', translateComponent),
vscode.commands.registerCommand('extension.formatRsx', fmtSelection), vscode.commands.registerCommand('extension.formatRsx', fmtSelection),
+15
View File
@@ -13,6 +13,7 @@ pub struct Autoformat {
} }
impl Autoformat { impl Autoformat {
// Todo: autoformat the entire crate
pub fn autoformat(self) -> Result<()> { pub fn autoformat(self) -> Result<()> {
if let Some(raw) = self.raw { if let Some(raw) = self.raw {
if let Some(inner) = dioxus_autofmt::fmt_block(&raw, 0) { if let Some(inner) = dioxus_autofmt::fmt_block(&raw, 0) {
@@ -59,3 +60,17 @@ rsx! {
dbg!(out); dbg!(out);
} }
/*
parse the whole doc
find all the comment blocks
*/
+5 -2
View File
@@ -34,7 +34,8 @@ pub async fn startup(config: CrateConfig) -> Result<()> {
// file watcher: check file change // file watcher: check file change
let watcher_conf = config.clone(); let watcher_conf = config.clone();
let mut watcher = RecommendedWatcher::new(move |_: notify::Result<notify::Event>| { let mut watcher = RecommendedWatcher::new(
move |_: notify::Result<notify::Event>| {
if chrono::Local::now().timestamp() > last_update_time { if chrono::Local::now().timestamp() > last_update_time {
log::info!("Start to rebuild project..."); log::info!("Start to rebuild project...");
if builder::build(&watcher_conf).is_ok() { if builder::build(&watcher_conf).is_ok() {
@@ -53,7 +54,9 @@ pub async fn startup(config: CrateConfig) -> Result<()> {
last_update_time = chrono::Local::now().timestamp(); last_update_time = chrono::Local::now().timestamp();
} }
} }
}) },
notify::Config::default(),
)
.unwrap(); .unwrap();
let allow_watch_path = config let allow_watch_path = config
.dioxus_config .dioxus_config