Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add url schemes to Zed
Conrad Irwina63eccf18839
diff --git a/crates/util/src/channel.rs b/crates/util/src/channel.rsindex 274fd576a05..89d42ffba6b 100644--- a/crates/util/src/channel.rs+++ b/crates/util/src/channel.rs@@ -1,6 +1,7 @@use std::env;use lazy_static::lazy_static;+use url::Url;lazy_static! {pub static ref RELEASE_CHANNEL_NAME: String = if cfg!(debug_assertions) {@@ -15,6 +16,23 @@ lazy_static! {"stable" => ReleaseChannel::Stable,_ => panic!("invalid release channel {}", *RELEASE_CHANNEL_NAME),};++ static ref URL_SCHEME: Url = Url::parse(match RELEASE_CHANNEL_NAME.as_str() {+ "dev" => "zed-dev:/",+ "preview" => "zed-preview:/",+ "stable" => "zed:/",+ // NOTE: this must be kept in sync with ./script/bundle and https://zed.dev.+ _ => unreachable!(),+ })+ .unwrap();+ static ref LINK_PREFIX: Url = Url::parse(match RELEASE_CHANNEL_NAME.as_str() {+ "dev" => "http://localhost:3000/dev/",+ "preview" => "https://zed.dev/preview/",+ "stable" => "https://zed.dev/",+ // NOTE: this must be kept in sync with https://zed.dev.+ _ => unreachable!(),+ })+ .unwrap();}#[derive(Copy, Clone, PartialEq, Eq, Default)]@@ -41,4 +59,12 @@ impl ReleaseChannel {ReleaseChannel::Stable => "stable",}}++ pub fn url_scheme(&self) -> &'static Url {+ &URL_SCHEME+ }++ pub fn link_prefix(&self) -> &'static Url {+ &LINK_PREFIX+ }}diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.tomlindex d4ac972a5df..7eb14559be8 100644--- a/crates/zed/Cargo.toml+++ b/crates/zed/Cargo.toml@@ -162,6 +162,7 @@ identifier = "dev.zed.Zed-Dev"name = "Zed Dev"osx_minimum_system_version = "10.15.7"osx_info_plist_exts = ["resources/info/*"]+osx_url_schemes = ["zed-dev"][package.metadata.bundle-preview]icon = ["resources/[email protected]", "resources/app-icon-preview.png"]@@ -169,6 +170,7 @@ identifier = "dev.zed.Zed-Preview"name = "Zed Preview"osx_minimum_system_version = "10.15.7"osx_info_plist_exts = ["resources/info/*"]+osx_url_schemes = ["zed-preview"][package.metadata.bundle-stable]@@ -177,3 +179,4 @@ identifier = "dev.zed.Zed"name = "Zed"osx_minimum_system_version = "10.15.7"osx_info_plist_exts = ["resources/info/*"]+osx_url_schemes = ["zed"]