zed_extension_api: Fork new version of extension API (#44025)

This PR forks a new version of the `zed_extension_api` in preparation
for new changes.

We're jumping from v0.6.0 to v0.8.0 for the WIT because we released
v0.7.0 of the `zed_extension_api` without any WIT changes (it probably
should have been v0.6.1, instead).

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2025-12-02 22:26:40 +00:00
committed by GitHub
parent 96a917091a
commit a2d57fc7b6
18 changed files with 1941 additions and 962 deletions
Generated
+5 -5
View File
@@ -21496,6 +21496,8 @@ dependencies = [
[[package]]
name = "zed_extension_api"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0729d50b4ca0a7e28e590bbe32e3ca0194d97ef654961451a424c661a366fca0"
dependencies = [
"serde",
"serde_json",
@@ -21504,9 +21506,7 @@ dependencies = [
[[package]]
name = "zed_extension_api"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0729d50b4ca0a7e28e590bbe32e3ca0194d97ef654961451a424c661a366fca0"
version = "0.8.0"
dependencies = [
"serde",
"serde_json",
@@ -21524,7 +21524,7 @@ dependencies = [
name = "zed_html"
version = "0.2.3"
dependencies = [
"zed_extension_api 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zed_extension_api 0.7.0",
]
[[package]]
@@ -21538,7 +21538,7 @@ dependencies = [
name = "zed_test_extension"
version = "0.1.0"
dependencies = [
"zed_extension_api 0.7.0",
"zed_extension_api 0.8.0",
]
[[package]]
+3 -2
View File
@@ -1,12 +1,13 @@
[package]
name = "zed_extension_api"
version = "0.7.0"
version = "0.8.0"
description = "APIs for creating Zed extensions in Rust"
repository = "https://github.com/zed-industries/zed"
documentation = "https://docs.rs/zed_extension_api"
keywords = ["zed", "extension"]
edition.workspace = true
publish = true
# Change back to `true` when we're ready to publish v0.8.0.
publish = false
license = "Apache-2.0"
[lints]
+1 -1
View File
@@ -334,7 +334,7 @@ mod wit {
wit_bindgen::generate!({
skip: ["init-extension"],
path: "./wit/since_v0.6.0",
path: "./wit/since_v0.8.0",
});
}
@@ -0,0 +1,12 @@
interface common {
/// A (half-open) range (`[start, end)`).
record range {
/// The start of the range (inclusive).
start: u32,
/// The end of the range (exclusive).
end: u32,
}
/// A list of environment variables.
type env-vars = list<tuple<string, string>>;
}
@@ -0,0 +1,11 @@
interface context-server {
/// Configuration for context server setup and installation.
record context-server-configuration {
/// Installation instructions in Markdown format.
installation-instructions: string,
/// JSON schema for settings validation.
settings-schema: string,
/// Default settings template.
default-settings: string,
}
}
@@ -0,0 +1,123 @@
interface dap {
use common.{env-vars};
/// Resolves a specified TcpArgumentsTemplate into TcpArguments
resolve-tcp-template: func(template: tcp-arguments-template) -> result<tcp-arguments, string>;
record launch-request {
program: string,
cwd: option<string>,
args: list<string>,
envs: env-vars,
}
record attach-request {
process-id: option<u32>,
}
variant debug-request {
launch(launch-request),
attach(attach-request)
}
record tcp-arguments {
port: u16,
host: u32,
timeout: option<u64>,
}
record tcp-arguments-template {
port: option<u16>,
host: option<u32>,
timeout: option<u64>,
}
/// Debug Config is the "highest-level" configuration for a debug session.
/// It comes from a new process modal UI; thus, it is essentially debug-adapter-agnostic.
/// It is expected of the extension to translate this generic configuration into something that can be debugged by the adapter (debug scenario).
record debug-config {
/// Name of the debug task
label: string,
/// The debug adapter to use
adapter: string,
request: debug-request,
stop-on-entry: option<bool>,
}
record task-template {
/// Human readable name of the task to display in the UI.
label: string,
/// Executable command to spawn.
command: string,
args: list<string>,
env: env-vars,
cwd: option<string>,
}
/// A task template with substituted task variables.
type resolved-task = task-template;
/// A task template for building a debug target.
type build-task-template = task-template;
variant build-task-definition {
by-name(string),
template(build-task-definition-template-payload )
}
record build-task-definition-template-payload {
locator-name: option<string>,
template: build-task-template
}
/// Debug Scenario is the user-facing configuration type (used in debug.json). It is still concerned with what to debug and not necessarily how to do it (except for any
/// debug-adapter-specific configuration options).
record debug-scenario {
/// Unsubstituted label for the task.DebugAdapterBinary
label: string,
/// Name of the Debug Adapter this configuration is intended for.
adapter: string,
/// An optional build step to be ran prior to starting a debug session. Build steps are used by Zed's locators to locate the executable to debug.
build: option<build-task-definition>,
/// JSON-encoded configuration for a given debug adapter.
config: string,
/// TCP connection parameters (if they were specified by user)
tcp-connection: option<tcp-arguments-template>,
}
enum start-debugging-request-arguments-request {
launch,
attach,
}
record debug-task-definition {
/// Unsubstituted label for the task.DebugAdapterBinary
label: string,
/// Name of the Debug Adapter this configuration is intended for.
adapter: string,
/// JSON-encoded configuration for a given debug adapter.
config: string,
/// TCP connection parameters (if they were specified by user)
tcp-connection: option<tcp-arguments-template>,
}
record start-debugging-request-arguments {
/// JSON-encoded configuration for a given debug adapter. It is specific to each debug adapter.
/// `configuration` will have it's Zed variable references substituted prior to being passed to the debug adapter.
configuration: string,
request: start-debugging-request-arguments-request,
}
/// The lowest-level representation of a debug session, which specifies:
/// - How to start a debug adapter process
/// - How to start a debug session with it (using DAP protocol)
/// for a given debug scenario.
record debug-adapter-binary {
command: option<string>,
arguments: list<string>,
envs: env-vars,
cwd: option<string>,
/// Zed will use TCP transport if `connection` is specified.
connection: option<tcp-arguments>,
request-args: start-debugging-request-arguments
}
}
@@ -0,0 +1,167 @@
package zed:extension;
world extension {
import context-server;
import dap;
import github;
import http-client;
import platform;
import process;
import nodejs;
use common.{env-vars, range};
use context-server.{context-server-configuration};
use dap.{attach-request, build-task-template, debug-config, debug-adapter-binary, debug-task-definition, debug-request, debug-scenario, launch-request, resolved-task, start-debugging-request-arguments-request};
use lsp.{completion, symbol};
use process.{command};
use slash-command.{slash-command, slash-command-argument-completion, slash-command-output};
/// Initializes the extension.
export init-extension: func();
/// The type of a downloaded file.
enum downloaded-file-type {
/// A gzipped file (`.gz`).
gzip,
/// A gzipped tar archive (`.tar.gz`).
gzip-tar,
/// A ZIP file (`.zip`).
zip,
/// An uncompressed file.
uncompressed,
}
/// The installation status for a language server.
variant language-server-installation-status {
/// The language server has no installation status.
none,
/// The language server is being downloaded.
downloading,
/// The language server is checking for updates.
checking-for-update,
/// The language server installation failed for specified reason.
failed(string),
}
record settings-location {
worktree-id: u64,
path: string,
}
import get-settings: func(path: option<settings-location>, category: string, key: option<string>) -> result<string, string>;
/// Downloads a file from the given URL and saves it to the given path within the extension's
/// working directory.
///
/// The file will be extracted according to the given file type.
import download-file: func(url: string, file-path: string, file-type: downloaded-file-type) -> result<_, string>;
/// Makes the file at the given path executable.
import make-file-executable: func(filepath: string) -> result<_, string>;
/// Updates the installation status for the given language server.
import set-language-server-installation-status: func(language-server-name: string, status: language-server-installation-status);
/// A Zed worktree.
resource worktree {
/// Returns the ID of the worktree.
id: func() -> u64;
/// Returns the root path of the worktree.
root-path: func() -> string;
/// Returns the textual contents of the specified file in the worktree.
read-text-file: func(path: string) -> result<string, string>;
/// Returns the path to the given binary name, if one is present on the `$PATH`.
which: func(binary-name: string) -> option<string>;
/// Returns the current shell environment.
shell-env: func() -> env-vars;
}
/// A Zed project.
resource project {
/// Returns the IDs of all of the worktrees in this project.
worktree-ids: func() -> list<u64>;
}
/// A key-value store.
resource key-value-store {
/// Inserts an entry under the specified key.
insert: func(key: string, value: string) -> result<_, string>;
}
/// Returns the command used to start up the language server.
export language-server-command: func(language-server-id: string, worktree: borrow<worktree>) -> result<command, string>;
/// Returns the initialization options to pass to the language server on startup.
///
/// The initialization options are represented as a JSON string.
export language-server-initialization-options: func(language-server-id: string, worktree: borrow<worktree>) -> result<option<string>, string>;
/// Returns the workspace configuration options to pass to the language server.
export language-server-workspace-configuration: func(language-server-id: string, worktree: borrow<worktree>) -> result<option<string>, string>;
/// Returns the initialization options to pass to the other language server.
export language-server-additional-initialization-options: func(language-server-id: string, target-language-server-id: string, worktree: borrow<worktree>) -> result<option<string>, string>;
/// Returns the workspace configuration options to pass to the other language server.
export language-server-additional-workspace-configuration: func(language-server-id: string, target-language-server-id: string, worktree: borrow<worktree>) -> result<option<string>, string>;
/// A label containing some code.
record code-label {
/// The source code to parse with Tree-sitter.
code: string,
/// The spans to display in the label.
spans: list<code-label-span>,
/// The range of the displayed label to include when filtering.
filter-range: range,
}
/// A span within a code label.
variant code-label-span {
/// A range into the parsed code.
code-range(range),
/// A span containing a code literal.
literal(code-label-span-literal),
}
/// A span containing a code literal.
record code-label-span-literal {
/// The literal text.
text: string,
/// The name of the highlight to use for this literal.
highlight-name: option<string>,
}
export labels-for-completions: func(language-server-id: string, completions: list<completion>) -> result<list<option<code-label>>, string>;
export labels-for-symbols: func(language-server-id: string, symbols: list<symbol>) -> result<list<option<code-label>>, string>;
/// Returns the completions that should be shown when completing the provided slash command with the given query.
export complete-slash-command-argument: func(command: slash-command, args: list<string>) -> result<list<slash-command-argument-completion>, string>;
/// Returns the output from running the provided slash command.
export run-slash-command: func(command: slash-command, args: list<string>, worktree: option<borrow<worktree>>) -> result<slash-command-output, string>;
/// Returns the command used to start up a context server.
export context-server-command: func(context-server-id: string, project: borrow<project>) -> result<command, string>;
/// Returns the configuration for a context server.
export context-server-configuration: func(context-server-id: string, project: borrow<project>) -> result<option<context-server-configuration>, string>;
/// Returns a list of packages as suggestions to be included in the `/docs`
/// search results.
///
/// This can be used to provide completions for known packages (e.g., from the
/// local project or a registry) before a package has been indexed.
export suggest-docs-packages: func(provider-name: string) -> result<list<string>, string>;
/// Indexes the docs for the specified package.
export index-docs: func(provider-name: string, package-name: string, database: borrow<key-value-store>) -> result<_, string>;
/// Returns a configured debug adapter binary for a given debug task.
export get-dap-binary: func(adapter-name: string, config: debug-task-definition, user-installed-path: option<string>, worktree: borrow<worktree>) -> result<debug-adapter-binary, string>;
/// Returns the kind of a debug scenario (launch or attach).
export dap-request-kind: func(adapter-name: string, config: string) -> result<start-debugging-request-arguments-request, string>;
export dap-config-to-scenario: func(config: debug-config) -> result<debug-scenario, string>;
export dap-locator-create-scenario: func(locator-name: string, build-config-template: build-task-template, resolved-label: string, debug-adapter-name: string) -> option<debug-scenario>;
export run-dap-locator: func(locator-name: string, config: resolved-task) -> result<debug-request, string>;
}
@@ -0,0 +1,35 @@
interface github {
/// A GitHub release.
record github-release {
/// The version of the release.
version: string,
/// The list of assets attached to the release.
assets: list<github-release-asset>,
}
/// An asset from a GitHub release.
record github-release-asset {
/// The name of the asset.
name: string,
/// The download URL for the asset.
download-url: string,
}
/// The options used to filter down GitHub releases.
record github-release-options {
/// Whether releases without assets should be included.
require-assets: bool,
/// Whether pre-releases should be included.
pre-release: bool,
}
/// Returns the latest release for the given GitHub repository.
///
/// Takes repo as a string in the form "<owner-name>/<repo-name>", for example: "zed-industries/zed".
latest-github-release: func(repo: string, options: github-release-options) -> result<github-release, string>;
/// Returns the GitHub release with the specified tag name for the given GitHub repository.
///
/// Returns an error if a release with the given tag name does not exist.
github-release-by-tag-name: func(repo: string, tag: string) -> result<github-release, string>;
}
@@ -0,0 +1,67 @@
interface http-client {
/// An HTTP request.
record http-request {
/// The HTTP method for the request.
method: http-method,
/// The URL to which the request should be made.
url: string,
/// The headers for the request.
headers: list<tuple<string, string>>,
/// The request body.
body: option<list<u8>>,
/// The policy to use for redirects.
redirect-policy: redirect-policy,
}
/// HTTP methods.
enum http-method {
/// `GET`
get,
/// `HEAD`
head,
/// `POST`
post,
/// `PUT`
put,
/// `DELETE`
delete,
/// `OPTIONS`
options,
/// `PATCH`
patch,
}
/// The policy for dealing with redirects received from the server.
variant redirect-policy {
/// Redirects from the server will not be followed.
///
/// This is the default behavior.
no-follow,
/// Redirects from the server will be followed up to the specified limit.
follow-limit(u32),
/// All redirects from the server will be followed.
follow-all,
}
/// An HTTP response.
record http-response {
/// The response headers.
headers: list<tuple<string, string>>,
/// The response body.
body: list<u8>,
}
/// Performs an HTTP request and returns the response.
fetch: func(req: http-request) -> result<http-response, string>;
/// An HTTP response stream.
resource http-response-stream {
/// Retrieves the next chunk of data from the response stream.
///
/// Returns `Ok(None)` if the stream has ended.
next-chunk: func() -> result<option<list<u8>>, string>;
}
/// Performs an HTTP request and returns a response stream.
fetch-stream: func(req: http-request) -> result<http-response-stream, string>;
}
@@ -0,0 +1,90 @@
interface lsp {
/// An LSP completion.
record completion {
label: string,
label-details: option<completion-label-details>,
detail: option<string>,
kind: option<completion-kind>,
insert-text-format: option<insert-text-format>,
}
/// The kind of an LSP completion.
variant completion-kind {
text,
method,
function,
%constructor,
field,
variable,
class,
%interface,
module,
property,
unit,
value,
%enum,
keyword,
snippet,
color,
file,
reference,
folder,
enum-member,
constant,
struct,
event,
operator,
type-parameter,
other(s32),
}
/// Label details for an LSP completion.
record completion-label-details {
detail: option<string>,
description: option<string>,
}
/// Defines how to interpret the insert text in a completion item.
variant insert-text-format {
plain-text,
snippet,
other(s32),
}
/// An LSP symbol.
record symbol {
kind: symbol-kind,
name: string,
}
/// The kind of an LSP symbol.
variant symbol-kind {
file,
module,
namespace,
%package,
class,
method,
property,
field,
%constructor,
%enum,
%interface,
function,
variable,
constant,
%string,
number,
boolean,
array,
object,
key,
null,
enum-member,
struct,
event,
operator,
type-parameter,
other(s32),
}
}
@@ -0,0 +1,13 @@
interface nodejs {
/// Returns the path to the Node binary used by Zed.
node-binary-path: func() -> result<string, string>;
/// Returns the latest version of the given NPM package.
npm-package-latest-version: func(package-name: string) -> result<string, string>;
/// Returns the installed version of the given NPM package, if it exists.
npm-package-installed-version: func(package-name: string) -> result<option<string>, string>;
/// Installs the specified NPM package.
npm-install-package: func(package-name: string, version: string) -> result<_, string>;
}
@@ -0,0 +1,24 @@
interface platform {
/// An operating system.
enum os {
/// macOS.
mac,
/// Linux.
linux,
/// Windows.
windows,
}
/// A platform architecture.
enum architecture {
/// AArch64 (e.g., Apple Silicon).
aarch64,
/// x86.
x86,
/// x86-64.
x8664,
}
/// Gets the current operating system and architecture.
current-platform: func() -> tuple<os, architecture>;
}
@@ -0,0 +1,29 @@
interface process {
use common.{env-vars};
/// A command.
record command {
/// The command to execute.
command: string,
/// The arguments to pass to the command.
args: list<string>,
/// The environment variables to set for the command.
env: env-vars,
}
/// The output of a finished process.
record output {
/// The status (exit code) of the process.
///
/// On Unix, this will be `None` if the process was terminated by a signal.
status: option<s32>,
/// The data that the process wrote to stdout.
stdout: list<u8>,
/// The data that the process wrote to stderr.
stderr: list<u8>,
}
/// Executes the given command as a child process, waiting for it to finish
/// and collecting all of its output.
run-command: func(command: command) -> result<output, string>;
}
@@ -0,0 +1,40 @@
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, num::NonZeroU32};
/// The settings for a particular language.
#[derive(Debug, Serialize, Deserialize)]
pub struct LanguageSettings {
/// How many columns a tab should occupy.
pub tab_size: NonZeroU32,
}
/// The settings for a particular language server.
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct LspSettings {
/// The settings for the language server binary.
pub binary: Option<CommandSettings>,
/// The initialization options to pass to the language server.
pub initialization_options: Option<serde_json::Value>,
/// The settings to pass to language server.
pub settings: Option<serde_json::Value>,
}
/// The settings for a particular context server.
#[derive(Default, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct ContextServerSettings {
/// The settings for the context server binary.
pub command: Option<CommandSettings>,
/// The settings to pass to the context server.
pub settings: Option<serde_json::Value>,
}
/// The settings for a command.
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct CommandSettings {
/// The path to the command.
pub path: Option<String>,
/// The arguments to pass to the command.
pub arguments: Option<Vec<String>>,
/// The environment variables.
pub env: Option<HashMap<String, String>>,
}
@@ -0,0 +1,41 @@
interface slash-command {
use common.{range};
/// A slash command for use in the Assistant.
record slash-command {
/// The name of the slash command.
name: string,
/// The description of the slash command.
description: string,
/// The tooltip text to display for the run button.
tooltip-text: string,
/// Whether this slash command requires an argument.
requires-argument: bool,
}
/// The output of a slash command.
record slash-command-output {
/// The text produced by the slash command.
text: string,
/// The list of sections to show in the slash command placeholder.
sections: list<slash-command-output-section>,
}
/// A section in the slash command output.
record slash-command-output-section {
/// The range this section occupies.
range: range,
/// The label to display in the placeholder for this section.
label: string,
}
/// A completion for a slash command argument.
record slash-command-argument-completion {
/// The label to display for this completion.
label: string,
/// The new text that should be inserted into the command when this completion is accepted.
new-text: string,
/// Whether the command should be run when accepting this completion.
run-command: bool,
}
}
+108 -4
View File
@@ -7,6 +7,7 @@ mod since_v0_3_0;
mod since_v0_4_0;
mod since_v0_5_0;
mod since_v0_6_0;
mod since_v0_8_0;
use dap::DebugRequest;
use extension::{DebugTaskDefinition, KeyValueStoreDelegate, WorktreeDelegate};
use gpui::BackgroundExecutor;
@@ -20,7 +21,7 @@ use crate::wasm_host::wit::since_v0_6_0::dap::StartDebuggingRequestArgumentsRequ
use super::{WasmState, wasm_engine};
use anyhow::{Context as _, Result, anyhow};
use semver::Version;
use since_v0_6_0 as latest;
use since_v0_8_0 as latest;
use std::{ops::RangeInclusive, path::PathBuf, sync::Arc};
use wasmtime::{
Store,
@@ -66,7 +67,7 @@ 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 => latest::MAX_VERSION,
ReleaseChannel::Stable | ReleaseChannel::Preview => since_v0_6_0::MAX_VERSION,
};
since_v0_0_1::MIN_VERSION..=max_version
@@ -95,6 +96,7 @@ pub fn authorize_access_to_unreleased_wasm_api_version(
}
pub enum Extension {
V0_8_0(since_v0_8_0::Extension),
V0_6_0(since_v0_6_0::Extension),
V0_5_0(since_v0_5_0::Extension),
V0_4_0(since_v0_4_0::Extension),
@@ -118,10 +120,21 @@ impl Extension {
let _ = release_channel;
if version >= latest::MIN_VERSION {
authorize_access_to_unreleased_wasm_api_version(release_channel)?;
let extension =
latest::Extension::instantiate_async(store, component, latest::linker(executor))
.await
.context("failed to instantiate wasm extension")?;
Ok(Self::V0_8_0(extension))
} else if version >= since_v0_6_0::MIN_VERSION {
let extension = since_v0_6_0::Extension::instantiate_async(
store,
component,
since_v0_6_0::linker(executor),
)
.await
.context("failed to instantiate wasm extension")?;
Ok(Self::V0_6_0(extension))
} else if version >= since_v0_5_0::MIN_VERSION {
let extension = since_v0_5_0::Extension::instantiate_async(
@@ -200,6 +213,7 @@ impl Extension {
pub async fn call_init_extension(&self, store: &mut Store<WasmState>) -> Result<()> {
match self {
Extension::V0_8_0(ext) => ext.call_init_extension(store).await,
Extension::V0_6_0(ext) => ext.call_init_extension(store).await,
Extension::V0_5_0(ext) => ext.call_init_extension(store).await,
Extension::V0_4_0(ext) => ext.call_init_extension(store).await,
@@ -220,6 +234,10 @@ impl Extension {
resource: Resource<Arc<dyn WorktreeDelegate>>,
) -> Result<Result<Command, String>> {
match self {
Extension::V0_8_0(ext) => {
ext.call_language_server_command(store, &language_server_id.0, resource)
.await
}
Extension::V0_6_0(ext) => {
ext.call_language_server_command(store, &language_server_id.0, resource)
.await
@@ -282,6 +300,14 @@ impl Extension {
resource: Resource<Arc<dyn WorktreeDelegate>>,
) -> Result<Result<Option<String>, String>> {
match self {
Extension::V0_8_0(ext) => {
ext.call_language_server_initialization_options(
store,
&language_server_id.0,
resource,
)
.await
}
Extension::V0_6_0(ext) => {
ext.call_language_server_initialization_options(
store,
@@ -371,6 +397,14 @@ impl Extension {
resource: Resource<Arc<dyn WorktreeDelegate>>,
) -> Result<Result<Option<String>, String>> {
match self {
Extension::V0_8_0(ext) => {
ext.call_language_server_workspace_configuration(
store,
&language_server_id.0,
resource,
)
.await
}
Extension::V0_6_0(ext) => {
ext.call_language_server_workspace_configuration(
store,
@@ -439,6 +473,15 @@ impl Extension {
resource: Resource<Arc<dyn WorktreeDelegate>>,
) -> Result<Result<Option<String>, String>> {
match self {
Extension::V0_8_0(ext) => {
ext.call_language_server_additional_initialization_options(
store,
&language_server_id.0,
&target_language_server_id.0,
resource,
)
.await
}
Extension::V0_6_0(ext) => {
ext.call_language_server_additional_initialization_options(
store,
@@ -483,6 +526,15 @@ impl Extension {
resource: Resource<Arc<dyn WorktreeDelegate>>,
) -> Result<Result<Option<String>, String>> {
match self {
Extension::V0_8_0(ext) => {
ext.call_language_server_additional_workspace_configuration(
store,
&language_server_id.0,
&target_language_server_id.0,
resource,
)
.await
}
Extension::V0_6_0(ext) => {
ext.call_language_server_additional_workspace_configuration(
store,
@@ -526,10 +578,23 @@ impl Extension {
completions: Vec<latest::Completion>,
) -> Result<Result<Vec<Option<CodeLabel>>, String>> {
match self {
Extension::V0_6_0(ext) => {
Extension::V0_8_0(ext) => {
ext.call_labels_for_completions(store, &language_server_id.0, &completions)
.await
}
Extension::V0_6_0(ext) => Ok(ext
.call_labels_for_completions(
store,
&language_server_id.0,
&completions.into_iter().collect::<Vec<_>>(),
)
.await?
.map(|labels| {
labels
.into_iter()
.map(|label| label.map(Into::into))
.collect()
})),
Extension::V0_5_0(ext) => Ok(ext
.call_labels_for_completions(
store,
@@ -619,10 +684,23 @@ impl Extension {
symbols: Vec<latest::Symbol>,
) -> Result<Result<Vec<Option<CodeLabel>>, String>> {
match self {
Extension::V0_6_0(ext) => {
Extension::V0_8_0(ext) => {
ext.call_labels_for_symbols(store, &language_server_id.0, &symbols)
.await
}
Extension::V0_6_0(ext) => Ok(ext
.call_labels_for_symbols(
store,
&language_server_id.0,
&symbols.into_iter().collect::<Vec<_>>(),
)
.await?
.map(|labels| {
labels
.into_iter()
.map(|label| label.map(Into::into))
.collect()
})),
Extension::V0_5_0(ext) => Ok(ext
.call_labels_for_symbols(
store,
@@ -712,6 +790,10 @@ impl Extension {
arguments: &[String],
) -> Result<Result<Vec<SlashCommandArgumentCompletion>, String>> {
match self {
Extension::V0_8_0(ext) => {
ext.call_complete_slash_command_argument(store, command, arguments)
.await
}
Extension::V0_6_0(ext) => {
ext.call_complete_slash_command_argument(store, command, arguments)
.await
@@ -750,6 +832,10 @@ impl Extension {
resource: Option<Resource<Arc<dyn WorktreeDelegate>>>,
) -> Result<Result<SlashCommandOutput, String>> {
match self {
Extension::V0_8_0(ext) => {
ext.call_run_slash_command(store, command, arguments, resource)
.await
}
Extension::V0_6_0(ext) => {
ext.call_run_slash_command(store, command, arguments, resource)
.await
@@ -787,6 +873,10 @@ impl Extension {
project: Resource<ExtensionProject>,
) -> Result<Result<Command, String>> {
match self {
Extension::V0_8_0(ext) => {
ext.call_context_server_command(store, &context_server_id, project)
.await
}
Extension::V0_6_0(ext) => {
ext.call_context_server_command(store, &context_server_id, project)
.await
@@ -823,6 +913,10 @@ impl Extension {
project: Resource<ExtensionProject>,
) -> Result<Result<Option<ContextServerConfiguration>, String>> {
match self {
Extension::V0_8_0(ext) => {
ext.call_context_server_configuration(store, &context_server_id, project)
.await
}
Extension::V0_6_0(ext) => {
ext.call_context_server_configuration(store, &context_server_id, project)
.await
@@ -849,6 +943,7 @@ impl Extension {
provider: &str,
) -> Result<Result<Vec<String>, String>> {
match self {
Extension::V0_8_0(ext) => ext.call_suggest_docs_packages(store, provider).await,
Extension::V0_6_0(ext) => ext.call_suggest_docs_packages(store, provider).await,
Extension::V0_5_0(ext) => ext.call_suggest_docs_packages(store, provider).await,
Extension::V0_4_0(ext) => ext.call_suggest_docs_packages(store, provider).await,
@@ -869,6 +964,10 @@ impl Extension {
kv_store: Resource<Arc<dyn KeyValueStoreDelegate>>,
) -> Result<Result<(), String>> {
match self {
Extension::V0_8_0(ext) => {
ext.call_index_docs(store, provider, package_name, kv_store)
.await
}
Extension::V0_6_0(ext) => {
ext.call_index_docs(store, provider, package_name, kv_store)
.await
@@ -898,6 +997,7 @@ impl Extension {
}
}
}
pub async fn call_get_dap_binary(
&self,
store: &mut Store<WasmState>,
@@ -924,6 +1024,7 @@ impl Extension {
_ => anyhow::bail!("`get_dap_binary` not available prior to v0.6.0"),
}
}
pub async fn call_dap_request_kind(
&self,
store: &mut Store<WasmState>,
@@ -944,6 +1045,7 @@ impl Extension {
_ => anyhow::bail!("`dap_request_kind` not available prior to v0.6.0"),
}
}
pub async fn call_dap_config_to_scenario(
&self,
store: &mut Store<WasmState>,
@@ -962,6 +1064,7 @@ impl Extension {
_ => anyhow::bail!("`dap_config_to_scenario` not available prior to v0.6.0"),
}
}
pub async fn call_dap_locator_create_scenario(
&self,
store: &mut Store<WasmState>,
@@ -988,6 +1091,7 @@ impl Extension {
_ => anyhow::bail!("`dap_locator_create_scenario` not available prior to v0.6.0"),
}
}
pub async fn call_run_dap_locator(
&self,
store: &mut Store<WasmState>,
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff