2024-03-02 00:00:55 +00:00
|
|
|
package zed:extension;
|
|
|
|
|
|
|
|
world extension {
|
|
|
|
export init-extension: func();
|
|
|
|
|
|
|
|
record github-release {
|
|
|
|
version: string,
|
|
|
|
assets: list<github-release-asset>,
|
|
|
|
}
|
|
|
|
|
|
|
|
record github-release-asset {
|
|
|
|
name: string,
|
|
|
|
download-url: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
record github-release-options {
|
|
|
|
require-assets: bool,
|
|
|
|
pre-release: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum os {
|
|
|
|
mac,
|
|
|
|
linux,
|
|
|
|
windows,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum architecture {
|
|
|
|
aarch64,
|
|
|
|
x86,
|
|
|
|
x8664,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum downloaded-file-type {
|
|
|
|
gzip,
|
|
|
|
gzip-tar,
|
|
|
|
zip,
|
|
|
|
uncompressed,
|
|
|
|
}
|
|
|
|
|
|
|
|
variant language-server-installation-status {
|
2024-03-23 00:29:06 +00:00
|
|
|
none,
|
2024-03-02 00:00:55 +00:00
|
|
|
downloading,
|
2024-03-23 00:29:06 +00:00
|
|
|
checking-for-update,
|
2024-03-02 00:00:55 +00:00
|
|
|
failed(string),
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Gets the current operating system and architecture
|
|
|
|
import current-platform: func() -> tuple<os, architecture>;
|
|
|
|
|
2024-03-23 00:29:06 +00:00
|
|
|
/// Get the path to the node binary used by Zed.
|
|
|
|
import node-binary-path: func() -> result<string, string>;
|
|
|
|
|
2024-03-02 00:00:55 +00:00
|
|
|
/// Gets the latest version of the given NPM package.
|
|
|
|
import npm-package-latest-version: func(package-name: string) -> result<string, string>;
|
|
|
|
|
2024-03-20 19:47:04 +00:00
|
|
|
/// Returns the installed version of the given NPM package, if it exists.
|
|
|
|
import npm-package-installed-version: func(package-name: string) -> result<option<string>, string>;
|
|
|
|
|
|
|
|
/// Installs the specified NPM package.
|
|
|
|
import npm-install-package: func(package-name: string, version: string) -> result<_, string>;
|
|
|
|
|
2024-03-02 00:00:55 +00:00
|
|
|
/// Gets the latest release for the given GitHub repository.
|
|
|
|
import latest-github-release: func(repo: string, options: github-release-options) -> result<github-release, string>;
|
|
|
|
|
2024-04-01 19:28:24 +00:00
|
|
|
/// Downloads a file from the given url, and saves it to the given path within the extension's
|
2024-03-02 00:00:55 +00:00
|
|
|
/// working directory. Extracts the file according to the given file type.
|
2024-04-01 19:28:24 +00:00
|
|
|
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>;
|
2024-03-02 00:00:55 +00:00
|
|
|
|
|
|
|
/// 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);
|
|
|
|
|
2024-03-08 22:18:06 +00:00
|
|
|
type env-vars = list<tuple<string, string>>;
|
|
|
|
|
2024-03-02 00:00:55 +00:00
|
|
|
record command {
|
|
|
|
command: string,
|
|
|
|
args: list<string>,
|
2024-03-08 22:18:06 +00:00
|
|
|
env: env-vars,
|
2024-03-02 00:00:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource worktree {
|
|
|
|
read-text-file: func(path: string) -> result<string, string>;
|
2024-03-08 22:18:06 +00:00
|
|
|
which: func(binary-name: string) -> option<string>;
|
|
|
|
shell-env: func() -> env-vars;
|
2024-03-02 00:00:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
record language-server-config {
|
|
|
|
name: string,
|
|
|
|
language-name: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export language-server-command: func(config: language-server-config, worktree: borrow<worktree>) -> result<command, string>;
|
2024-03-20 19:47:04 +00:00
|
|
|
export language-server-initialization-options: func(config: language-server-config, worktree: borrow<worktree>) -> result<option<string>, string>;
|
2024-03-02 00:00:55 +00:00
|
|
|
}
|