Use task icons for all kinds of tasks (#10333)
<img width="565" alt="image" src="https://github.com/zed-industries/zed/assets/2690773/cbb59154-1153-459a-978c-8c125e879d27"> <img width="562" alt="image" src="https://github.com/zed-industries/zed/assets/2690773/d3f65a09-2f75-4db8-85c2-1abb591e609c"> Release Notes: - Added more icons to task modal
This commit is contained in:
parent
759c65d4bd
commit
7dfc7184b1
2 changed files with 21 additions and 21 deletions
|
@ -284,29 +284,27 @@ impl PickerDelegate for TasksModalDelegate {
|
||||||
let candidates = self.candidates.as_ref()?;
|
let candidates = self.candidates.as_ref()?;
|
||||||
let hit = &self.matches[ix];
|
let hit = &self.matches[ix];
|
||||||
let (source_kind, _) = &candidates[hit.candidate_id];
|
let (source_kind, _) = &candidates[hit.candidate_id];
|
||||||
let language_name = if let TaskSourceKind::Language { name } = source_kind {
|
|
||||||
Some(name)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
let highlighted_location = HighlightedText {
|
let highlighted_location = HighlightedText {
|
||||||
text: hit.string.clone(),
|
text: hit.string.clone(),
|
||||||
highlight_positions: hit.positions.clone(),
|
highlight_positions: hit.positions.clone(),
|
||||||
char_count: hit.string.chars().count(),
|
char_count: hit.string.chars().count(),
|
||||||
};
|
};
|
||||||
let language_icon = language_name
|
let base_item = ListItem::new(SharedString::from(format!("tasks-modal-{ix}")))
|
||||||
.and_then(|language| {
|
.inset(true)
|
||||||
let language = language.to_lowercase();
|
.spacing(ListItemSpacing::Sparse);
|
||||||
file_icons::FileIcons::get(cx).get_type_icon(&language)
|
let icon = match source_kind {
|
||||||
})
|
TaskSourceKind::UserInput => Some(Icon::new(IconName::Terminal)),
|
||||||
.map(|icon_path| Icon::from_path(icon_path));
|
TaskSourceKind::AbsPath { .. } => Some(Icon::new(IconName::Settings)),
|
||||||
|
TaskSourceKind::Worktree { .. } => Some(Icon::new(IconName::FileTree)),
|
||||||
|
TaskSourceKind::Language { name } => file_icons::FileIcons::get(cx)
|
||||||
|
.get_type_icon(&name.to_lowercase())
|
||||||
|
.map(|icon_path| Icon::from_path(icon_path)),
|
||||||
|
};
|
||||||
Some(
|
Some(
|
||||||
ListItem::new(SharedString::from(format!("tasks-modal-{ix}")))
|
base_item
|
||||||
.inset(true)
|
.map(|item| {
|
||||||
.spacing(ListItemSpacing::Sparse)
|
let item = if matches!(source_kind, TaskSourceKind::UserInput) {
|
||||||
.map(|this| {
|
|
||||||
let this = if matches!(source_kind, TaskSourceKind::UserInput) {
|
|
||||||
let task_index = hit.candidate_id;
|
let task_index = hit.candidate_id;
|
||||||
let delete_button = div().child(
|
let delete_button = div().child(
|
||||||
IconButton::new("delete", IconName::Close)
|
IconButton::new("delete", IconName::Close)
|
||||||
|
@ -323,14 +321,14 @@ impl PickerDelegate for TasksModalDelegate {
|
||||||
}))
|
}))
|
||||||
.tooltip(|cx| Tooltip::text("Delete an one-shot task", cx)),
|
.tooltip(|cx| Tooltip::text("Delete an one-shot task", cx)),
|
||||||
);
|
);
|
||||||
this.end_hover_slot(delete_button)
|
item.end_hover_slot(delete_button)
|
||||||
} else {
|
} else {
|
||||||
this
|
item
|
||||||
};
|
};
|
||||||
if let Some(icon) = language_icon {
|
if let Some(icon) = icon {
|
||||||
this.end_slot(icon)
|
item.end_slot(icon)
|
||||||
} else {
|
} else {
|
||||||
this
|
item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.selected(selected)
|
.selected(selected)
|
||||||
|
|
|
@ -104,6 +104,7 @@ pub enum IconName {
|
||||||
Return,
|
Return,
|
||||||
ReplyArrowRight,
|
ReplyArrowRight,
|
||||||
ReplyArrowLeft,
|
ReplyArrowLeft,
|
||||||
|
Settings,
|
||||||
Screen,
|
Screen,
|
||||||
SelectAll,
|
SelectAll,
|
||||||
Shift,
|
Shift,
|
||||||
|
@ -200,6 +201,7 @@ impl IconName {
|
||||||
IconName::Return => "icons/return.svg",
|
IconName::Return => "icons/return.svg",
|
||||||
IconName::ReplyArrowRight => "icons/reply_arrow_right.svg",
|
IconName::ReplyArrowRight => "icons/reply_arrow_right.svg",
|
||||||
IconName::ReplyArrowLeft => "icons/reply_arrow_left.svg",
|
IconName::ReplyArrowLeft => "icons/reply_arrow_left.svg",
|
||||||
|
IconName::Settings => "icons/file_icons/settings.svg",
|
||||||
IconName::Screen => "icons/desktop.svg",
|
IconName::Screen => "icons/desktop.svg",
|
||||||
IconName::SelectAll => "icons/select_all.svg",
|
IconName::SelectAll => "icons/select_all.svg",
|
||||||
IconName::Shift => "icons/shift.svg",
|
IconName::Shift => "icons/shift.svg",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue