assistant tools: Add Tool::icon method instead of matching on name (#27444)

Release Notes:

- N/A
This commit is contained in:
Agus Zubiaga 2025-03-25 15:17:36 -03:00 committed by GitHub
parent 0339d654d2
commit 46e86f003f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 98 additions and 18 deletions

View file

@ -23,3 +23,4 @@ parking_lot.workspace = true
project.workspace = true
serde.workspace = true
serde_json.workspace = true
ui.workspace = true

View file

@ -9,6 +9,7 @@ use language_model::LanguageModelRequestMessage;
use project::Project;
use std::fmt::{self, Debug, Formatter};
use std::sync::Arc;
use ui::IconName;
pub use crate::tool_registry::*;
pub use crate::tool_working_set::*;
@ -33,6 +34,9 @@ pub trait Tool: 'static + Send + Sync {
/// Returns the description of the tool.
fn description(&self) -> String;
/// Returns the icon for the tool.
fn icon(&self) -> IconName;
/// Returns the source of the tool.
fn source(&self) -> ToolSource {
ToolSource::Native