Add an extensions installation view (#7689)

This PR adds a view for installing extensions within Zed.

My subtasks:

- [X] Page Extensions and assign in App Menu
- [X] List extensions 
- [X] Button to Install/Uninstall
- [x] Search Input to search in extensions registry API
- [x] Get Extensions from API
- [x] Action install to download extension and copy in /extensions
folder
- [x] Action uninstall to remove from /extensions folder
- [x] Filtering
- [x] Better UI Design

Open to collab!

Release Notes:

- Added an extension installation view. Open it using the `zed:
extensions` action in the command palette
([#7096](https://github.com/zed-industries/zed/issues/7096)).

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Carlos <foxkdev@gmail.com>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Carlos Lopez 2024-02-13 20:09:02 +01:00 committed by GitHub
parent 33f713a8ab
commit fecb5a82f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 735 additions and 11 deletions

View file

@ -7,16 +7,23 @@ use language::{LanguageMatcher, LanguageRegistry};
use serde_json::json;
use std::{path::PathBuf, sync::Arc};
use theme::ThemeRegistry;
use util::http::FakeHttpClient;
#[gpui::test]
async fn test_extension_store(cx: &mut TestAppContext) {
let fs = FakeFs::new(cx.executor());
let http_client = FakeHttpClient::with_200_response();
fs.insert_tree(
"/the-extension-dir",
json!({
"installed": {
"zed-monokai": {
"extension.json": r#"{
"id": "zed-monokai",
"name": "Zed Monokai",
"version": "2.0.0"
}"#,
"themes": {
"monokai.json": r#"{
"name": "Monokai",
@ -53,6 +60,11 @@ async fn test_extension_store(cx: &mut TestAppContext) {
}
},
"zed-ruby": {
"extension.json": r#"{
"id": "zed-ruby",
"name": "Zed Ruby",
"version": "1.0.0"
}"#,
"grammars": {
"ruby.wasm": "",
"embedded_template.wasm": "",
@ -82,6 +94,12 @@ async fn test_extension_store(cx: &mut TestAppContext) {
.await;
let mut expected_manifest = Manifest {
extensions: [
("zed-ruby".into(), "1.0.0".into()),
("zed-monokai".into(), "2.0.0".into()),
]
.into_iter()
.collect(),
grammars: [
(
"embedded_template".into(),
@ -169,6 +187,7 @@ async fn test_extension_store(cx: &mut TestAppContext) {
ExtensionStore::new(
PathBuf::from("/the-extension-dir"),
fs.clone(),
http_client.clone(),
language_registry.clone(),
theme_registry.clone(),
cx,
@ -201,6 +220,11 @@ async fn test_extension_store(cx: &mut TestAppContext) {
fs.insert_tree(
"/the-extension-dir/installed/zed-gruvbox",
json!({
"extension.json": r#"{
"id": "zed-gruvbox",
"name": "Zed Gruvbox",
"version": "1.0.0"
}"#,
"themes": {
"gruvbox.json": r#"{
"name": "Gruvbox",
@ -260,6 +284,7 @@ async fn test_extension_store(cx: &mut TestAppContext) {
ExtensionStore::new(
PathBuf::from("/the-extension-dir"),
fs.clone(),
http_client.clone(),
language_registry.clone(),
theme_registry.clone(),
cx,