This PR makes it so dev extensions that are installed are excluded when
checking for extension updates.
We don't want to accidentally clobber dev extensions if the upstream
extension is deemed more "up-to-date".
Release Notes:
- Changed dev extensions to be excluded from extension auto-updates.
For now extensions can only register global snippets, but there'll be
follow-up work to support scope attribute in snippets.json.
Release Notes:
- Extensions can now provide snippets by including `snippets.json` file
next to the extension manifest.
---------
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR updates the extension API to use structured slash command
completions instead of plain strings.
This allows slash commands defined in extensions to take advantage of
the improvements made in #13876.
Release Notes:
- N/A
This PR improves the completions for arguments in the `/docs` slash
command.
We achieved this by extending the `complete_argument` method on the
`SlashCommand` trait to return a `Vec<ArgumentCompletion>` instead of a
`Vec<String>`.
In addition to the completion `label`, `ArgumentCompletion` has two new
fields that are can be used to customize the completion behavior:
- `new_text`: The actual text that will be inserted when the completion
is accepted, which may be different from what is shown by the completion
label.
- `run_command`: Whether the command is run when the completion is
accepted. This can be set to `false` to allow accepting a completion
without running the command.
Release Notes:
- N/A
---------
Co-authored-by: Antonio <antonio@zed.dev>
This PR replaces the usage of `unzip` for extracting `.zip` files
downloaded by extensions with extraction via a library.
This will allow us to extract `.zip` files even if `unzip` is not
available (e.g., on Windows).
Release Notes:
- Removed the need for `unzip` to be present on the system to extract
`.zip` files downloaded by extensions.
This PR updates the `extension` crate's tests to use a dedicated test
extension for its tests instead of the real Gleam extension.
As the Gleam extension continues to evolve, it makes it less suitable to
use as a test fixture:
1. For a while now, the test has failed locally due to me having `gleam`
on my $PATH, which causes the extension's `get_language_server_command`
to go down a separate codepath.
2. With the addition of the `indexed_docs_providers` the test was
hanging indefinitely.
While these problems are likely solvable, it seems reasonable to have a
dedicated extension to use as a test fixture. That way we can do
whatever we need to exercise our test criteria.
The `test-extension` is a fork of the Gleam extension with some
additional functionality removed.
Release Notes:
- N/A
This PR renames `ExtensionDocsIndexer` to `ExtensionIndexedDocsProvider`
to better align with the name of the trait it implements.
Release Notes:
- N/A
This PR adds a new `fetch` function to the `zed_extension_api` to allow
fetching a URL through the Wasm host.
Currently we only support GET requests and return the response body as a
string.
Release Notes:
- N/A
This PR extends the interface for slash commands defined in extensions
to have them return `SlashCommandOutput`.
This allows for slash commands to return multiple output sections for a
single piece of generated text.
Note that we don't allow specifying the icon to display in the
placeholder, as we don't want to commit to that in our API at the
moment.
Release Notes:
- N/A
This PR replaces the `lazy_static!` usages in the `paths` crate with
`OnceLock` from the standard library.
This allows us to drop the `lazy_static` dependency from this crate.
The paths are now exposed as accessor functions that reference a private
static value.
Release Notes:
- N/A
This PR extracts the definition of the various Zed paths out of `util`
and into a new `paths` crate.
`util` is for generic utils, while these paths are Zed-specific. For
instance, `gpui` depends on `util`, and it shouldn't have knowledge of
these paths, since they are only used by Zed.
Release Notes:
- N/A
This PR fixes an issue where the `zed-extension` CLI could no longer be
run as a static binary due to the following error:
```
dyld[36964]: Library not loaded: @rpath/WebRTC.framework/WebRTC
Referenced from: <56332E1D-292E-3F9B-97B9-8A9962D21599> /Users/maxdeviant/projects/zed-extensions/zed-extension
Reason: no LC_RPATH's found
fish: Job 1, './zed-extension --scratch-dir .…' terminated by signal SIGABRT (Abort)
```
This is the result of the addition of a dependency on `workspace` to the
`extension` crate (and thus, the `extension_cli` crate) in #12360.
Since we don't actually _need_ WebRTC in the extension CLI, we don't
care about dynamically linking it.
To resolve this, a new `no-webrtc` feature has been added to the
`live_kit_client` client crate and threaded through all of the crates
between it and the `extension_cli`.
Enabling the `no-webrtc` feature will prevent linking to the LiveKit
Swift SDK as well as linking the WebRTC framework.
Release Notes:
- N/A
Note:
- We have disabled all tests that rely on Postgres in the Linux CI. We
only really need to test these once, and as macOS is our team's primary
platform, we'll only enable them on macOS for local reproduction.
- We have disabled all tests that rely on the font metrics. We
standardized on Zed Mono in many fonts, but our CoreText Text System and
Cosmic Text System proved to be very different in effect. We should
revisit if we decide to standardize our text system across platforms
(e.g. using Harfbuzz everywhere)
- Extended the condition timeout significantly. Our CI machines are slow
enough that this is causing spurious errors in random tests.
Release Notes:
- N/A
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
TODO:
- [x] Finish GPUI changes on other operating systems
This is a largely internal change to how we report data to our
diagnostics and telemetry. This PR also includes an update to our blade
backend which allows us to report errors in a more useful way when
failing to initialize blade.
Release Notes:
- N/A
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This could still use some improvement UI-wise but the user experience
should be a lot better.
- [x] Show in "Window" application menu
- [x] Load prompt as it's selected in the picker
- [x] Refocus picker on `esc`
- [x] When creating a new prompt, if a new prompt already exists and is
unedited, activate it instead
- [x] Add `/default` command
- [x] Evaluate /commands on prompt insertion
- [x] Autocomplete /commands (but don't evaluate) during prompt editing
- [x] Show token count using the settings model, right-aligned in the
editor
- [x] Picker
- [x] Sorted alpha
- [x] 2 sublists
- Default
- Empty state: Star a prompt to add it to your default prompt
- Otherwise show prompts with star on hover
- All
- Move prompts with star on hover
Release Notes:
- N/A
- Confirming a completion now runs the command immediately
- Hitting `enter` on a line with a command now runs it
- The output of commands gets folded away and replaced with a custom
placeholder
- Eliminated ambient context
<img width="1588" alt="image"
src="https://github.com/zed-industries/zed/assets/482957/b1927a45-52d6-4634-acc9-2ee539c1d89a">
Release Notes:
- N/A
---------
Co-authored-by: Nathan Sobo <nathan@zed.dev>
This PR adds initial support for defining slash commands for the
Assistant from extensions.
Slash commands are defined in an extension's `extension.toml`:
```toml
[slash_commands.gleam-project]
description = "Returns information about the current Gleam project."
requires_argument = false
```
and then executed via the `run_slash_command` method on the `Extension`
trait:
```rs
impl Extension for GleamExtension {
// ...
fn run_slash_command(
&self,
command: SlashCommand,
_argument: Option<String>,
worktree: &zed::Worktree,
) -> Result<Option<String>, String> {
match command.name.as_str() {
"gleam-project" => Ok(Some("Yayyy".to_string())),
command => Err(format!("unknown slash command: \"{command}\"")),
}
}
}
```
Release Notes:
- N/A
This PR adds a new `github_release_by_tag_name` method to the
`zed_extension_api` to allow for retrieving a GitHub release by its tag
name.
Release Notes:
- N/A
This PR restricts usage of v0.0.7 of the `zed_extension_api` to dev
builds, for now.
As we're still making changes to it, we don't want to ship a version of
Zed to Preview/Stable that claims to support a yet-unreleased version of
the extension API.
Release Notes:
- N/A
This PR forks a new version of the `zed_extension_api` in preparation
for some upcoming changes that require breaking changes to the WIT.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>
This PR changes the interface of ContextProvider, allowing it to inspect
*all* variables set so far during the process of building
`TaskVariables`. This makes it possible to capture e.g. an identifier in
tree-sitter query, process it and then export it as a task variable.
Notably, the list of variables includes captures prefixed with leading
underscore; they are removed after all calls to `build_context`, but it
makes it possible to capture something and then conditionally preserve
it (and perhaps modify it).
Release Notes:
- N/A
Adding `proxy` keyword to configure proxy while using zed. After setting
the proxy, restart Zed to acctually use the proxy.
Example setting:
```rust
"proxy" = "socks5://localhost:10808"
"proxy" = "http://127.0.0.1:10809"
```
Closes#9424, closes#9422, closes#8650, closes#5032, closes#6701,
closes#11890
Release Notes:
- Added settings to configure proxy in Zed
---------
Co-authored-by: Jason Lee <huacnlee@gmail.com>
- [x] Build out cli on linux
- [x] Add support for --dev-server-token sent by the CLI
- [x] Package cli into the .tar.gz
- [x] Link the cli to ~/.local/bin in install.sh
Release Notes:
- linux: Add cli support for managing zed
This PR adds a `json_merge_with` function to `SettingsSources::<T>` to
allow JSON merging settings from custom sources.
This should help avoid repeating the actual merging logic when all that
needs to be customized is which sources are being respected.
Release Notes:
- N/A
This PR makes it so the HTML extension will be installed in Zed by
default.
We feel we should keep HTML available out-of-the-box, but we want to do
so while still keeping it as an extension (as opposed to built-in to Zed
natively). There may be a world where we bundle the extension in with
the Zed binary itself, but installing it on startup gets us 99% of the
way there.
The approach for making HTML available by default is quite general, and
could be applied to any extension that we choose (likely other languages
that we want to come out-of-the-box, but that could then be moved to
extensions).
If you do not want the HTML extension in Zed, you can disable the
auto-installation in your `settings.json` and then uninstall the
extension:
```json
{
"auto_install_extensions": {
"html": false
}
}
```
Release Notes:
- Added auto-installation for the HTML extension on startup.
- This can be disabled by adding `{ "auto_install_extensions": { "html":
false } }` to your settings.
This PR fixes an issue where workspace-level LSP settings could be not
read using `LspSettings::for_worktree` in extensions.
We we erroneously always reading the global settings instead of
respecting the passed-in location.
Release Notes:
- Fixed a bug where workspace LSP settings could not be read by
extensions.
This PR extracts Vue support into an extension and removes the built-in
C# support from Zed.
Release Notes:
- Removed built-in support for Vue, in favor of making it available as
an extension. The Vue extension will be suggested for download when you
open a `.vue` file.
---------
Co-authored-by: Max <max@zed.dev>
This PR extracts Terraform support into an extension and removes the
built-in Terraform support from Zed.
Release Notes:
- Removed built-in support for Terraform, in favor of making it
available as
an extension. The Terraform extension will be suggested for download
when you
open a `.tf`, `.tfvars`, or `.hcl` file.
Release Notes:
- Fixed a bug where extension installation would appear to succeed even
if the download did not complete due to network interruptions
([#10330](https://github.com/zed-industries/zed/issues/10330)).
Co-authored-by: Marshall <marshall@zed.dev>
This PR fixes a potential panic that could occur when loading malformed
Wasm files.
We now use the `parse_wasm_extension_version` function that was
previously used just to extract the Zed extension API version from the
Wasm bytes as a pre-validation step. By parsing the entirety of the Wasm
file here instead of returning as soon as we find the version, the
invalid Wasm bytes are now surfaced as an `Err` instead of a panic.
We were able to replicate the panic using the following test:
```rs
#[gpui::test]
async fn test_bad_wasm(cx: &mut TestAppContext) {
init_test(cx);
let wasm_host = cx.update(|cx| {
WasmHost::new(
FakeFs::new(cx.background_executor().clone()),
FakeHttpClient::with_200_response(),
FakeNodeRuntime::new(),
Arc::new(LanguageRegistry::test(cx.background_executor().clone())),
PathBuf::from("/the/work/dir".to_string()),
cx,
)
});
let mut wasm_bytes = std::fs::read("/Users/maxdeviant/Library/Application Support/Zed/extensions/installed/dart/extension.wasm").unwrap();
// This is the error message we were seeing in the stack trace:
// range end index 267037 out of range for slice of length 253952
dbg!(&wasm_bytes.len());
// Truncate the bytes to the same point:
wasm_bytes.truncate(253952);
std::fs::write("/tmp/bad-extension.wasm", wasm_bytes.clone()).unwrap();
let manifest = Arc::new(ExtensionManifest {
id: "the-extension".into(),
name: "The Extension".into(),
version: "0.0.1".into(),
schema_version: SchemaVersion(1),
description: Default::default(),
repository: Default::default(),
authors: Default::default(),
lib: LibManifestEntry {
kind: None,
version: None,
},
themes: Default::default(),
languages: Default::default(),
grammars: Default::default(),
language_servers: Default::default(),
});
// 💥
let result = wasm_host
.load_extension(wasm_bytes, manifest, cx.executor())
.await;
dbg!(result.map(|_| ()));
```
Release Notes:
- Fixed a crash that could occur when loading malformed Wasm extensions
([#10352](https://github.com/zed-industries/zed/issues/10352)).
---------
Co-authored-by: Max <max@zed.dev>
This PR makes it so our temporary host-side workaround for setting
certain language server binaries as executable only applies to binaries
that are downloaded by the extension.
Previously we would do this for any binary, including ones that could
have been sourced from the $PATH.
Release Notes:
- Fixed a file permissions issue when trying to use a Zig language
server (`zls`) present on the $PATH.
This PR adds the ability for extensions to provide certain language
settings via the language `config.toml`.
These settings are then merged in with the rest of the settings when the
language is loaded from the extension.
The language settings that are available are:
- `tab_size`
- `hard_tabs`
- `soft_wrap`
Additionally, for bundled languages we moved these settings out of the
`settings/default.json` and into their respective `config.toml`s .
For languages currently provided by extensions, we are leaving the
values in the `settings/default.json` temporarily until all released
versions of Zed are able to load these settings from the extension.
---
Along the way we ended up refactoring the `Settings::load` method
slightly, introducing a new `SettingsSources` struct to better convey
where the settings are being loaded from.
This makes it easier to load settings from specific locations/sets of
locations in an explicit way.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>