Provide wasm extensions with APIs needed for using pre-installed LSP binaries (#9085)

In this PR, we've added two new methods that LSP extensions can call:
* `shell_env()`, for retrieving the environment variables set in the
user's default shell in the worktree
* `which(command)`, for looking up paths to an executable (accounting
for the user's shell env in the worktree)

To test this out, we moved the `uiua` language support into an
extension. We went ahead and removed the built-in support, since this
language is extremely obscure. Sorry @mikayla-maki. To continue coding
in Uiua in Zed, for now you can `Add Dev Extension` from the extensions
pane, and select the `extensions/uiua` directory in the Zed repo. Very
soon, we'll support publishing these extensions so that you'll be able
to just install it normally.

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
Max Brunsfeld 2024-03-08 14:18:06 -08:00 committed by GitHub
parent 5abcc1c3c5
commit 8a6264d933
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 235 additions and 256 deletions

163
Cargo.lock generated
View file

@ -3011,15 +3011,6 @@ dependencies = [
"util",
]
[[package]]
name = "debugid"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d"
dependencies = [
"uuid",
]
[[package]]
name = "deflate"
version = "0.8.6"
@ -3159,16 +3150,6 @@ dependencies = [
"subtle",
]
[[package]]
name = "directories-next"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc"
dependencies = [
"cfg-if 1.0.0",
"dirs-sys-next",
]
[[package]]
name = "dirs"
version = "3.0.2"
@ -3556,6 +3537,7 @@ dependencies = [
"theme",
"toml 0.8.10",
"util",
"wasm-encoder",
"wasmparser",
"wasmtime",
"wasmtime-wasi",
@ -4165,28 +4147,6 @@ dependencies = [
"thread_local",
]
[[package]]
name = "fxhash"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
dependencies = [
"byteorder",
]
[[package]]
name = "fxprof-processed-profile"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd"
dependencies = [
"bitflags 2.4.2",
"debugid",
"fxhash",
"serde",
"serde_json",
]
[[package]]
name = "generic-array"
version = "0.14.7"
@ -5060,26 +5020,6 @@ version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
[[package]]
name = "ittapi"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1"
dependencies = [
"anyhow",
"ittapi-sys",
"log",
]
[[package]]
name = "ittapi-sys"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc"
dependencies = [
"cc",
]
[[package]]
name = "jni"
version = "0.19.0"
@ -5385,7 +5325,6 @@ dependencies = [
"tree-sitter-svelte",
"tree-sitter-toml",
"tree-sitter-typescript",
"tree-sitter-uiua",
"tree-sitter-vue",
"tree-sitter-yaml",
"tree-sitter-zig",
@ -10816,15 +10755,6 @@ dependencies = [
"tree-sitter",
]
[[package]]
name = "tree-sitter-uiua"
version = "0.10.0"
source = "git+https://github.com/shnarazk/tree-sitter-uiua?rev=21dc2db39494585bf29a3f86d5add6e9d11a22ba#21dc2db39494585bf29a3f86d5add6e9d11a22ba"
dependencies = [
"cc",
"tree-sitter",
]
[[package]]
name = "tree-sitter-vue"
version = "0.0.1"
@ -11440,15 +11370,6 @@ dependencies = [
"leb128",
]
[[package]]
name = "wasm-encoder"
version = "0.201.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9c7d2731df60006819b013f64ccc2019691deccf6e11a1804bc850cd6748f1a"
dependencies = [
"leb128",
]
[[package]]
name = "wasm-metadata"
version = "0.10.20"
@ -11461,7 +11382,7 @@ dependencies = [
"serde_derive",
"serde_json",
"spdx",
"wasm-encoder 0.41.2",
"wasm-encoder",
"wasmparser",
]
@ -11492,41 +11413,33 @@ version = "18.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c843b8bc4dd4f3a76173ba93405c71111d570af0d90ea5f6299c705d0c2add2"
dependencies = [
"addr2line",
"anyhow",
"async-trait",
"bincode",
"bumpalo",
"cfg-if 1.0.0",
"encoding_rs",
"fxprof-processed-profile",
"gimli",
"indexmap 2.0.0",
"ittapi",
"libc",
"log",
"object",
"once_cell",
"paste",
"rayon",
"rustix 0.38.30",
"serde",
"serde_derive",
"serde_json",
"target-lexicon",
"wasm-encoder 0.41.2",
"wasmparser",
"wasmtime-cache",
"wasmtime-component-macro",
"wasmtime-component-util",
"wasmtime-cranelift",
"wasmtime-environ",
"wasmtime-fiber",
"wasmtime-jit-debug",
"wasmtime-jit-icache-coherence",
"wasmtime-runtime",
"wasmtime-winch",
"wat",
"windows-sys 0.52.0",
]
@ -11563,26 +11476,6 @@ dependencies = [
"quote",
]
[[package]]
name = "wasmtime-cache"
version = "18.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fb4fc2bbf9c790a57875eba65588fa97acf57a7d784dc86d057e648d9a1ed91"
dependencies = [
"anyhow",
"base64 0.21.4",
"bincode",
"directories-next",
"log",
"rustix 0.38.30",
"serde",
"serde_derive",
"sha2 0.10.7",
"toml 0.5.11",
"windows-sys 0.52.0",
"zstd",
]
[[package]]
name = "wasmtime-component-macro"
version = "18.0.2"
@ -11664,7 +11557,7 @@ dependencies = [
"serde_derive",
"target-lexicon",
"thiserror",
"wasm-encoder 0.41.2",
"wasm-encoder",
"wasmparser",
"wasmprinter",
"wasmtime-component-util",
@ -11686,18 +11579,6 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "wasmtime-jit-debug"
version = "18.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "833dae95bc7a4f9177bf93f9497419763535b74e37eb8c37be53937d3281e287"
dependencies = [
"object",
"once_cell",
"rustix 0.38.30",
"wasmtime-versioned-export-macros",
]
[[package]]
name = "wasmtime-jit-icache-coherence"
version = "18.0.2"
@ -11729,11 +11610,10 @@ dependencies = [
"psm",
"rustix 0.38.30",
"sptr",
"wasm-encoder 0.41.2",
"wasm-encoder",
"wasmtime-asm-macros",
"wasmtime-environ",
"wasmtime-fiber",
"wasmtime-jit-debug",
"wasmtime-versioned-export-macros",
"wasmtime-wmemcheck",
"windows-sys 0.52.0",
@ -11840,28 +11720,6 @@ dependencies = [
"leb128",
]
[[package]]
name = "wast"
version = "201.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ef6e1ef34d7da3e2b374fd2b1a9c0227aff6cad596e1b24df9b58d0f6222faa"
dependencies = [
"bumpalo",
"leb128",
"memchr",
"unicode-width",
"wasm-encoder 0.201.0",
]
[[package]]
name = "wat"
version = "1.201.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "453d5b37a45b98dee4f4cb68015fc73634d7883bbef1c65e6e9c78d454cf3f32"
dependencies = [
"wast 201.0.0",
]
[[package]]
name = "wayland-backend"
version = "0.3.3"
@ -12515,7 +12373,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"wasm-encoder 0.41.2",
"wasm-encoder",
"wasm-metadata",
"wasmparser",
"wit-parser 0.13.2",
@ -12534,7 +12392,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"wasm-encoder 0.41.2",
"wasm-encoder",
"wasm-metadata",
"wasmparser",
"wit-parser 0.14.0",
@ -12584,7 +12442,7 @@ dependencies = [
"anyhow",
"log",
"thiserror",
"wast 35.0.2",
"wast",
]
[[package]]
@ -13003,6 +12861,13 @@ dependencies = [
"zed_extension_api",
]
[[package]]
name = "zed_uiua"
version = "0.0.1"
dependencies = [
"zed_extension_api",
]
[[package]]
name = "zeno"
version = "0.2.3"