fix autofmt: don't panic when writing blocks out without a srcfile (#2854)

* fix: don't panic when writing blocks out
* also fix serialization for hotreload
* fix windows line endings
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-08-16 21:55:30 -07:00
1 parent b47a6cf83e
commit 4963aa3118
9 files changed
+142 -46

No files matched your search

+2 -2
View File
@@ -57,9 +57,9 @@ fn make_ws(tx: UnboundedSender<HotReloadMsg>, poll_interval: i32, reload: bool)
// The devserver messages have some &'static strs in them, so we need to leak the source string
let string: String = text.into();
let leaked: &'static str = Box::leak(Box::new(string));
// let leaked: &'static str = Box::leak(Box::new(string));
match serde_json::from_str::<DevserverMsg>(leaked) {
match serde_json::from_str::<DevserverMsg>(&string) {
Ok(DevserverMsg::HotReload(hr)) => _ = tx_.unbounded_send(hr),
// todo: we want to throw a screen here that shows the user that the devserver has disconnected