Remove unnecessary deferred conditional

Co-authored-by: David Kleingeld <davidsk@zed.dev>
This commit is contained in:
Richard Feldman 2025-08-25 11:07:03 -04:00
parent c44f9dfb17
commit 4df010d33a
No known key found for this signature in database

View file

@ -334,7 +334,7 @@ pub fn update_inlay_link_and_hover_points(
let excerpt_id = hovered_hint.position.excerpt_id; let excerpt_id = hovered_hint.position.excerpt_id;
if let Some(cached_hint) = inlay_hint_cache.hint_by_id(excerpt_id, hovered_hint.id) { if let Some(cached_hint) = inlay_hint_cache.hint_by_id(excerpt_id, hovered_hint.id) {
// Check if we should process this hint for hover // Check if we should process this hint for hover
let should_process_hint = match cached_hint.resolve_state { match cached_hint.resolve_state {
ResolveState::CanResolve(_, _) => { ResolveState::CanResolve(_, _) => {
if let Some(buffer_id) = snapshot if let Some(buffer_id) = snapshot
.buffer_snapshot .buffer_snapshot
@ -348,13 +348,8 @@ pub fn update_inlay_link_and_hover_points(
cx, cx,
); );
} }
false // Don't process unresolved hints
} }
ResolveState::Resolved => true, ResolveState::Resolved => {
ResolveState::Resolving => false,
};
if should_process_hint {
let mut extra_shift_left = 0; let mut extra_shift_left = 0;
let mut extra_shift_right = 0; let mut extra_shift_right = 0;
if cached_hint.padding_left { if cached_hint.padding_left {
@ -407,7 +402,8 @@ pub fn update_inlay_link_and_hover_points(
if part.tooltip.is_some() || part.location.is_some() { if part.tooltip.is_some() || part.location.is_some() {
// Found the meaningful part - show hover for it // Found the meaningful part - show hover for it
let highlight_start = part_offset + extra_shift_left; let highlight_start = part_offset + extra_shift_left;
let highlight_end = part_offset + part_len + extra_shift_right; let highlight_end =
part_offset + part_len + extra_shift_right;
let highlight = InlayHighlight { let highlight = InlayHighlight {
inlay: hovered_hint.id, inlay: hovered_hint.id,
@ -456,7 +452,8 @@ pub fn update_inlay_link_and_hover_points(
editor, editor,
InlayHover { InlayHover {
tooltip: HoverBlock { tooltip: HoverBlock {
text: "Loading documentation...".to_string(), text: "Loading documentation..."
.to_string(),
kind: HoverBlockKind::PlainText, kind: HoverBlockKind::PlainText,
}, },
range: highlight.clone(), range: highlight.clone(),
@ -593,7 +590,8 @@ pub fn update_inlay_link_and_hover_points(
} }
} }
if let Some((language_server_id, location)) = &part.location { if let Some((language_server_id, location)) = &part.location
{
if secondary_held if secondary_held
&& !editor.has_pending_nonempty_selection() && !editor.has_pending_nonempty_selection()
{ {
@ -621,6 +619,8 @@ pub fn update_inlay_link_and_hover_points(
} }
}; };
} }
ResolveState::Resolving => {}
};
} }
} }
} }