Disable incompatible extension versions in extension view (#9938)

This PR makes it so extension versions that are incompatible with what
the current Zed instance supports are disabled in the UI, to prevent
attempting to install them.

Here's what it looks like in the extension version picker:

<img width="589" alt="Screenshot 2024-03-28 at 4 21 15 PM"
src="https://github.com/zed-industries/zed/assets/1486634/8ef11c72-c8f0-4de8-a73b-5c82e96f6bfe">

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-03-28 16:49:26 -04:00 committed by GitHub
parent 95fd426eff
commit 0d7f5f49e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 87 additions and 20 deletions

View file

@ -28,6 +28,11 @@ fn wasi_view(state: &mut WasmState) -> &mut WasmState {
state
}
/// Returns whether the given Wasm API version is supported by the Wasm host.
pub fn is_supported_wasm_api_version(version: SemanticVersion) -> bool {
v0_0_1::VERSION <= version && version <= v0_0_4::VERSION
}
pub enum Extension {
V004(v0_0_4::Extension),
V001(v0_0_1::Extension),

View file

@ -4,8 +4,15 @@ use anyhow::Result;
use async_trait::async_trait;
use language::{LanguageServerBinaryStatus, LspAdapterDelegate};
use std::sync::{Arc, OnceLock};
use util::SemanticVersion;
use wasmtime::component::{Linker, Resource};
pub const VERSION: SemanticVersion = SemanticVersion {
major: 0,
minor: 0,
patch: 1,
};
wasmtime::component::bindgen!({
async: true,
path: "../extension_api/wit/0.0.1",