From 7ef45914e85c4b9588b1b32418b843678ef2dc40 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Mon, 8 Dec 2025 14:36:39 +0100 Subject: [PATCH] editor: Fix link navigation within editors that don't have a workspace (#44389) This mostly affects Channel Notes, but due to a change in https://github.com/zed-industries/zed/pull/43921 we were short-circuiting before opening links. I moved the workspace checks back to right before we need them so that we still follow the same control flow as usual for these editors. Closes #44207 Release Notes: - N/A --- crates/editor/src/editor.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 2df5a5d38367b564f0f888059533ccdfae3a6919..12b591e78054678d7ef4e8735d625e55ae96bc50 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -17043,9 +17043,7 @@ impl Editor { }) .collect(); - let Some(workspace) = self.workspace() else { - return Task::ready(Ok(Navigated::No)); - }; + let workspace = self.workspace(); cx.spawn_in(window, async move |editor, cx| { let locations: Vec = future::join_all(definitions) @@ -17100,6 +17098,10 @@ impl Editor { }) .context("buffer title")?; + let Some(workspace) = workspace else { + return Ok(Navigated::No); + }; + let opened = workspace .update_in(cx, |workspace, window, cx| { let allow_preview = PreviewTabsSettings::get_global(cx) @@ -17129,6 +17131,9 @@ impl Editor { // TODO(andrew): respect preview tab settings // `enable_keep_preview_on_code_navigation` and // `enable_preview_file_from_code_navigation` + let Some(workspace) = workspace else { + return Ok(Navigated::No); + }; workspace .update_in(cx, |workspace, window, cx| { workspace.open_resolved_path(path, window, cx) @@ -17152,6 +17157,9 @@ impl Editor { { editor.go_to_singleton_buffer_range(range, window, cx); } else { + let Some(workspace) = workspace else { + return Navigated::No; + }; let pane = workspace.read(cx).active_pane().clone(); window.defer(cx, move |window, cx| { let target_editor: Entity =