Use both language and LSP icons for LSP tasks (#31773)
Make more explicit which language LSP tasks are used. Before:  After:   Release Notes: - N/A
This commit is contained in:
parent
a539a38f13
commit
f881cacd8a
4 changed files with 65 additions and 20 deletions
|
@ -14,8 +14,9 @@ use project::{TaskSourceKind, task_store::TaskStore};
|
|||
use task::{DebugScenario, ResolvedTask, RevealTarget, TaskContext, TaskTemplate};
|
||||
use ui::{
|
||||
ActiveTheme, Button, ButtonCommon, ButtonSize, Clickable, Color, FluentBuilder as _, Icon,
|
||||
IconButton, IconButtonShape, IconName, IconSize, IntoElement, KeyBinding, Label, LabelSize,
|
||||
ListItem, ListItemSpacing, RenderOnce, Toggleable, Tooltip, div, h_flex, v_flex,
|
||||
IconButton, IconButtonShape, IconName, IconSize, IconWithIndicator, Indicator, IntoElement,
|
||||
KeyBinding, Label, LabelSize, ListItem, ListItemSpacing, RenderOnce, Toggleable, Tooltip, div,
|
||||
h_flex, v_flex,
|
||||
};
|
||||
|
||||
use util::{ResultExt, truncate_and_trailoff};
|
||||
|
@ -448,15 +449,29 @@ impl PickerDelegate for TasksModalDelegate {
|
|||
color: Color::Default,
|
||||
};
|
||||
let icon = match source_kind {
|
||||
TaskSourceKind::Lsp(..) => Some(Icon::new(IconName::BoltFilled)),
|
||||
TaskSourceKind::UserInput => Some(Icon::new(IconName::Terminal)),
|
||||
TaskSourceKind::AbsPath { .. } => Some(Icon::new(IconName::Settings)),
|
||||
TaskSourceKind::Worktree { .. } => Some(Icon::new(IconName::FileTree)),
|
||||
TaskSourceKind::Language { name } => file_icons::FileIcons::get(cx)
|
||||
TaskSourceKind::Lsp {
|
||||
language_name: name,
|
||||
..
|
||||
}
|
||||
| TaskSourceKind::Language { name } => file_icons::FileIcons::get(cx)
|
||||
.get_icon_for_type(&name.to_lowercase(), cx)
|
||||
.map(Icon::from_path),
|
||||
}
|
||||
.map(|icon| icon.color(Color::Muted).size(IconSize::Small));
|
||||
let indicator = if matches!(source_kind, TaskSourceKind::Lsp { .. }) {
|
||||
Some(Indicator::icon(
|
||||
Icon::new(IconName::Bolt).size(IconSize::Small),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let icon = icon.map(|icon| {
|
||||
IconWithIndicator::new(icon, indicator)
|
||||
.indicator_border_color(Some(cx.theme().colors().border_transparent))
|
||||
});
|
||||
let history_run_icon = if Some(ix) <= self.divider_index {
|
||||
Some(
|
||||
Icon::new(IconName::HistoryRerun)
|
||||
|
@ -476,7 +491,7 @@ impl PickerDelegate for TasksModalDelegate {
|
|||
Some(
|
||||
ListItem::new(SharedString::from(format!("tasks-modal-{ix}")))
|
||||
.inset(true)
|
||||
.start_slot::<Icon>(icon)
|
||||
.start_slot::<IconWithIndicator>(icon)
|
||||
.end_slot::<AnyElement>(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue