Show symlink tooltip on icon hover only (#12419)

Small follow-up of https://github.com/zed-industries/zed/pull/12263 

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2024-05-29 12:05:53 +03:00 committed by GitHub
parent cad3d2d355
commit ef58509797
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,9 +10,9 @@ use anyhow::{anyhow, Result};
use collections::{hash_map, BTreeSet, HashMap}; use collections::{hash_map, BTreeSet, HashMap};
use git::repository::GitFileStatus; use git::repository::GitFileStatus;
use gpui::{ use gpui::{
actions, anchored, deferred, div, impl_actions, px, uniform_list, Action, AppContext, actions, anchored, deferred, div, impl_actions, px, uniform_list, Action, AnyElement,
AssetSource, AsyncWindowContext, ClipboardItem, DismissEvent, Div, EventEmitter, FocusHandle, AppContext, AssetSource, AsyncWindowContext, ClipboardItem, DismissEvent, Div, EventEmitter,
FocusableView, InteractiveElement, KeyContext, Model, MouseButton, MouseDownEvent, FocusHandle, FocusableView, InteractiveElement, KeyContext, Model, MouseButton, MouseDownEvent,
ParentElement, Pixels, Point, PromptLevel, Render, Stateful, Styled, Subscription, Task, ParentElement, Pixels, Point, PromptLevel, Render, Stateful, Styled, Subscription, Task,
UniformListScrollHandle, View, ViewContext, VisualContext as _, WeakView, WindowContext, UniformListScrollHandle, View, ViewContext, VisualContext as _, WeakView, WindowContext,
}; };
@ -1940,12 +1940,19 @@ impl ProjectPanel {
.indent_step_size(px(settings.indent_size)) .indent_step_size(px(settings.indent_size))
.selected(is_marked) .selected(is_marked)
.when_some(canonical_path, |this, path| { .when_some(canonical_path, |this, path| {
this.end_slot::<Icon>( this.end_slot::<AnyElement>(
Icon::new(IconName::ArrowUpRight) div()
.size(IconSize::Indicator) .id("symlink_icon")
.color(filename_text_color), .tooltip(move |cx| {
Tooltip::text(format!("{path} • Symbolic Link"), cx)
})
.child(
Icon::new(IconName::ArrowUpRight)
.size(IconSize::Indicator)
.color(filename_text_color),
)
.into_any_element(),
) )
.tooltip(move |cx| Tooltip::text(format!("{path} • Symbolic Link"), cx))
}) })
.child(if let Some(icon) = &icon { .child(if let Some(icon) = &icon {
h_flex().child(Icon::from_path(icon.to_string()).color(filename_text_color)) h_flex().child(Icon::from_path(icon.to_string()).color(filename_text_color))