Restrict v0.0.7 of the zed_extension_api to dev builds, for now (#12170)

This PR restricts usage of v0.0.7 of the `zed_extension_api` to dev
builds, for now.

As we're still making changes to it, we don't want to ship a version of
Zed to Preview/Stable that claims to support a yet-unreleased version of
the extension API.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-05-22 19:45:34 -04:00 committed by GitHub
parent 80bd40cfa3
commit 85ff80f3c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 48 additions and 15 deletions

View file

@ -34,6 +34,7 @@ use language::{
};
use node_runtime::NodeRuntime;
use project::ContextProviderWithTasks;
use release_channel::ReleaseChannel;
use semantic_version::SemanticVersion;
use serde::{Deserialize, Serialize};
use settings::Settings;
@ -70,7 +71,10 @@ pub fn schema_version_range() -> RangeInclusive<SchemaVersion> {
}
/// Returns whether the given extension version is compatible with this version of Zed.
pub fn is_version_compatible(extension_version: &ExtensionMetadata) -> bool {
pub fn is_version_compatible(
release_channel: ReleaseChannel,
extension_version: &ExtensionMetadata,
) -> bool {
let schema_version = extension_version.manifest.schema_version.unwrap_or(0);
if CURRENT_SCHEMA_VERSION.0 < schema_version {
return false;
@ -82,7 +86,7 @@ pub fn is_version_compatible(extension_version: &ExtensionMetadata) -> bool {
.as_ref()
.and_then(|wasm_api_version| SemanticVersion::from_str(wasm_api_version).ok())
{
if !is_supported_wasm_api_version(wasm_api_version) {
if !is_supported_wasm_api_version(release_channel, wasm_api_version) {
return false;
}
}
@ -428,7 +432,7 @@ impl ExtensionStore {
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<ExtensionMetadata>>> {
let schema_versions = schema_version_range();
let wasm_api_versions = wasm_api_version_range();
let wasm_api_versions = wasm_api_version_range(ReleaseChannel::global(cx));
let extension_settings = ExtensionSettings::get_global(cx);
let extension_ids = self
.extension_index
@ -681,7 +685,7 @@ impl ExtensionStore {
log::info!("installing extension {extension_id} latest version");
let schema_versions = schema_version_range();
let wasm_api_versions = wasm_api_version_range();
let wasm_api_versions = wasm_api_version_range(ReleaseChannel::global(cx));
let Some(url) = self
.http_client