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
This commit is contained in:
@@ -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<Location> = 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<Self> =
|
||||
|
||||
Reference in New Issue
Block a user