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(terminal_command::TerminalSlashCommand, true);
slash_command_registry.register_command(now_command::NowSlashCommand, false); slash_command_registry.register_command(now_command::NowSlashCommand, false);
slash_command_registry.register_command(diagnostics_command::DiagnosticsSlashCommand, true); 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, true);
slash_command_registry.register_command(fetch_command::FetchSlashCommand, false);
if let Some(prompt_builder) = prompt_builder { if let Some(prompt_builder) = prompt_builder {
cx.observe_flag::<project_command::ProjectSlashCommandFeatureFlag, _>({ cx.observe_flag::<project_command::ProjectSlashCommandFeatureFlag, _>({

View file

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

View file

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