1mod components;
2mod extension_suggest;
3mod extension_version_selector;
4
5use std::sync::OnceLock;
6use std::time::Duration;
7use std::{ops::Range, sync::Arc};
8
9use anyhow::Context as _;
10use client::{ExtensionMetadata, ExtensionProvides};
11use collections::{BTreeMap, BTreeSet};
12use editor::{Editor, EditorElement, EditorStyle};
13use extension_host::{ExtensionManifest, ExtensionOperation, ExtensionStore};
14use fuzzy::{StringMatchCandidate, match_strings};
15use gpui::{
16 Action, App, ClipboardItem, Context, Entity, EventEmitter, Flatten, Focusable,
17 InteractiveElement, KeyContext, ParentElement, Render, Styled, Task, TextStyle,
18 UniformListScrollHandle, WeakEntity, Window, actions, point, uniform_list,
19};
20use num_format::{Locale, ToFormattedString};
21use project::DirectoryLister;
22use release_channel::ReleaseChannel;
23use settings::Settings;
24use strum::IntoEnumIterator as _;
25use theme::ThemeSettings;
26use ui::{
27 CheckboxWithLabel, Chip, ContextMenu, PopoverMenu, ScrollableHandle, Scrollbar, ScrollbarState,
28 ToggleButton, Tooltip, prelude::*,
29};
30use vim_mode_setting::VimModeSetting;
31use workspace::{
32 Workspace, WorkspaceId,
33 item::{Item, ItemEvent},
34};
35use zed_actions::ExtensionCategoryFilter;
36
37use crate::components::{ExtensionCard, FeatureUpsell};
38use crate::extension_version_selector::{
39 ExtensionVersionSelector, ExtensionVersionSelectorDelegate,
40};
41
42actions!(
43 zed,
44 [
45 /// Installs an extension from a local directory for development.
46 InstallDevExtension
47 ]
48);
49
50pub fn init(cx: &mut App) {
51 cx.observe_new(move |workspace: &mut Workspace, window, cx| {
52 let Some(window) = window else {
53 return;
54 };
55 workspace
56 .register_action(
57 move |workspace, action: &zed_actions::Extensions, window, cx| {
58 let provides_filter = action.category_filter.map(|category| match category {
59 ExtensionCategoryFilter::Themes => ExtensionProvides::Themes,
60 ExtensionCategoryFilter::IconThemes => ExtensionProvides::IconThemes,
61 ExtensionCategoryFilter::Languages => ExtensionProvides::Languages,
62 ExtensionCategoryFilter::Grammars => ExtensionProvides::Grammars,
63 ExtensionCategoryFilter::LanguageServers => {
64 ExtensionProvides::LanguageServers
65 }
66 ExtensionCategoryFilter::ContextServers => {
67 ExtensionProvides::ContextServers
68 }
69 ExtensionCategoryFilter::SlashCommands => ExtensionProvides::SlashCommands,
70 ExtensionCategoryFilter::IndexedDocsProviders => {
71 ExtensionProvides::IndexedDocsProviders
72 }
73 ExtensionCategoryFilter::Snippets => ExtensionProvides::Snippets,
74 ExtensionCategoryFilter::DebugAdapters => ExtensionProvides::DebugAdapters,
75 });
76
77 let existing = workspace
78 .active_pane()
79 .read(cx)
80 .items()
81 .find_map(|item| item.downcast::<ExtensionsPage>());
82
83 if let Some(existing) = existing {
84 existing.update(cx, |extensions_page, cx| {
85 if provides_filter.is_some() {
86 extensions_page.change_provides_filter(provides_filter, cx);
87 }
88 if let Some(id) = action.id.as_ref() {
89 extensions_page.focus_extension(id, window, cx);
90 }
91 });
92
93 workspace.activate_item(&existing, true, true, window, cx);
94 } else {
95 let extensions_page = ExtensionsPage::new(
96 workspace,
97 provides_filter,
98 action.id.as_deref(),
99 window,
100 cx,
101 );
102 workspace.add_item_to_active_pane(
103 Box::new(extensions_page),
104 None,
105 true,
106 window,
107 cx,
108 )
109 }
110 },
111 )
112 .register_action(move |workspace, _: &InstallDevExtension, window, cx| {
113 let store = ExtensionStore::global(cx);
114 let prompt = workspace.prompt_for_open_path(
115 gpui::PathPromptOptions {
116 files: false,
117 directories: true,
118 multiple: false,
119 prompt: None,
120 },
121 DirectoryLister::Local(
122 workspace.project().clone(),
123 workspace.app_state().fs.clone(),
124 ),
125 window,
126 cx,
127 );
128
129 let workspace_handle = cx.entity().downgrade();
130 window
131 .spawn(cx, async move |cx| {
132 let extension_path =
133 match Flatten::flatten(prompt.await.map_err(|e| e.into())) {
134 Ok(Some(mut paths)) => paths.pop()?,
135 Ok(None) => return None,
136 Err(err) => {
137 workspace_handle
138 .update(cx, |workspace, cx| {
139 workspace.show_portal_error(err.to_string(), cx);
140 })
141 .ok();
142 return None;
143 }
144 };
145
146 let install_task = store
147 .update(cx, |store, cx| {
148 store.install_dev_extension(extension_path, cx)
149 })
150 .ok()?;
151
152 match install_task.await {
153 Ok(_) => {}
154 Err(err) => {
155 log::error!("Failed to install dev extension: {:?}", err);
156 workspace_handle
157 .update(cx, |workspace, cx| {
158 workspace.show_error(
159 // NOTE: using `anyhow::context` here ends up not printing
160 // the error
161 &format!("Failed to install dev extension: {}", err),
162 cx,
163 );
164 })
165 .ok();
166 }
167 }
168
169 Some(())
170 })
171 .detach();
172 });
173
174 cx.subscribe_in(workspace.project(), window, |_, _, event, window, cx| {
175 if let project::Event::LanguageNotFound(buffer) = event {
176 extension_suggest::suggest(buffer.clone(), window, cx);
177 }
178 })
179 .detach();
180 })
181 .detach();
182}
183
184fn extension_provides_label(provides: ExtensionProvides) -> &'static str {
185 match provides {
186 ExtensionProvides::Themes => "Themes",
187 ExtensionProvides::IconThemes => "Icon Themes",
188 ExtensionProvides::Languages => "Languages",
189 ExtensionProvides::Grammars => "Grammars",
190 ExtensionProvides::LanguageServers => "Language Servers",
191 ExtensionProvides::ContextServers => "MCP Servers",
192 ExtensionProvides::SlashCommands => "Slash Commands",
193 ExtensionProvides::IndexedDocsProviders => "Indexed Docs Providers",
194 ExtensionProvides::Snippets => "Snippets",
195 ExtensionProvides::DebugAdapters => "Debug Adapters",
196 }
197}
198
199#[derive(Clone)]
200pub enum ExtensionStatus {
201 NotInstalled,
202 Installing,
203 Upgrading,
204 Installed(Arc<str>),
205 Removing,
206}
207
208#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
209enum ExtensionFilter {
210 All,
211 Installed,
212 NotInstalled,
213}
214
215impl ExtensionFilter {
216 pub fn include_dev_extensions(&self) -> bool {
217 match self {
218 Self::All | Self::Installed => true,
219 Self::NotInstalled => false,
220 }
221 }
222}
223
224#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
225enum Feature {
226 Git,
227 OpenIn,
228 Vim,
229 LanguageBash,
230 LanguageC,
231 LanguageCpp,
232 LanguageGo,
233 LanguagePython,
234 LanguageReact,
235 LanguageRust,
236 LanguageTypescript,
237}
238
239fn keywords_by_feature() -> &'static BTreeMap<Feature, Vec<&'static str>> {
240 static KEYWORDS_BY_FEATURE: OnceLock<BTreeMap<Feature, Vec<&'static str>>> = OnceLock::new();
241 KEYWORDS_BY_FEATURE.get_or_init(|| {
242 BTreeMap::from_iter([
243 (Feature::Git, vec!["git"]),
244 (
245 Feature::OpenIn,
246 vec![
247 "github",
248 "gitlab",
249 "bitbucket",
250 "codeberg",
251 "sourcehut",
252 "permalink",
253 "link",
254 "open in",
255 ],
256 ),
257 (Feature::Vim, vec!["vim"]),
258 (Feature::LanguageBash, vec!["sh", "bash"]),
259 (Feature::LanguageC, vec!["c", "clang"]),
260 (Feature::LanguageCpp, vec!["c++", "cpp", "clang"]),
261 (Feature::LanguageGo, vec!["go", "golang"]),
262 (Feature::LanguagePython, vec!["python", "py"]),
263 (Feature::LanguageReact, vec!["react"]),
264 (Feature::LanguageRust, vec!["rust", "rs"]),
265 (
266 Feature::LanguageTypescript,
267 vec!["type", "typescript", "ts"],
268 ),
269 ])
270 })
271}
272
273struct ExtensionCardButtons {
274 install_or_uninstall: Button,
275 upgrade: Option<Button>,
276 configure: Option<Button>,
277}
278
279pub struct ExtensionsPage {
280 workspace: WeakEntity<Workspace>,
281 list: UniformListScrollHandle,
282 is_fetching_extensions: bool,
283 filter: ExtensionFilter,
284 remote_extension_entries: Vec<ExtensionMetadata>,
285 dev_extension_entries: Vec<Arc<ExtensionManifest>>,
286 filtered_remote_extension_indices: Vec<usize>,
287 query_editor: Entity<Editor>,
288 query_contains_error: bool,
289 provides_filter: Option<ExtensionProvides>,
290 _subscriptions: [gpui::Subscription; 2],
291 extension_fetch_task: Option<Task<()>>,
292 upsells: BTreeSet<Feature>,
293 scrollbar_state: ScrollbarState,
294}
295
296impl ExtensionsPage {
297 pub fn new(
298 workspace: &Workspace,
299 provides_filter: Option<ExtensionProvides>,
300 focus_extension_id: Option<&str>,
301 window: &mut Window,
302 cx: &mut Context<Workspace>,
303 ) -> Entity<Self> {
304 cx.new(|cx| {
305 let store = ExtensionStore::global(cx);
306 let workspace_handle = workspace.weak_handle();
307 let subscriptions = [
308 cx.observe(&store, |_: &mut Self, _, cx| cx.notify()),
309 cx.subscribe_in(
310 &store,
311 window,
312 move |this, _, event, window, cx| match event {
313 extension_host::Event::ExtensionsUpdated => {
314 this.fetch_extensions_debounced(None, cx)
315 }
316 extension_host::Event::ExtensionInstalled(extension_id) => this
317 .on_extension_installed(
318 workspace_handle.clone(),
319 extension_id,
320 window,
321 cx,
322 ),
323 _ => {}
324 },
325 ),
326 ];
327
328 let query_editor = cx.new(|cx| {
329 let mut input = Editor::single_line(window, cx);
330 input.set_placeholder_text("Search extensions...", cx);
331 if let Some(id) = focus_extension_id {
332 input.set_text(format!("id:{id}"), window, cx);
333 }
334 input
335 });
336 cx.subscribe(&query_editor, Self::on_query_change).detach();
337
338 let scroll_handle = UniformListScrollHandle::new();
339
340 let mut this = Self {
341 workspace: workspace.weak_handle(),
342 list: scroll_handle.clone(),
343 is_fetching_extensions: false,
344 filter: ExtensionFilter::All,
345 dev_extension_entries: Vec::new(),
346 filtered_remote_extension_indices: Vec::new(),
347 remote_extension_entries: Vec::new(),
348 query_contains_error: false,
349 provides_filter,
350 extension_fetch_task: None,
351 _subscriptions: subscriptions,
352 query_editor,
353 upsells: BTreeSet::default(),
354 scrollbar_state: ScrollbarState::new(scroll_handle),
355 };
356 this.fetch_extensions(
357 this.search_query(cx),
358 Some(BTreeSet::from_iter(this.provides_filter)),
359 None,
360 cx,
361 );
362 this
363 })
364 }
365
366 fn on_extension_installed(
367 &mut self,
368 workspace: WeakEntity<Workspace>,
369 extension_id: &str,
370 window: &mut Window,
371 cx: &mut Context<Self>,
372 ) {
373 let extension_store = ExtensionStore::global(cx).read(cx);
374 let themes = extension_store
375 .extension_themes(extension_id)
376 .map(|name| name.to_string())
377 .collect::<Vec<_>>();
378 if !themes.is_empty() {
379 workspace
380 .update(cx, |_workspace, cx| {
381 window.dispatch_action(
382 zed_actions::theme_selector::Toggle {
383 themes_filter: Some(themes),
384 }
385 .boxed_clone(),
386 cx,
387 );
388 })
389 .ok();
390 return;
391 }
392
393 let icon_themes = extension_store
394 .extension_icon_themes(extension_id)
395 .map(|name| name.to_string())
396 .collect::<Vec<_>>();
397 if !icon_themes.is_empty() {
398 workspace
399 .update(cx, |_workspace, cx| {
400 window.dispatch_action(
401 zed_actions::icon_theme_selector::Toggle {
402 themes_filter: Some(icon_themes),
403 }
404 .boxed_clone(),
405 cx,
406 );
407 })
408 .ok();
409 }
410 }
411
412 /// Returns whether a dev extension currently exists for the extension with the given ID.
413 fn dev_extension_exists(extension_id: &str, cx: &mut Context<Self>) -> bool {
414 let extension_store = ExtensionStore::global(cx).read(cx);
415
416 extension_store
417 .dev_extensions()
418 .any(|dev_extension| dev_extension.id.as_ref() == extension_id)
419 }
420
421 fn extension_status(extension_id: &str, cx: &mut Context<Self>) -> ExtensionStatus {
422 let extension_store = ExtensionStore::global(cx).read(cx);
423
424 match extension_store.outstanding_operations().get(extension_id) {
425 Some(ExtensionOperation::Install) => ExtensionStatus::Installing,
426 Some(ExtensionOperation::Remove) => ExtensionStatus::Removing,
427 Some(ExtensionOperation::Upgrade) => ExtensionStatus::Upgrading,
428 None => match extension_store.installed_extensions().get(extension_id) {
429 Some(extension) => ExtensionStatus::Installed(extension.manifest.version.clone()),
430 None => ExtensionStatus::NotInstalled,
431 },
432 }
433 }
434
435 fn filter_extension_entries(&mut self, cx: &mut Context<Self>) {
436 self.filtered_remote_extension_indices.clear();
437 self.filtered_remote_extension_indices.extend(
438 self.remote_extension_entries
439 .iter()
440 .enumerate()
441 .filter(|(_, extension)| match self.filter {
442 ExtensionFilter::All => true,
443 ExtensionFilter::Installed => {
444 let status = Self::extension_status(&extension.id, cx);
445 matches!(status, ExtensionStatus::Installed(_))
446 }
447 ExtensionFilter::NotInstalled => {
448 let status = Self::extension_status(&extension.id, cx);
449
450 matches!(status, ExtensionStatus::NotInstalled)
451 }
452 })
453 .map(|(ix, _)| ix),
454 );
455 cx.notify();
456 }
457
458 fn scroll_to_top(&mut self, cx: &mut Context<Self>) {
459 self.list.set_offset(point(px(0.), px(0.)));
460 cx.notify();
461 }
462
463 fn fetch_extensions(
464 &mut self,
465 search: Option<String>,
466 provides_filter: Option<BTreeSet<ExtensionProvides>>,
467 on_complete: Option<Box<dyn FnOnce(&mut Self, &mut Context<Self>) + Send>>,
468 cx: &mut Context<Self>,
469 ) {
470 self.is_fetching_extensions = true;
471 cx.notify();
472
473 let extension_store = ExtensionStore::global(cx);
474
475 let dev_extensions = extension_store
476 .read(cx)
477 .dev_extensions()
478 .cloned()
479 .collect::<Vec<_>>();
480
481 let remote_extensions =
482 if let Some(id) = search.as_ref().and_then(|s| s.strip_prefix("id:")) {
483 let versions =
484 extension_store.update(cx, |store, cx| store.fetch_extension_versions(id, cx));
485 cx.foreground_executor().spawn(async move {
486 let versions = versions.await?;
487 let latest = versions
488 .into_iter()
489 .max_by_key(|v| v.published_at)
490 .context("no extension found")?;
491 Ok(vec![latest])
492 })
493 } else {
494 extension_store.update(cx, |store, cx| {
495 store.fetch_extensions(search.as_deref(), provides_filter.as_ref(), cx)
496 })
497 };
498
499 cx.spawn(async move |this, cx| {
500 let dev_extensions = if let Some(search) = search {
501 let match_candidates = dev_extensions
502 .iter()
503 .enumerate()
504 .map(|(ix, manifest)| StringMatchCandidate::new(ix, &manifest.name))
505 .collect::<Vec<_>>();
506
507 let matches = match_strings(
508 &match_candidates,
509 &search,
510 false,
511 true,
512 match_candidates.len(),
513 &Default::default(),
514 cx.background_executor().clone(),
515 )
516 .await;
517 matches
518 .into_iter()
519 .map(|mat| dev_extensions[mat.candidate_id].clone())
520 .collect()
521 } else {
522 dev_extensions
523 };
524
525 let fetch_result = remote_extensions.await;
526 this.update(cx, |this, cx| {
527 cx.notify();
528 this.dev_extension_entries = dev_extensions;
529 this.is_fetching_extensions = false;
530 this.remote_extension_entries = fetch_result?;
531 this.filter_extension_entries(cx);
532 if let Some(callback) = on_complete {
533 callback(this, cx);
534 }
535 anyhow::Ok(())
536 })?
537 })
538 .detach_and_log_err(cx);
539 }
540
541 fn render_extensions(
542 &mut self,
543 range: Range<usize>,
544 _: &mut Window,
545 cx: &mut Context<Self>,
546 ) -> Vec<ExtensionCard> {
547 let dev_extension_entries_len = if self.filter.include_dev_extensions() {
548 self.dev_extension_entries.len()
549 } else {
550 0
551 };
552 range
553 .map(|ix| {
554 if ix < dev_extension_entries_len {
555 let extension = &self.dev_extension_entries[ix];
556 self.render_dev_extension(extension, cx)
557 } else {
558 let extension_ix =
559 self.filtered_remote_extension_indices[ix - dev_extension_entries_len];
560 let extension = &self.remote_extension_entries[extension_ix];
561 self.render_remote_extension(extension, cx)
562 }
563 })
564 .collect()
565 }
566
567 fn render_dev_extension(
568 &self,
569 extension: &ExtensionManifest,
570 cx: &mut Context<Self>,
571 ) -> ExtensionCard {
572 let status = Self::extension_status(&extension.id, cx);
573
574 let repository_url = extension.repository.clone();
575
576 let can_configure = !extension.context_servers.is_empty();
577
578 ExtensionCard::new()
579 .child(
580 h_flex()
581 .justify_between()
582 .child(
583 h_flex()
584 .gap_2()
585 .items_end()
586 .child(Headline::new(extension.name.clone()).size(HeadlineSize::Medium))
587 .child(
588 Headline::new(format!("v{}", extension.version))
589 .size(HeadlineSize::XSmall),
590 ),
591 )
592 .child(
593 h_flex()
594 .gap_1()
595 .justify_between()
596 .child(
597 Button::new(
598 SharedString::from(format!("rebuild-{}", extension.id)),
599 "Rebuild",
600 )
601 .color(Color::Accent)
602 .disabled(matches!(status, ExtensionStatus::Upgrading))
603 .on_click({
604 let extension_id = extension.id.clone();
605 move |_, _, cx| {
606 ExtensionStore::global(cx).update(cx, |store, cx| {
607 store.rebuild_dev_extension(extension_id.clone(), cx)
608 });
609 }
610 }),
611 )
612 .child(
613 Button::new(SharedString::from(extension.id.clone()), "Uninstall")
614 .color(Color::Accent)
615 .disabled(matches!(status, ExtensionStatus::Removing))
616 .on_click({
617 let extension_id = extension.id.clone();
618 move |_, _, cx| {
619 ExtensionStore::global(cx).update(cx, |store, cx| {
620 store.uninstall_extension(extension_id.clone(), cx).detach_and_log_err(cx);
621 });
622 }
623 }),
624 )
625 .when(can_configure, |this| {
626 this.child(
627 Button::new(
628 SharedString::from(format!("configure-{}", extension.id)),
629 "Configure",
630 )
631 .color(Color::Accent)
632 .disabled(matches!(status, ExtensionStatus::Installing))
633 .on_click({
634 let manifest = Arc::new(extension.clone());
635 move |_, _, cx| {
636 if let Some(events) =
637 extension::ExtensionEvents::try_global(cx)
638 {
639 events.update(cx, |this, cx| {
640 this.emit(
641 extension::Event::ConfigureExtensionRequested(
642 manifest.clone(),
643 ),
644 cx,
645 )
646 });
647 }
648 }
649 }),
650 )
651 }),
652 ),
653 )
654 .child(
655 h_flex()
656 .gap_2()
657 .justify_between()
658 .child(
659 Label::new(format!(
660 "{}: {}",
661 if extension.authors.len() > 1 {
662 "Authors"
663 } else {
664 "Author"
665 },
666 extension.authors.join(", ")
667 ))
668 .size(LabelSize::Small)
669 .color(Color::Muted)
670 .truncate(),
671 )
672 .child(Label::new("<>").size(LabelSize::Small)),
673 )
674 .child(
675 h_flex()
676 .gap_2()
677 .justify_between()
678 .children(extension.description.as_ref().map(|description| {
679 Label::new(description.clone())
680 .size(LabelSize::Small)
681 .color(Color::Default)
682 .truncate()
683 }))
684 .children(repository_url.map(|repository_url| {
685 IconButton::new(
686 SharedString::from(format!("repository-{}", extension.id)),
687 IconName::Github,
688 )
689 .icon_color(Color::Accent)
690 .icon_size(IconSize::Small)
691 .on_click(cx.listener({
692 let repository_url = repository_url.clone();
693 move |_, _, _, cx| {
694 cx.open_url(&repository_url);
695 }
696 }))
697 .tooltip(Tooltip::text(repository_url.clone()))
698 })),
699 )
700 }
701
702 fn render_remote_extension(
703 &self,
704 extension: &ExtensionMetadata,
705 cx: &mut Context<Self>,
706 ) -> ExtensionCard {
707 let this = cx.entity();
708 let status = Self::extension_status(&extension.id, cx);
709 let has_dev_extension = Self::dev_extension_exists(&extension.id, cx);
710
711 let extension_id = extension.id.clone();
712 let buttons = self.buttons_for_entry(extension, &status, has_dev_extension, cx);
713 let version = extension.manifest.version.clone();
714 let repository_url = extension.manifest.repository.clone();
715 let authors = extension.manifest.authors.clone();
716
717 let installed_version = match status {
718 ExtensionStatus::Installed(installed_version) => Some(installed_version),
719 _ => None,
720 };
721
722 ExtensionCard::new()
723 .overridden_by_dev_extension(has_dev_extension)
724 .child(
725 h_flex()
726 .justify_between()
727 .child(
728 h_flex()
729 .gap_2()
730 .child(
731 Headline::new(extension.manifest.name.clone())
732 .size(HeadlineSize::Medium),
733 )
734 .child(Headline::new(format!("v{version}")).size(HeadlineSize::XSmall))
735 .children(
736 installed_version
737 .filter(|installed_version| *installed_version != version)
738 .map(|installed_version| {
739 Headline::new(format!("(v{installed_version} installed)",))
740 .size(HeadlineSize::XSmall)
741 }),
742 )
743 .map(|parent| {
744 if extension.manifest.provides.is_empty() {
745 return parent;
746 }
747
748 parent.child(
749 h_flex().gap_1().children(
750 extension
751 .manifest
752 .provides
753 .iter()
754 .filter_map(|provides| {
755 match provides {
756 ExtensionProvides::SlashCommands
757 | ExtensionProvides::IndexedDocsProviders => {
758 return None;
759 }
760 _ => {}
761 }
762
763 Some(Chip::new(extension_provides_label(*provides)))
764 })
765 .collect::<Vec<_>>(),
766 ),
767 )
768 }),
769 )
770 .child(
771 h_flex()
772 .gap_1()
773 .children(buttons.upgrade)
774 .children(buttons.configure)
775 .child(buttons.install_or_uninstall),
776 ),
777 )
778 .child(
779 h_flex()
780 .gap_2()
781 .justify_between()
782 .child(
783 Label::new(format!(
784 "{}: {}",
785 if extension.manifest.authors.len() > 1 {
786 "Authors"
787 } else {
788 "Author"
789 },
790 extension.manifest.authors.join(", ")
791 ))
792 .size(LabelSize::Small)
793 .color(Color::Muted)
794 .truncate(),
795 )
796 .child(
797 Label::new(format!(
798 "Downloads: {}",
799 extension.download_count.to_formatted_string(&Locale::en)
800 ))
801 .size(LabelSize::Small),
802 ),
803 )
804 .child(
805 h_flex()
806 .gap_2()
807 .justify_between()
808 .children(extension.manifest.description.as_ref().map(|description| {
809 Label::new(description.clone())
810 .size(LabelSize::Small)
811 .color(Color::Default)
812 .truncate()
813 }))
814 .child(
815 h_flex()
816 .gap_2()
817 .child(
818 IconButton::new(
819 SharedString::from(format!("repository-{}", extension.id)),
820 IconName::Github,
821 )
822 .icon_color(Color::Accent)
823 .icon_size(IconSize::Small)
824 .on_click(cx.listener({
825 let repository_url = repository_url.clone();
826 move |_, _, _, cx| {
827 cx.open_url(&repository_url);
828 }
829 }))
830 .tooltip(Tooltip::text(repository_url.clone())),
831 )
832 .child(
833 PopoverMenu::new(SharedString::from(format!(
834 "more-{}",
835 extension.id
836 )))
837 .trigger(
838 IconButton::new(
839 SharedString::from(format!("more-{}", extension.id)),
840 IconName::Ellipsis,
841 )
842 .icon_color(Color::Accent)
843 .icon_size(IconSize::Small),
844 )
845 .menu(move |window, cx| {
846 Some(Self::render_remote_extension_context_menu(
847 &this,
848 extension_id.clone(),
849 authors.clone(),
850 window,
851 cx,
852 ))
853 }),
854 ),
855 ),
856 )
857 }
858
859 fn render_remote_extension_context_menu(
860 this: &Entity<Self>,
861 extension_id: Arc<str>,
862 authors: Vec<String>,
863 window: &mut Window,
864 cx: &mut App,
865 ) -> Entity<ContextMenu> {
866 let context_menu = ContextMenu::build(window, cx, |context_menu, window, _| {
867 context_menu
868 .entry(
869 "Install Another Version...",
870 None,
871 window.handler_for(this, {
872 let extension_id = extension_id.clone();
873 move |this, window, cx| {
874 this.show_extension_version_list(extension_id.clone(), window, cx)
875 }
876 }),
877 )
878 .entry("Copy Extension ID", None, {
879 let extension_id = extension_id.clone();
880 move |_, cx| {
881 cx.write_to_clipboard(ClipboardItem::new_string(extension_id.to_string()));
882 }
883 })
884 .entry("Copy Author Info", None, {
885 let authors = authors.clone();
886 move |_, cx| {
887 cx.write_to_clipboard(ClipboardItem::new_string(authors.join(", ")));
888 }
889 })
890 });
891
892 context_menu
893 }
894
895 fn show_extension_version_list(
896 &mut self,
897 extension_id: Arc<str>,
898 window: &mut Window,
899 cx: &mut Context<Self>,
900 ) {
901 let Some(workspace) = self.workspace.upgrade() else {
902 return;
903 };
904
905 cx.spawn_in(window, async move |this, cx| {
906 let extension_versions_task = this.update(cx, |_, cx| {
907 let extension_store = ExtensionStore::global(cx);
908
909 extension_store.update(cx, |store, cx| {
910 store.fetch_extension_versions(&extension_id, cx)
911 })
912 })?;
913
914 let extension_versions = extension_versions_task.await?;
915
916 workspace.update_in(cx, |workspace, window, cx| {
917 let fs = workspace.project().read(cx).fs().clone();
918 workspace.toggle_modal(window, cx, |window, cx| {
919 let delegate = ExtensionVersionSelectorDelegate::new(
920 fs,
921 cx.entity().downgrade(),
922 extension_versions,
923 );
924
925 ExtensionVersionSelector::new(delegate, window, cx)
926 });
927 })?;
928
929 anyhow::Ok(())
930 })
931 .detach_and_log_err(cx);
932 }
933
934 fn buttons_for_entry(
935 &self,
936 extension: &ExtensionMetadata,
937 status: &ExtensionStatus,
938 has_dev_extension: bool,
939 cx: &mut Context<Self>,
940 ) -> ExtensionCardButtons {
941 let is_compatible =
942 extension_host::is_version_compatible(ReleaseChannel::global(cx), extension);
943
944 if has_dev_extension {
945 // If we have a dev extension for the given extension, just treat it as uninstalled.
946 // The button here is a placeholder, as it won't be interactable anyways.
947 return ExtensionCardButtons {
948 install_or_uninstall: Button::new(
949 SharedString::from(extension.id.clone()),
950 "Install",
951 ),
952 configure: None,
953 upgrade: None,
954 };
955 }
956
957 let is_configurable = extension
958 .manifest
959 .provides
960 .contains(&ExtensionProvides::ContextServers);
961
962 match status.clone() {
963 ExtensionStatus::NotInstalled => ExtensionCardButtons {
964 install_or_uninstall: Button::new(
965 SharedString::from(extension.id.clone()),
966 "Install",
967 )
968 .on_click({
969 let extension_id = extension.id.clone();
970 move |_, _, cx| {
971 telemetry::event!("Extension Installed");
972 ExtensionStore::global(cx).update(cx, |store, cx| {
973 store.install_latest_extension(extension_id.clone(), cx)
974 });
975 }
976 }),
977 configure: None,
978 upgrade: None,
979 },
980 ExtensionStatus::Installing => ExtensionCardButtons {
981 install_or_uninstall: Button::new(
982 SharedString::from(extension.id.clone()),
983 "Install",
984 )
985 .disabled(true),
986 configure: None,
987 upgrade: None,
988 },
989 ExtensionStatus::Upgrading => ExtensionCardButtons {
990 install_or_uninstall: Button::new(
991 SharedString::from(extension.id.clone()),
992 "Uninstall",
993 )
994 .disabled(true),
995 configure: is_configurable.then(|| {
996 Button::new(
997 SharedString::from(format!("configure-{}", extension.id)),
998 "Configure",
999 )
1000 .disabled(true)
1001 }),
1002 upgrade: Some(
1003 Button::new(SharedString::from(extension.id.clone()), "Upgrade").disabled(true),
1004 ),
1005 },
1006 ExtensionStatus::Installed(installed_version) => ExtensionCardButtons {
1007 install_or_uninstall: Button::new(
1008 SharedString::from(extension.id.clone()),
1009 "Uninstall",
1010 )
1011 .on_click({
1012 let extension_id = extension.id.clone();
1013 move |_, _, cx| {
1014 telemetry::event!("Extension Uninstalled", extension_id);
1015 ExtensionStore::global(cx).update(cx, |store, cx| {
1016 store
1017 .uninstall_extension(extension_id.clone(), cx)
1018 .detach_and_log_err(cx);
1019 });
1020 }
1021 }),
1022 configure: is_configurable.then(|| {
1023 Button::new(
1024 SharedString::from(format!("configure-{}", extension.id)),
1025 "Configure",
1026 )
1027 .on_click({
1028 let extension_id = extension.id.clone();
1029 move |_, _, cx| {
1030 if let Some(manifest) = ExtensionStore::global(cx)
1031 .read(cx)
1032 .extension_manifest_for_id(&extension_id)
1033 .cloned()
1034 && let Some(events) = extension::ExtensionEvents::try_global(cx) {
1035 events.update(cx, |this, cx| {
1036 this.emit(
1037 extension::Event::ConfigureExtensionRequested(manifest),
1038 cx,
1039 )
1040 });
1041 }
1042 }
1043 })
1044 }),
1045 upgrade: if installed_version == extension.manifest.version {
1046 None
1047 } else {
1048 Some(
1049 Button::new(SharedString::from(extension.id.clone()), "Upgrade")
1050 .when(!is_compatible, |upgrade_button| {
1051 upgrade_button.disabled(true).tooltip({
1052 let version = extension.manifest.version.clone();
1053 move |_, cx| {
1054 Tooltip::simple(
1055 format!(
1056 "v{version} is not compatible with this version of Zed.",
1057 ),
1058 cx,
1059 )
1060 }
1061 })
1062 })
1063 .disabled(!is_compatible)
1064 .on_click({
1065 let extension_id = extension.id.clone();
1066 let version = extension.manifest.version.clone();
1067 move |_, _, cx| {
1068 telemetry::event!("Extension Installed", extension_id, version);
1069 ExtensionStore::global(cx).update(cx, |store, cx| {
1070 store
1071 .upgrade_extension(
1072 extension_id.clone(),
1073 version.clone(),
1074 cx,
1075 )
1076 .detach_and_log_err(cx)
1077 });
1078 }
1079 }),
1080 )
1081 },
1082 },
1083 ExtensionStatus::Removing => ExtensionCardButtons {
1084 install_or_uninstall: Button::new(
1085 SharedString::from(extension.id.clone()),
1086 "Uninstall",
1087 )
1088 .disabled(true),
1089 configure: is_configurable.then(|| {
1090 Button::new(
1091 SharedString::from(format!("configure-{}", extension.id)),
1092 "Configure",
1093 )
1094 .disabled(true)
1095 }),
1096 upgrade: None,
1097 },
1098 }
1099 }
1100
1101 fn render_search(&self, cx: &mut Context<Self>) -> Div {
1102 let mut key_context = KeyContext::new_with_defaults();
1103 key_context.add("BufferSearchBar");
1104
1105 let editor_border = if self.query_contains_error {
1106 Color::Error.color(cx)
1107 } else {
1108 cx.theme().colors().border
1109 };
1110
1111 h_flex()
1112 .key_context(key_context)
1113 .h_8()
1114 .flex_1()
1115 .min_w(rems_from_px(384.))
1116 .pl_1p5()
1117 .pr_2()
1118 .py_1()
1119 .gap_2()
1120 .border_1()
1121 .border_color(editor_border)
1122 .rounded_lg()
1123 .child(Icon::new(IconName::MagnifyingGlass).color(Color::Muted))
1124 .child(self.render_text_input(&self.query_editor, cx))
1125 }
1126
1127 fn render_text_input(
1128 &self,
1129 editor: &Entity<Editor>,
1130 cx: &mut Context<Self>,
1131 ) -> impl IntoElement {
1132 let settings = ThemeSettings::get_global(cx);
1133 let text_style = TextStyle {
1134 color: if editor.read(cx).read_only(cx) {
1135 cx.theme().colors().text_disabled
1136 } else {
1137 cx.theme().colors().text
1138 },
1139 font_family: settings.ui_font.family.clone(),
1140 font_features: settings.ui_font.features.clone(),
1141 font_fallbacks: settings.ui_font.fallbacks.clone(),
1142 font_size: rems(0.875).into(),
1143 font_weight: settings.ui_font.weight,
1144 line_height: relative(1.3),
1145 ..Default::default()
1146 };
1147
1148 EditorElement::new(
1149 editor,
1150 EditorStyle {
1151 background: cx.theme().colors().editor_background,
1152 local_player: cx.theme().players().local(),
1153 text: text_style,
1154 ..Default::default()
1155 },
1156 )
1157 }
1158
1159 fn on_query_change(
1160 &mut self,
1161 _: Entity<Editor>,
1162 event: &editor::EditorEvent,
1163 cx: &mut Context<Self>,
1164 ) {
1165 if let editor::EditorEvent::Edited { .. } = event {
1166 self.query_contains_error = false;
1167 self.refresh_search(cx);
1168 }
1169 }
1170
1171 fn refresh_search(&mut self, cx: &mut Context<Self>) {
1172 self.fetch_extensions_debounced(
1173 Some(Box::new(|this, cx| {
1174 this.scroll_to_top(cx);
1175 })),
1176 cx,
1177 );
1178 self.refresh_feature_upsells(cx);
1179 }
1180
1181 pub fn focus_extension(&mut self, id: &str, window: &mut Window, cx: &mut Context<Self>) {
1182 self.query_editor.update(cx, |editor, cx| {
1183 editor.set_text(format!("id:{id}"), window, cx)
1184 });
1185 self.refresh_search(cx);
1186 }
1187
1188 pub fn change_provides_filter(
1189 &mut self,
1190 provides_filter: Option<ExtensionProvides>,
1191 cx: &mut Context<Self>,
1192 ) {
1193 self.provides_filter = provides_filter;
1194 self.refresh_search(cx);
1195 }
1196
1197 fn fetch_extensions_debounced(
1198 &mut self,
1199 on_complete: Option<Box<dyn FnOnce(&mut Self, &mut Context<Self>) + Send>>,
1200 cx: &mut Context<ExtensionsPage>,
1201 ) {
1202 self.extension_fetch_task = Some(cx.spawn(async move |this, cx| {
1203 let search = this
1204 .update(cx, |this, cx| this.search_query(cx))
1205 .ok()
1206 .flatten();
1207
1208 // Only debounce the fetching of extensions if we have a search
1209 // query.
1210 //
1211 // If the search was just cleared then we can just reload the list
1212 // of extensions without a debounce, which allows us to avoid seeing
1213 // an intermittent flash of a "no extensions" state.
1214 if search.is_some() {
1215 cx.background_executor()
1216 .timer(Duration::from_millis(250))
1217 .await;
1218 };
1219
1220 this.update(cx, |this, cx| {
1221 this.fetch_extensions(
1222 search,
1223 Some(BTreeSet::from_iter(this.provides_filter)),
1224 on_complete,
1225 cx,
1226 );
1227 })
1228 .ok();
1229 }));
1230 }
1231
1232 pub fn search_query(&self, cx: &mut App) -> Option<String> {
1233 let search = self.query_editor.read(cx).text(cx);
1234 if search.trim().is_empty() {
1235 None
1236 } else {
1237 Some(search)
1238 }
1239 }
1240
1241 fn render_empty_state(&self, cx: &mut Context<Self>) -> impl IntoElement {
1242 let has_search = self.search_query(cx).is_some();
1243
1244 let message = if self.is_fetching_extensions {
1245 "Loading extensions..."
1246 } else {
1247 match self.filter {
1248 ExtensionFilter::All => {
1249 if has_search {
1250 "No extensions that match your search."
1251 } else {
1252 "No extensions."
1253 }
1254 }
1255 ExtensionFilter::Installed => {
1256 if has_search {
1257 "No installed extensions that match your search."
1258 } else {
1259 "No installed extensions."
1260 }
1261 }
1262 ExtensionFilter::NotInstalled => {
1263 if has_search {
1264 "No not installed extensions that match your search."
1265 } else {
1266 "No not installed extensions."
1267 }
1268 }
1269 }
1270 };
1271
1272 Label::new(message)
1273 }
1274
1275 fn update_settings<T: Settings>(
1276 &mut self,
1277 selection: &ToggleState,
1278
1279 cx: &mut Context<Self>,
1280 callback: impl 'static + Send + Fn(&mut T::FileContent, bool),
1281 ) {
1282 if let Some(workspace) = self.workspace.upgrade() {
1283 let fs = workspace.read(cx).app_state().fs.clone();
1284 let selection = *selection;
1285 settings::update_settings_file::<T>(fs, cx, move |settings, _| {
1286 let value = match selection {
1287 ToggleState::Unselected => false,
1288 ToggleState::Selected => true,
1289 _ => return,
1290 };
1291
1292 callback(settings, value)
1293 });
1294 }
1295 }
1296
1297 fn refresh_feature_upsells(&mut self, cx: &mut Context<Self>) {
1298 let Some(search) = self.search_query(cx) else {
1299 self.upsells.clear();
1300 return;
1301 };
1302
1303 let search = search.to_lowercase();
1304 let search_terms = search
1305 .split_whitespace()
1306 .map(|term| term.trim())
1307 .collect::<Vec<_>>();
1308
1309 for (feature, keywords) in keywords_by_feature() {
1310 if keywords
1311 .iter()
1312 .any(|keyword| search_terms.contains(keyword))
1313 {
1314 self.upsells.insert(*feature);
1315 } else {
1316 self.upsells.remove(feature);
1317 }
1318 }
1319 }
1320
1321 fn render_feature_upsells(&self, cx: &mut Context<Self>) -> impl IntoElement {
1322 let upsells_count = self.upsells.len();
1323
1324 v_flex().children(self.upsells.iter().enumerate().map(|(ix, feature)| {
1325 let upsell = match feature {
1326 Feature::Git => FeatureUpsell::new(
1327 "Zed comes with basic Git support. More Git features are coming in the future.",
1328 )
1329 .docs_url("https://zed.dev/docs/git"),
1330 Feature::OpenIn => FeatureUpsell::new(
1331 "Zed supports linking to a source line on GitHub and others.",
1332 )
1333 .docs_url("https://zed.dev/docs/git#git-integrations"),
1334 Feature::Vim => FeatureUpsell::new("Vim support is built-in to Zed!")
1335 .docs_url("https://zed.dev/docs/vim")
1336 .child(CheckboxWithLabel::new(
1337 "enable-vim",
1338 Label::new("Enable vim mode"),
1339 if VimModeSetting::get_global(cx).0 {
1340 ui::ToggleState::Selected
1341 } else {
1342 ui::ToggleState::Unselected
1343 },
1344 cx.listener(move |this, selection, _, cx| {
1345 telemetry::event!("Vim Mode Toggled", source = "Feature Upsell");
1346 this.update_settings::<VimModeSetting>(
1347 selection,
1348 cx,
1349 |setting, value| *setting = Some(value),
1350 );
1351 }),
1352 )),
1353 Feature::LanguageBash => FeatureUpsell::new("Shell support is built-in to Zed!")
1354 .docs_url("https://zed.dev/docs/languages/bash"),
1355 Feature::LanguageC => FeatureUpsell::new("C support is built-in to Zed!")
1356 .docs_url("https://zed.dev/docs/languages/c"),
1357 Feature::LanguageCpp => FeatureUpsell::new("C++ support is built-in to Zed!")
1358 .docs_url("https://zed.dev/docs/languages/cpp"),
1359 Feature::LanguageGo => FeatureUpsell::new("Go support is built-in to Zed!")
1360 .docs_url("https://zed.dev/docs/languages/go"),
1361 Feature::LanguagePython => FeatureUpsell::new("Python support is built-in to Zed!")
1362 .docs_url("https://zed.dev/docs/languages/python"),
1363 Feature::LanguageReact => FeatureUpsell::new("React support is built-in to Zed!")
1364 .docs_url("https://zed.dev/docs/languages/typescript"),
1365 Feature::LanguageRust => FeatureUpsell::new("Rust support is built-in to Zed!")
1366 .docs_url("https://zed.dev/docs/languages/rust"),
1367 Feature::LanguageTypescript => {
1368 FeatureUpsell::new("Typescript support is built-in to Zed!")
1369 .docs_url("https://zed.dev/docs/languages/typescript")
1370 }
1371 };
1372
1373 upsell.when(ix < upsells_count, |upsell| upsell.border_b_1())
1374 }))
1375 }
1376}
1377
1378impl Render for ExtensionsPage {
1379 fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
1380 v_flex()
1381 .size_full()
1382 .bg(cx.theme().colors().editor_background)
1383 .child(
1384 v_flex()
1385 .gap_4()
1386 .pt_4()
1387 .px_4()
1388 .bg(cx.theme().colors().editor_background)
1389 .child(
1390 h_flex()
1391 .w_full()
1392 .gap_2()
1393 .justify_between()
1394 .child(Headline::new("Extensions").size(HeadlineSize::XLarge))
1395 .child(
1396 Button::new("install-dev-extension", "Install Dev Extension")
1397 .style(ButtonStyle::Filled)
1398 .size(ButtonSize::Large)
1399 .on_click(|_event, window, cx| {
1400 window.dispatch_action(Box::new(InstallDevExtension), cx)
1401 }),
1402 ),
1403 )
1404 .child(
1405 h_flex()
1406 .w_full()
1407 .gap_4()
1408 .flex_wrap()
1409 .child(self.render_search(cx))
1410 .child(
1411 h_flex()
1412 .child(
1413 ToggleButton::new("filter-all", "All")
1414 .style(ButtonStyle::Filled)
1415 .size(ButtonSize::Large)
1416 .toggle_state(self.filter == ExtensionFilter::All)
1417 .on_click(cx.listener(|this, _event, _, cx| {
1418 this.filter = ExtensionFilter::All;
1419 this.filter_extension_entries(cx);
1420 this.scroll_to_top(cx);
1421 }))
1422 .tooltip(move |_, cx| {
1423 Tooltip::simple("Show all extensions", cx)
1424 })
1425 .first(),
1426 )
1427 .child(
1428 ToggleButton::new("filter-installed", "Installed")
1429 .style(ButtonStyle::Filled)
1430 .size(ButtonSize::Large)
1431 .toggle_state(self.filter == ExtensionFilter::Installed)
1432 .on_click(cx.listener(|this, _event, _, cx| {
1433 this.filter = ExtensionFilter::Installed;
1434 this.filter_extension_entries(cx);
1435 this.scroll_to_top(cx);
1436 }))
1437 .tooltip(move |_, cx| {
1438 Tooltip::simple("Show installed extensions", cx)
1439 })
1440 .middle(),
1441 )
1442 .child(
1443 ToggleButton::new("filter-not-installed", "Not Installed")
1444 .style(ButtonStyle::Filled)
1445 .size(ButtonSize::Large)
1446 .toggle_state(
1447 self.filter == ExtensionFilter::NotInstalled,
1448 )
1449 .on_click(cx.listener(|this, _event, _, cx| {
1450 this.filter = ExtensionFilter::NotInstalled;
1451 this.filter_extension_entries(cx);
1452 this.scroll_to_top(cx);
1453 }))
1454 .tooltip(move |_, cx| {
1455 Tooltip::simple("Show not installed extensions", cx)
1456 })
1457 .last(),
1458 ),
1459 ),
1460 ),
1461 )
1462 .child(
1463 h_flex()
1464 .id("filter-row")
1465 .gap_2()
1466 .py_2p5()
1467 .px_4()
1468 .border_b_1()
1469 .border_color(cx.theme().colors().border_variant)
1470 .overflow_x_scroll()
1471 .child(
1472 Button::new("filter-all-categories", "All")
1473 .when(self.provides_filter.is_none(), |button| {
1474 button.style(ButtonStyle::Filled)
1475 })
1476 .when(self.provides_filter.is_some(), |button| {
1477 button.style(ButtonStyle::Subtle)
1478 })
1479 .toggle_state(self.provides_filter.is_none())
1480 .on_click(cx.listener(|this, _event, _, cx| {
1481 this.change_provides_filter(None, cx);
1482 })),
1483 )
1484 .children(ExtensionProvides::iter().filter_map(|provides| {
1485 match provides {
1486 ExtensionProvides::SlashCommands
1487 | ExtensionProvides::IndexedDocsProviders => return None,
1488 _ => {}
1489 }
1490
1491 let label = extension_provides_label(provides);
1492 let button_id = SharedString::from(format!("filter-category-{}", label));
1493
1494 Some(
1495 Button::new(button_id, label)
1496 .style(if self.provides_filter == Some(provides) {
1497 ButtonStyle::Filled
1498 } else {
1499 ButtonStyle::Subtle
1500 })
1501 .toggle_state(self.provides_filter == Some(provides))
1502 .on_click({
1503 cx.listener(move |this, _event, _, cx| {
1504 this.change_provides_filter(Some(provides), cx);
1505 })
1506 }),
1507 )
1508 })),
1509 )
1510 .child(self.render_feature_upsells(cx))
1511 .child(
1512 v_flex()
1513 .pl_4()
1514 .pr_6()
1515 .size_full()
1516 .overflow_y_hidden()
1517 .map(|this| {
1518 let mut count = self.filtered_remote_extension_indices.len();
1519 if self.filter.include_dev_extensions() {
1520 count += self.dev_extension_entries.len();
1521 }
1522
1523 if count == 0 {
1524 return this.py_4().child(self.render_empty_state(cx));
1525 }
1526
1527 let scroll_handle = self.list.clone();
1528 this.child(
1529 uniform_list("entries", count, cx.processor(Self::render_extensions))
1530 .flex_grow()
1531 .pb_4()
1532 .track_scroll(scroll_handle),
1533 )
1534 .child(
1535 div()
1536 .absolute()
1537 .right_1()
1538 .top_0()
1539 .bottom_0()
1540 .w(px(12.))
1541 .children(Scrollbar::vertical(self.scrollbar_state.clone())),
1542 )
1543 }),
1544 )
1545 }
1546}
1547
1548impl EventEmitter<ItemEvent> for ExtensionsPage {}
1549
1550impl Focusable for ExtensionsPage {
1551 fn focus_handle(&self, cx: &App) -> gpui::FocusHandle {
1552 self.query_editor.read(cx).focus_handle(cx)
1553 }
1554}
1555
1556impl Item for ExtensionsPage {
1557 type Event = ItemEvent;
1558
1559 fn tab_content_text(&self, _detail: usize, _cx: &App) -> SharedString {
1560 "Extensions".into()
1561 }
1562
1563 fn telemetry_event_text(&self) -> Option<&'static str> {
1564 Some("Extensions Page Opened")
1565 }
1566
1567 fn show_toolbar(&self) -> bool {
1568 false
1569 }
1570
1571 fn clone_on_split(
1572 &self,
1573 _workspace_id: Option<WorkspaceId>,
1574 _window: &mut Window,
1575 _: &mut Context<Self>,
1576 ) -> Option<Entity<Self>> {
1577 None
1578 }
1579
1580 fn to_item_events(event: &Self::Event, mut f: impl FnMut(workspace::item::ItemEvent)) {
1581 f(*event)
1582 }
1583}