Fix formatting

This commit is contained in:
Kay Simmons 2023-02-21 21:07:07 -08:00
parent 6b6e4e3bfe
commit 1c69e289b7

View file

@ -84,7 +84,7 @@ use std::{
}; };
pub use sum_tree::Bias; pub use sum_tree::Bias;
use theme::{DiagnosticStyle, Theme}; use theme::{DiagnosticStyle, Theme};
use util::{post_inc, ResultExt, TryFutureExt, RangeExt}; use util::{post_inc, RangeExt, ResultExt, TryFutureExt};
use workspace::{ItemNavHistory, ViewId, Workspace, WorkspaceId}; use workspace::{ItemNavHistory, ViewId, Workspace, WorkspaceId};
use crate::git::diff_hunk_to_display; use crate::git::diff_hunk_to_display;
@ -4806,7 +4806,7 @@ impl Editor {
if !in_bracket_range && best_in_bracket_range { if !in_bracket_range && best_in_bracket_range {
continue; continue;
} }
// Prefer smaller lengths unless best is inside and current isn't // Prefer smaller lengths unless best is inside and current isn't
if length > best_length && (best_inside || !inside) { if length > best_length && (best_inside || !inside) {
continue; continue;
@ -5146,31 +5146,36 @@ impl Editor {
let project = workspace.project().clone(); let project = workspace.project().clone();
let references = project.update(cx, |project, cx| project.references(&buffer, head, cx)); let references = project.update(cx, |project, cx| project.references(&buffer, head, cx));
Some(cx.spawn_labeled("Finding All References...", |workspace, mut cx| async move { Some(cx.spawn_labeled(
let locations = references.await?; "Finding All References...",
if locations.is_empty() { |workspace, mut cx| async move {
return Ok(()); let locations = references.await?;
} if locations.is_empty() {
return Ok(());
}
workspace.update(&mut cx, |workspace, cx| { workspace.update(&mut cx, |workspace, cx| {
let title = locations let title = locations
.first() .first()
.as_ref() .as_ref()
.map(|location| { .map(|location| {
let buffer = location.buffer.read(cx); let buffer = location.buffer.read(cx);
format!( format!(
"References to `{}`", "References to `{}`",
buffer buffer
.text_for_range(location.range.clone()) .text_for_range(location.range.clone())
.collect::<String>() .collect::<String>()
) )
}) })
.unwrap(); .unwrap();
Self::open_locations_in_multibuffer(workspace, locations, replica_id, title, cx); Self::open_locations_in_multibuffer(
}); workspace, locations, replica_id, title, cx,
);
});
Ok(()) Ok(())
})) },
))
} }
/// Opens a multibuffer with the given project locations in it /// Opens a multibuffer with the given project locations in it