zed_extension_api: Release v0.2.0 (#20683)
This PR releases v0.2.0 of the Zed extension API. Support for this version of the extension API will land in Zed v0.162.x. Release Notes: - N/A
This commit is contained in:
parent
d177a1d4e5
commit
b5ce8e7aa5
4 changed files with 28 additions and 18 deletions
|
@ -8,9 +8,6 @@ keywords = ["zed", "extension"]
|
|||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
|
||||
# Remove when we're ready to publish v0.2.0.
|
||||
publish = false
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ Here is the compatibility of the `zed_extension_api` with versions of Zed:
|
|||
|
||||
| Zed version | `zed_extension_api` version |
|
||||
| ----------- | --------------------------- |
|
||||
| `0.162.x` | `0.0.1` - `0.2.0` |
|
||||
| `0.149.x` | `0.0.1` - `0.1.0` |
|
||||
| `0.131.x` | `0.0.1` - `0.0.6` |
|
||||
| `0.130.x` | `0.0.1` - `0.0.5` |
|
||||
|
|
|
@ -57,12 +57,35 @@ pub fn wasm_api_version_range(release_channel: ReleaseChannel) -> RangeInclusive
|
|||
|
||||
let max_version = match release_channel {
|
||||
ReleaseChannel::Dev | ReleaseChannel::Nightly => latest::MAX_VERSION,
|
||||
ReleaseChannel::Stable | ReleaseChannel::Preview => since_v0_1_0::MAX_VERSION,
|
||||
ReleaseChannel::Stable | ReleaseChannel::Preview => latest::MAX_VERSION,
|
||||
};
|
||||
|
||||
since_v0_0_1::MIN_VERSION..=max_version
|
||||
}
|
||||
|
||||
/// Authorizes access to use unreleased versions of the Wasm API, based on the provided [`ReleaseChannel`].
|
||||
///
|
||||
/// Note: If there isn't currently an unreleased Wasm API version this function may be unused. Don't delete it!
|
||||
pub fn authorize_access_to_unreleased_wasm_api_version(
|
||||
release_channel: ReleaseChannel,
|
||||
) -> Result<()> {
|
||||
let allow_unreleased_version = match release_channel {
|
||||
ReleaseChannel::Dev | ReleaseChannel::Nightly => true,
|
||||
ReleaseChannel::Stable | ReleaseChannel::Preview => {
|
||||
// We always allow the latest in tests so that the extension tests pass on release branches.
|
||||
cfg!(any(test, feature = "test-support"))
|
||||
}
|
||||
};
|
||||
|
||||
if !allow_unreleased_version {
|
||||
Err(anyhow!(
|
||||
"unreleased versions of the extension API can only be used on development builds of Zed"
|
||||
))?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub enum Extension {
|
||||
V020(since_v0_2_0::Extension),
|
||||
V010(since_v0_1_0::Extension),
|
||||
|
@ -78,20 +101,10 @@ impl Extension {
|
|||
version: SemanticVersion,
|
||||
component: &Component,
|
||||
) -> Result<Self> {
|
||||
// Note: The release channel can be used to stage a new version of the extension API.
|
||||
let _ = release_channel;
|
||||
|
||||
if version >= latest::MIN_VERSION {
|
||||
// Note: The release channel can be used to stage a new version of the extension API.
|
||||
// We always allow the latest in tests so that the extension tests pass on release branches.
|
||||
let allow_latest_version = match release_channel {
|
||||
ReleaseChannel::Dev | ReleaseChannel::Nightly => true,
|
||||
ReleaseChannel::Stable | ReleaseChannel::Preview => {
|
||||
cfg!(any(test, feature = "test-support"))
|
||||
}
|
||||
};
|
||||
if !allow_latest_version {
|
||||
Err(anyhow!(
|
||||
"unreleased versions of the extension API can only be used on development builds of Zed"
|
||||
))?;
|
||||
}
|
||||
let extension =
|
||||
latest::Extension::instantiate_async(store, component, latest::linker())
|
||||
.await
|
||||
|
|
|
@ -22,7 +22,6 @@ use wasmtime::component::{Linker, Resource};
|
|||
use super::latest;
|
||||
|
||||
pub const MIN_VERSION: SemanticVersion = SemanticVersion::new(0, 1, 0);
|
||||
pub const MAX_VERSION: SemanticVersion = SemanticVersion::new(0, 1, 0);
|
||||
|
||||
wasmtime::component::bindgen!({
|
||||
async: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue