More progress and some debug logs to remove

Conrad Irwin created

Change summary

assets/settings/default.json      |  2 +-
crates/util/src/channel.rs        |  6 +++---
crates/workspace/src/workspace.rs | 21 +++++++++++++++++++--
crates/zed/src/main.rs            | 10 ++++++++++
crates/zed/src/open_url.rs        | 13 +++++++++++++
5 files changed, 46 insertions(+), 6 deletions(-)

Detailed changes

assets/settings/default.json 🔗

@@ -76,7 +76,7 @@
   // Settings related to calls in Zed
   "calls": {
     // Join calls with the microphone muted by default
-    "mute_on_join": true
+    "mute_on_join": false
   },
   // Scrollbar related settings
   "scrollbar": {

crates/util/src/channel.rs 🔗

@@ -44,9 +44,9 @@ impl ReleaseChannel {
 
     pub fn url_scheme(&self) -> &'static str {
         match self {
-            ReleaseChannel::Dev => "zed-dev:/",
-            ReleaseChannel::Preview => "zed-preview:/",
-            ReleaseChannel::Stable => "zed:/",
+            ReleaseChannel::Dev => "zed-dev://",
+            ReleaseChannel::Preview => "zed-preview://",
+            ReleaseChannel::Stable => "zed://",
         }
     }
 

crates/workspace/src/workspace.rs 🔗

@@ -47,6 +47,7 @@ use std::{
     any::TypeId,
     borrow::Cow,
     cmp, env,
+    fs::OpenOptions,
     future::Future,
     path::{Path, PathBuf},
     rc::Rc,
@@ -4161,6 +4162,7 @@ async fn join_channel_internal(
     active_call: &ModelHandle<ActiveCall>,
     cx: &mut AsyncAppContext,
 ) -> Result<bool> {
+    dbg!("join channel internal");
     let should_prompt = active_call.read_with(cx, |active_call, cx| {
         let Some(room) = active_call.room().map(|room| room.read(cx)) else {
             return false;
@@ -4193,6 +4195,7 @@ async fn join_channel_internal(
             return Ok(false); // unreachable!() hopefully
         }
     }
+    dbg!("asdajdkjkasd");
 
     let client = cx.read(|cx| active_call.read(cx).client());
 
@@ -4218,13 +4221,17 @@ async fn join_channel_internal(
         }
     }
 
+    dbg!("past here");
+
     let room = active_call
         .update(cx, |active_call, cx| {
             active_call.join_channel(channel_id, cx)
         })
         .await?;
 
-    room.update(cx, |room, cx| room.next_room_update()).await;
+    room.update(cx, |room, _| room.next_room_update()).await;
+
+    dbg!("wow");
 
     let task = room.update(cx, |room, cx| {
         if let Some((project, host)) = room.most_active_project() {
@@ -4237,7 +4244,16 @@ async fn join_channel_internal(
         task.await?;
         return anyhow::Ok(true);
     }
-
+    use std::io::Write;
+    writeln!(
+        OpenOptions::new()
+            .write(true)
+            .append(true)
+            .open("/Users/conrad/dbg")
+            .unwrap(),
+        "no jokes"
+    )
+    .unwrap();
     anyhow::Ok(false)
 }
 
@@ -4257,6 +4273,7 @@ pub fn join_channel(
             &mut cx,
         )
         .await;
+        dbg!("joined!");
 
         // join channel succeeded, and opened a window
         if matches!(result, Ok(true)) {

crates/zed/src/main.rs 🔗

@@ -66,6 +66,15 @@ use crate::open_url::{OpenListener, OpenRequest};
 mod open_url;
 
 fn main() {
+    writeln!(
+        OpenOptions::new()
+            .write(true)
+            .append(true)
+            .open("/Users/conrad/dbg")
+            .unwrap(),
+        "HELLO"
+    )
+    .unwrap();
     let http = http::client();
     init_paths();
     init_logger();
@@ -270,6 +279,7 @@ fn main() {
                         }
                         OpenRequest::JoinChannel { channel_id } => cx
                             .update(|cx| {
+                                dbg!("joining channel");
                                 workspace::join_channel(channel_id, app_state.clone(), None, cx)
                             })
                             .detach(),

crates/zed/src/open_url.rs 🔗

@@ -3,6 +3,8 @@ use cli::{ipc::IpcSender, CliRequest, CliResponse};
 use futures::channel::mpsc;
 use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};
 use std::ffi::OsStr;
+use std::fs::OpenOptions;
+use std::io::Write;
 use std::os::unix::prelude::OsStrExt;
 use std::sync::atomic::Ordering;
 use std::{path::PathBuf, sync::atomic::AtomicBool};
@@ -41,6 +43,16 @@ impl OpenListener {
     }
 
     pub fn open_urls(&self, urls: Vec<String>) {
+        writeln!(
+            OpenOptions::new()
+                .write(true)
+                .append(true)
+                .open("/Users/conrad/dbg")
+                .unwrap(),
+            "{:?}",
+            &urls,
+        )
+        .unwrap();
         self.triggered.store(true, Ordering::Release);
         let request = if let Some(server_name) =
             urls.first().and_then(|url| url.strip_prefix("zed-cli://"))
@@ -79,6 +91,7 @@ impl OpenListener {
                 }
             }
         }
+        log::error!("invalid zed url: {}", request_path);
         None
     }