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

@ -132,7 +132,10 @@ pub enum TaskSourceKind {
/// Languages-specific tasks coming from extensions.
Language { name: SharedString },
/// Language-specific tasks coming from LSP servers.
Lsp(LanguageServerId),
Lsp {
language_name: SharedString,
server: LanguageServerId,
},
}
/// A collection of task contexts, derived from the current state of the workspace.
@ -211,7 +214,10 @@ impl TaskSourceKind {
format!("{id_base}_{id}_{}", directory_in_worktree.display())
}
Self::Language { name } => format!("language_{name}"),
Self::Lsp(server_id) => format!("lsp_{server_id}"),
Self::Lsp {
server,
language_name,
} => format!("lsp_{language_name}_{server}"),
}
}
}
@ -712,7 +718,7 @@ fn task_lru_comparator(
fn task_source_kind_preference(kind: &TaskSourceKind) -> u32 {
match kind {
TaskSourceKind::Lsp(..) => 0,
TaskSourceKind::Lsp { .. } => 0,
TaskSourceKind::Language { .. } => 1,
TaskSourceKind::UserInput => 2,
TaskSourceKind::Worktree { .. } => 3,