Use both language and LSP icons for LSP tasks (#31773)

Make more explicit which language LSP tasks are used.

Before:

![image](https://github.com/user-attachments/assets/27f93c5f-942e-47a0-9b74-2c6d4d6248de)

After:

![image
(1)](https://github.com/user-attachments/assets/5a29fb0a-2e16-4c35-9dda-ae7925eaa034)


![image](https://github.com/user-attachments/assets/d1bf518e-63d1-4ebf-af3d-3c9d464c6532)


Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2025-05-30 22:28:56 +03:00 committed by GitHub
parent a539a38f13
commit f881cacd8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 65 additions and 20 deletions

View file

@ -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()