mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-17 14:18:27 +00:00
wip: more tweaks
This commit is contained in:
parent
baab2b9b4f
commit
7a6b58d793
4 changed files with 41 additions and 21 deletions
|
@ -46,8 +46,10 @@ flate2 = "1.0.22"
|
|||
tar = "0.4.38"
|
||||
tower = "0.4.12"
|
||||
|
||||
dioxus-rsx = { git = "https://github.com/dioxuslabs/dioxus.git" }
|
||||
dioxus-autofmt = { git = "https://github.com/dioxuslabs/dioxus.git" }
|
||||
dioxus-rsx = { path = "../../dioxus/packages/rsx" }
|
||||
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]]
|
||||
path = "src/main.rs"
|
||||
|
|
|
@ -14,7 +14,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||
}
|
||||
|
||||
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.htmlToDioxusComponent', translateComponent),
|
||||
vscode.commands.registerCommand('extension.formatRsx', fmtSelection),
|
||||
|
|
|
@ -13,6 +13,7 @@ pub struct Autoformat {
|
|||
}
|
||||
|
||||
impl Autoformat {
|
||||
// Todo: autoformat the entire crate
|
||||
pub fn autoformat(self) -> Result<()> {
|
||||
if let Some(raw) = self.raw {
|
||||
if let Some(inner) = dioxus_autofmt::fmt_block(&raw, 0) {
|
||||
|
@ -59,3 +60,17 @@ rsx! {
|
|||
|
||||
dbg!(out);
|
||||
}
|
||||
|
||||
/*
|
||||
parse the whole doc
|
||||
find all the comment blocks
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
|
|
@ -34,26 +34,29 @@ pub async fn startup(config: CrateConfig) -> Result<()> {
|
|||
|
||||
// file watcher: check file change
|
||||
let watcher_conf = config.clone();
|
||||
let mut watcher = RecommendedWatcher::new(move |_: notify::Result<notify::Event>| {
|
||||
if chrono::Local::now().timestamp() > last_update_time {
|
||||
log::info!("Start to rebuild project...");
|
||||
if builder::build(&watcher_conf).is_ok() {
|
||||
// change the websocket reload state to true;
|
||||
// the page will auto-reload.
|
||||
if watcher_conf
|
||||
.dioxus_config
|
||||
.web
|
||||
.watcher
|
||||
.reload_html
|
||||
.unwrap_or(false)
|
||||
{
|
||||
let _ = Serve::regen_dev_page(&watcher_conf);
|
||||
let mut watcher = RecommendedWatcher::new(
|
||||
move |_: notify::Result<notify::Event>| {
|
||||
if chrono::Local::now().timestamp() > last_update_time {
|
||||
log::info!("Start to rebuild project...");
|
||||
if builder::build(&watcher_conf).is_ok() {
|
||||
// change the websocket reload state to true;
|
||||
// the page will auto-reload.
|
||||
if watcher_conf
|
||||
.dioxus_config
|
||||
.web
|
||||
.watcher
|
||||
.reload_html
|
||||
.unwrap_or(false)
|
||||
{
|
||||
let _ = Serve::regen_dev_page(&watcher_conf);
|
||||
}
|
||||
let _ = reload_tx.send("reload".into());
|
||||
last_update_time = chrono::Local::now().timestamp();
|
||||
}
|
||||
let _ = reload_tx.send("reload".into());
|
||||
last_update_time = chrono::Local::now().timestamp();
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
notify::Config::default(),
|
||||
)
|
||||
.unwrap();
|
||||
let allow_watch_path = config
|
||||
.dioxus_config
|
||||
|
|
Loading…
Add table
Reference in a new issue