Make fetch slash command visible in the command selector (#21302)

The `/fetch` command is naturally already accessible via the completion
menu when you type / in the assistant panel, but it wasn't on the "Add
Context" command selector. I think it should! It's a super nice/powerful
one, and I've seen folks not knowing it existed. Side-note: maybe, in
the near future, it'd be best to rename it to "`/web`, as that's an
easier name to parse and assume what it does.

<img width="700" alt="Screenshot 2024-11-28 at 16 52 07"
src="https://github.com/user-attachments/assets/37134e1c-c788-48ca-81ae-d7416e8c8706">

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2024-11-28 18:26:59 -03:00 committed by GitHub
parent 0acd98a07e
commit ae85ecba2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 7 deletions

1
assets/icons/globe.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-globe"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>

After

Width:  |  Height:  |  Size: 327 B

View file

@ -342,8 +342,7 @@ fn register_slash_commands(prompt_builder: Option<Arc<PromptBuilder>>, cx: &mut
slash_command_registry.register_command(terminal_command::TerminalSlashCommand, true);
slash_command_registry.register_command(now_command::NowSlashCommand, false);
slash_command_registry.register_command(diagnostics_command::DiagnosticsSlashCommand, true);
slash_command_registry.register_command(fetch_command::FetchSlashCommand, false);
slash_command_registry.register_command(fetch_command::FetchSlashCommand, false);
slash_command_registry.register_command(fetch_command::FetchSlashCommand, true);
if let Some(prompt_builder) = prompt_builder {
cx.observe_flag::<project_command::ProjectSlashCommandFeatureFlag, _>({

View file

@ -108,6 +108,10 @@ impl SlashCommand for FetchSlashCommand {
"Insert fetched URL contents".into()
}
fn icon(&self) -> IconName {
IconName::Globe
}
fn menu_text(&self) -> String {
self.description()
}
@ -162,7 +166,7 @@ impl SlashCommand for FetchSlashCommand {
text,
sections: vec![SlashCommandOutputSection {
range,
icon: IconName::AtSign,
icon: IconName::Globe,
label: format!("fetch {}", url).into(),
metadata: None,
}],

View file

@ -160,7 +160,6 @@ pub enum IconName {
Copy,
CountdownTimer,
CursorIBeam,
TextSnippet,
Dash,
DatabaseZap,
Delete,
@ -171,8 +170,8 @@ pub enum IconName {
EllipsisVertical,
Envelope,
Escape,
Exit,
ExpandVertical,
Exit,
ExternalLink,
Eye,
File,
@ -198,6 +197,7 @@ pub enum IconName {
GenericMinimize,
GenericRestore,
Github,
Globe,
Hash,
HistoryRerun,
Indicator,
@ -223,13 +223,13 @@ pub enum IconName {
PageUp,
Pencil,
Person,
PhoneIncoming,
Pin,
Play,
Plus,
PocketKnife,
Public,
PullRequest,
PhoneIncoming,
Quote,
RefreshTitle,
Regex,
@ -275,6 +275,7 @@ pub enum IconName {
SwatchBook,
Tab,
Terminal,
TextSnippet,
Trash,
TrashAlt,
Triangle,
@ -287,11 +288,11 @@ pub enum IconName {
Wand,
Warning,
WholeWord,
X,
XCircle,
ZedAssistant,
ZedAssistantFilled,
ZedXCopilot,
X,
}
impl From<IconName> for Icon {