From ea44c510a3d696aaba0189b55efde81514b02ed9 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Fri, 1 Nov 2024 12:53:02 -0400 Subject: [PATCH] Rename `extension` crate to `extension_host` (#20081) This PR renames the `extension` crate to `extension_host`. This is to free up the name so that we can create a smaller-scoped `extension` crate. Release Notes: - N/A --- Cargo.lock | 52 +++++++++---------- Cargo.toml | 4 +- crates/activity_indicator/Cargo.toml | 2 +- .../src/activity_indicator.rs | 2 +- crates/extension_cli/Cargo.toml | 2 +- crates/extension_cli/src/main.rs | 2 +- .../{extension => extension_host}/Cargo.toml | 4 +- .../{extension => extension_host}/LICENSE-GPL | 0 crates/{extension => extension_host}/build.rs | 0 .../src/extension_builder.rs | 0 .../src/extension_host.rs} | 0 .../src/extension_indexed_docs_provider.rs | 0 .../src/extension_lsp_adapter.rs | 0 .../src/extension_manifest.rs | 0 .../src/extension_settings.rs | 0 .../src/extension_slash_command.rs | 0 .../src/extension_store_test.rs | 0 .../src/wasm_host.rs | 0 .../src/wasm_host/wit.rs | 0 .../src/wasm_host/wit/since_v0_0_1.rs | 0 .../src/wasm_host/wit/since_v0_0_4.rs | 0 .../src/wasm_host/wit/since_v0_0_6.rs | 0 .../src/wasm_host/wit/since_v0_1_0.rs | 0 .../src/wasm_host/wit/since_v0_2_0.rs | 0 crates/extensions_ui/Cargo.toml | 2 +- crates/extensions_ui/src/extension_suggest.rs | 2 +- .../src/extension_version_selector.rs | 6 +-- crates/extensions_ui/src/extensions_ui.rs | 9 ++-- crates/zed/Cargo.toml | 2 +- crates/zed/src/main.rs | 2 +- 30 files changed, 46 insertions(+), 45 deletions(-) rename crates/{extension => extension_host}/Cargo.toml (96%) rename crates/{extension => extension_host}/LICENSE-GPL (100%) rename crates/{extension => extension_host}/build.rs (100%) rename crates/{extension => extension_host}/src/extension_builder.rs (100%) rename crates/{extension/src/extension_store.rs => extension_host/src/extension_host.rs} (100%) rename crates/{extension => extension_host}/src/extension_indexed_docs_provider.rs (100%) rename crates/{extension => extension_host}/src/extension_lsp_adapter.rs (100%) rename crates/{extension => extension_host}/src/extension_manifest.rs (100%) rename crates/{extension => extension_host}/src/extension_settings.rs (100%) rename crates/{extension => extension_host}/src/extension_slash_command.rs (100%) rename crates/{extension => extension_host}/src/extension_store_test.rs (100%) rename crates/{extension => extension_host}/src/wasm_host.rs (100%) rename crates/{extension => extension_host}/src/wasm_host/wit.rs (100%) rename crates/{extension => extension_host}/src/wasm_host/wit/since_v0_0_1.rs (100%) rename crates/{extension => extension_host}/src/wasm_host/wit/since_v0_0_4.rs (100%) rename crates/{extension => extension_host}/src/wasm_host/wit/since_v0_0_6.rs (100%) rename crates/{extension => extension_host}/src/wasm_host/wit/since_v0_1_0.rs (100%) rename crates/{extension => extension_host}/src/wasm_host/wit/since_v0_2_0.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 8e0cffd249..c720155429 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9,7 +9,7 @@ dependencies = [ "anyhow", "auto_update", "editor", - "extension", + "extension_host", "futures 0.3.30", "gpui", "language", @@ -4090,7 +4090,29 @@ dependencies = [ ] [[package]] -name = "extension" +name = "extension_cli" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "env_logger 0.11.5", + "extension_host", + "fs", + "language", + "log", + "reqwest_client", + "rpc", + "serde", + "serde_json", + "theme", + "tokio", + "toml 0.8.19", + "tree-sitter", + "wasmtime", +] + +[[package]] +name = "extension_host" version = "0.1.0" dependencies = [ "anyhow", @@ -4137,28 +4159,6 @@ dependencies = [ "workspace", ] -[[package]] -name = "extension_cli" -version = "0.1.0" -dependencies = [ - "anyhow", - "clap", - "env_logger 0.11.5", - "extension", - "fs", - "language", - "log", - "reqwest_client", - "rpc", - "serde", - "serde_json", - "theme", - "tokio", - "toml 0.8.19", - "tree-sitter", - "wasmtime", -] - [[package]] name = "extensions_ui" version = "0.1.0" @@ -4168,7 +4168,7 @@ dependencies = [ "collections", "db", "editor", - "extension", + "extension_host", "fs", "fuzzy", "gpui", @@ -15065,7 +15065,7 @@ dependencies = [ "diagnostics", "editor", "env_logger 0.11.5", - "extension", + "extension_host", "extensions_ui", "feature_flags", "feedback", diff --git a/Cargo.toml b/Cargo.toml index 18dc85994a..853372dd3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,9 +27,9 @@ members = [ "crates/docs_preprocessor", "crates/editor", "crates/evals", - "crates/extension", "crates/extension_api", "crates/extension_cli", + "crates/extension_host", "crates/extensions_ui", "crates/feature_flags", "crates/feedback", @@ -201,7 +201,7 @@ copilot = { path = "crates/copilot" } db = { path = "crates/db" } diagnostics = { path = "crates/diagnostics" } editor = { path = "crates/editor" } -extension = { path = "crates/extension" } +extension_host = { path = "crates/extension_host" } extensions_ui = { path = "crates/extensions_ui" } feature_flags = { path = "crates/feature_flags" } feedback = { path = "crates/feedback" } diff --git a/crates/activity_indicator/Cargo.toml b/crates/activity_indicator/Cargo.toml index b4fb2ec5b0..6f026d7662 100644 --- a/crates/activity_indicator/Cargo.toml +++ b/crates/activity_indicator/Cargo.toml @@ -16,7 +16,7 @@ doctest = false anyhow.workspace = true auto_update.workspace = true editor.workspace = true -extension.workspace = true +extension_host.workspace = true futures.workspace = true gpui.workspace = true language.workspace = true diff --git a/crates/activity_indicator/src/activity_indicator.rs b/crates/activity_indicator/src/activity_indicator.rs index f06ebe4b23..c9fc51ff1e 100644 --- a/crates/activity_indicator/src/activity_indicator.rs +++ b/crates/activity_indicator/src/activity_indicator.rs @@ -1,6 +1,6 @@ use auto_update::{AutoUpdateStatus, AutoUpdater, DismissErrorMessage}; use editor::Editor; -use extension::ExtensionStore; +use extension_host::ExtensionStore; use futures::StreamExt; use gpui::{ actions, percentage, Animation, AnimationExt as _, AppContext, CursorStyle, EventEmitter, diff --git a/crates/extension_cli/Cargo.toml b/crates/extension_cli/Cargo.toml index 6c7e3bdc62..8cf3e9b6be 100644 --- a/crates/extension_cli/Cargo.toml +++ b/crates/extension_cli/Cargo.toml @@ -16,7 +16,7 @@ path = "src/main.rs" anyhow.workspace = true clap = { workspace = true, features = ["derive"] } env_logger.workspace = true -extension = { workspace = true, features = ["no-webrtc"] } +extension_host = { workspace = true, features = ["no-webrtc"] } fs.workspace = true language.workspace = true log.workspace = true diff --git a/crates/extension_cli/src/main.rs b/crates/extension_cli/src/main.rs index ffa9555c21..58bee34923 100644 --- a/crates/extension_cli/src/main.rs +++ b/crates/extension_cli/src/main.rs @@ -9,7 +9,7 @@ use std::{ use ::fs::{copy_recursive, CopyOptions, Fs, RealFs}; use anyhow::{anyhow, bail, Context, Result}; use clap::Parser; -use extension::{ +use extension_host::{ extension_builder::{CompileExtensionOptions, ExtensionBuilder}, ExtensionManifest, }; diff --git a/crates/extension/Cargo.toml b/crates/extension_host/Cargo.toml similarity index 96% rename from crates/extension/Cargo.toml rename to crates/extension_host/Cargo.toml index 26b8610e76..dd31c2af86 100644 --- a/crates/extension/Cargo.toml +++ b/crates/extension_host/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "extension" +name = "extension_host" version = "0.1.0" edition = "2021" publish = false @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later" workspace = true [lib] -path = "src/extension_store.rs" +path = "src/extension_host.rs" doctest = false [features] diff --git a/crates/extension/LICENSE-GPL b/crates/extension_host/LICENSE-GPL similarity index 100% rename from crates/extension/LICENSE-GPL rename to crates/extension_host/LICENSE-GPL diff --git a/crates/extension/build.rs b/crates/extension_host/build.rs similarity index 100% rename from crates/extension/build.rs rename to crates/extension_host/build.rs diff --git a/crates/extension/src/extension_builder.rs b/crates/extension_host/src/extension_builder.rs similarity index 100% rename from crates/extension/src/extension_builder.rs rename to crates/extension_host/src/extension_builder.rs diff --git a/crates/extension/src/extension_store.rs b/crates/extension_host/src/extension_host.rs similarity index 100% rename from crates/extension/src/extension_store.rs rename to crates/extension_host/src/extension_host.rs diff --git a/crates/extension/src/extension_indexed_docs_provider.rs b/crates/extension_host/src/extension_indexed_docs_provider.rs similarity index 100% rename from crates/extension/src/extension_indexed_docs_provider.rs rename to crates/extension_host/src/extension_indexed_docs_provider.rs diff --git a/crates/extension/src/extension_lsp_adapter.rs b/crates/extension_host/src/extension_lsp_adapter.rs similarity index 100% rename from crates/extension/src/extension_lsp_adapter.rs rename to crates/extension_host/src/extension_lsp_adapter.rs diff --git a/crates/extension/src/extension_manifest.rs b/crates/extension_host/src/extension_manifest.rs similarity index 100% rename from crates/extension/src/extension_manifest.rs rename to crates/extension_host/src/extension_manifest.rs diff --git a/crates/extension/src/extension_settings.rs b/crates/extension_host/src/extension_settings.rs similarity index 100% rename from crates/extension/src/extension_settings.rs rename to crates/extension_host/src/extension_settings.rs diff --git a/crates/extension/src/extension_slash_command.rs b/crates/extension_host/src/extension_slash_command.rs similarity index 100% rename from crates/extension/src/extension_slash_command.rs rename to crates/extension_host/src/extension_slash_command.rs diff --git a/crates/extension/src/extension_store_test.rs b/crates/extension_host/src/extension_store_test.rs similarity index 100% rename from crates/extension/src/extension_store_test.rs rename to crates/extension_host/src/extension_store_test.rs diff --git a/crates/extension/src/wasm_host.rs b/crates/extension_host/src/wasm_host.rs similarity index 100% rename from crates/extension/src/wasm_host.rs rename to crates/extension_host/src/wasm_host.rs diff --git a/crates/extension/src/wasm_host/wit.rs b/crates/extension_host/src/wasm_host/wit.rs similarity index 100% rename from crates/extension/src/wasm_host/wit.rs rename to crates/extension_host/src/wasm_host/wit.rs diff --git a/crates/extension/src/wasm_host/wit/since_v0_0_1.rs b/crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs similarity index 100% rename from crates/extension/src/wasm_host/wit/since_v0_0_1.rs rename to crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs diff --git a/crates/extension/src/wasm_host/wit/since_v0_0_4.rs b/crates/extension_host/src/wasm_host/wit/since_v0_0_4.rs similarity index 100% rename from crates/extension/src/wasm_host/wit/since_v0_0_4.rs rename to crates/extension_host/src/wasm_host/wit/since_v0_0_4.rs diff --git a/crates/extension/src/wasm_host/wit/since_v0_0_6.rs b/crates/extension_host/src/wasm_host/wit/since_v0_0_6.rs similarity index 100% rename from crates/extension/src/wasm_host/wit/since_v0_0_6.rs rename to crates/extension_host/src/wasm_host/wit/since_v0_0_6.rs diff --git a/crates/extension/src/wasm_host/wit/since_v0_1_0.rs b/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs similarity index 100% rename from crates/extension/src/wasm_host/wit/since_v0_1_0.rs rename to crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs diff --git a/crates/extension/src/wasm_host/wit/since_v0_2_0.rs b/crates/extension_host/src/wasm_host/wit/since_v0_2_0.rs similarity index 100% rename from crates/extension/src/wasm_host/wit/since_v0_2_0.rs rename to crates/extension_host/src/wasm_host/wit/since_v0_2_0.rs diff --git a/crates/extensions_ui/Cargo.toml b/crates/extensions_ui/Cargo.toml index 28f0fcb7ad..0de1fd947a 100644 --- a/crates/extensions_ui/Cargo.toml +++ b/crates/extensions_ui/Cargo.toml @@ -20,7 +20,7 @@ client.workspace = true collections.workspace = true db.workspace = true editor.workspace = true -extension.workspace = true +extension_host.workspace = true fs.workspace = true fuzzy.workspace = true gpui.workspace = true diff --git a/crates/extensions_ui/src/extension_suggest.rs b/crates/extensions_ui/src/extension_suggest.rs index b21621537f..223a36699e 100644 --- a/crates/extensions_ui/src/extension_suggest.rs +++ b/crates/extensions_ui/src/extension_suggest.rs @@ -4,7 +4,7 @@ use std::sync::{Arc, OnceLock}; use db::kvp::KEY_VALUE_STORE; use editor::Editor; -use extension::ExtensionStore; +use extension_host::ExtensionStore; use gpui::{Model, VisualContext}; use language::Buffer; use ui::{SharedString, ViewContext}; diff --git a/crates/extensions_ui/src/extension_version_selector.rs b/crates/extensions_ui/src/extension_version_selector.rs index 23208bc710..1041e9524f 100644 --- a/crates/extensions_ui/src/extension_version_selector.rs +++ b/crates/extensions_ui/src/extension_version_selector.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use std::sync::Arc; use client::ExtensionMetadata; -use extension::{ExtensionSettings, ExtensionStore}; +use extension_host::{ExtensionSettings, ExtensionStore}; use fs::Fs; use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; use gpui::{ @@ -167,7 +167,7 @@ impl PickerDelegate for ExtensionVersionSelectorDelegate { let candidate_id = self.matches[self.selected_index].candidate_id; let extension_version = &self.extension_versions[candidate_id]; - if !extension::is_version_compatible(ReleaseChannel::global(cx), extension_version) { + if !extension_host::is_version_compatible(ReleaseChannel::global(cx), extension_version) { return; } @@ -203,7 +203,7 @@ impl PickerDelegate for ExtensionVersionSelectorDelegate { let extension_version = &self.extension_versions[version_match.candidate_id]; let is_version_compatible = - extension::is_version_compatible(ReleaseChannel::global(cx), extension_version); + extension_host::is_version_compatible(ReleaseChannel::global(cx), extension_version); let disabled = !is_version_compatible; Some( diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs index f246e3cf4f..e6386ffe4a 100644 --- a/crates/extensions_ui/src/extensions_ui.rs +++ b/crates/extensions_ui/src/extensions_ui.rs @@ -11,7 +11,7 @@ use client::telemetry::Telemetry; use client::ExtensionMetadata; use collections::{BTreeMap, BTreeSet}; use editor::{Editor, EditorElement, EditorStyle}; -use extension::{ExtensionManifest, ExtensionOperation, ExtensionStore}; +use extension_host::{ExtensionManifest, ExtensionOperation, ExtensionStore}; use fuzzy::{match_strings, StringMatchCandidate}; use gpui::{ actions, uniform_list, AppContext, EventEmitter, Flatten, FocusableView, InteractiveElement, @@ -203,8 +203,8 @@ impl ExtensionsPage { let subscriptions = [ cx.observe(&store, |_, _, cx| cx.notify()), cx.subscribe(&store, move |this, _, event, cx| match event { - extension::Event::ExtensionsUpdated => this.fetch_extensions_debounced(cx), - extension::Event::ExtensionInstalled(extension_id) => { + extension_host::Event::ExtensionsUpdated => this.fetch_extensions_debounced(cx), + extension_host::Event::ExtensionInstalled(extension_id) => { this.on_extension_installed(workspace_handle.clone(), extension_id, cx) } _ => {} @@ -691,7 +691,8 @@ impl ExtensionsPage { has_dev_extension: bool, cx: &mut ViewContext, ) -> (Button, Option