
# Installation

None of the extensions is in Zed's extension registry yet, so you cannot find them on Zed's Extensions page. They are installed as **dev extensions**: Zed builds them from a folder on your computer and loads them from there. That is what the command `zed: install dev extension` does, and what the install scripts do for you.

| Extension | Repository | Folder |
|---|---|---|
| [Flutter Tools](flutter-tools.md) | [farum-azula/zed_editor_extensions](https://github.com/farum-azula/zed_editor_extensions) | `flutter-extension` |
| [HTTP Client](http-client.md) | [farum-azula/zed_editor_extensions](https://github.com/farum-azula/zed_editor_extensions) | `http-client-extension` |
| [Farum Azula Themes](themes.md) | [farum-azula/zed_editor_extensions](https://github.com/farum-azula/zed_editor_extensions) | `theme-extension` |
| [Spring for Dart](spring-for-dart.md) | [farum-azula/spring_core_dart](https://github.com/farum-azula/spring_core_dart) | `extensions/zed/dart_spring` |

The install scripts cover the three extensions of the zed_editor_extensions repository. Spring for Dart lives in the framework's repository and is installed with `zed: install dev extension` (see [Spring for Dart](#spring-for-dart)).

## Requirements

- [Zed](https://zed.dev), a recent version with tasks, runnables and debuggers.
- [Rust](https://rustup.rs), installed with `rustup`. Zed and the scripts compile each extension's Rust code to WebAssembly; the scripts add the `wasm32-wasip2` target themselves.
- `git`.
- An internet connection the first time: the sources of the tree-sitter grammars and the wasi-sdk compiler Zed uses are downloaded into Zed's own cache.

Each extension then needs what it works with:

| Extension | Also needs |
|---|---|
| Flutter Tools | Flutter on the `PATH`, or fvm. Zed's Dart extension must be uninstalled first |
| HTTP Client | Nothing: it downloads its runner, or builds it with `cargo` |
| Farum Azula Themes | Nothing |
| Spring for Dart | Nothing on Apple Silicon Macs, Linux x64 and arm64, and Windows x64: it downloads its language server. Elsewhere, the Dart SDK to build it |

## Before installing Flutter Tools

Flutter Tools defines the Dart language, and two extensions cannot both define it. Remove Zed's Dart extension first:

1. Open the Extensions page: `zed: extensions` in the command palette.
2. Find **Dart** under the installed extensions and press **Uninstall**.
3. If your `settings.json` has `"auto_install_extensions": { "dart": true }`, remove that entry, or Zed installs Dart again.

Settings of the Dart language server (`"lsp": { "dart": ... }`) stay where they are and keep working.

## With the install scripts

Clone the repository, then run the script for your system from its root. The script installs every extension of the repository that Zed does not have yet.

### macOS and Linux

```sh
git clone https://github.com/farum-azula/zed_editor_extensions.git
cd zed_editor_extensions
./install.sh
```

The output names each extension as it goes:

```text
flutter-tools: installing from flutter-extension
  building extension.wasm
  building grammars/dart.wasm
  building grammars/dartdoc.wasm
flutter-tools: installed
http-client: installing from http-client-extension
  building extension.wasm
  building grammars/http.wasm
http-client: installed
farum-azula-theme: installing from theme-extension
farum-azula-theme: installed
```

The extensions go into Zed's extensions folder: `~/Library/Application Support/Zed/extensions` on macOS, `~/.local/share/zed/extensions` on Linux (or `$XDG_DATA_HOME/zed/extensions`).

### Windows

In PowerShell:

```powershell
git clone https://github.com/farum-azula/zed_editor_extensions.git
cd zed_editor_extensions
powershell -ExecutionPolicy Bypass -File install.ps1
```

The extensions go into `%LOCALAPPDATA%\Zed\extensions`. The script also runs under PowerShell 7 on macOS and Linux.

### What the scripts do

For each top-level folder with an `extension.toml`, the script reads the extension's `id` and skips it when Zed already has it (`<id>: already installed`). Otherwise it:

1. builds the extension's Rust code into `extension.wasm` with `cargo build --release --target wasm32-wasip2`;
2. fetches each tree-sitter grammar at the commit `extension.toml` pins and compiles it into `grammars/<name>.wasm` with the wasi-sdk, the same version Zed downloads, into the same place;
3. links the folder into Zed's `extensions/installed` folder, as a symbolic link on macOS and Linux and a junction on Windows, the way Zed does for a dev extension.

A running Zed picks the extensions up right away, without a restart. Two environment variables change the defaults:

| Variable | Effect |
|---|---|
| `ZED_EXTENSIONS_DIR` | Install into another Zed extensions folder |
| `WASI_SDK_PATH` | Use an existing wasi-sdk instead of downloading one |

## One extension at a time

Any of the extensions can be installed on its own from Zed:

1. Clone the repository.
2. Open the command palette (`Cmd-Shift-P` on macOS, `Ctrl-Shift-P` on Linux and Windows) and run `zed: install dev extension`.
3. Pick the extension's folder, such as `zed_editor_extensions/http-client-extension`.

Zed compiles the extension and its grammars, then lists it on the Extensions page.

## Spring for Dart

The Spring for Dart extension is in the spring_core_dart repository:

```sh
git clone https://github.com/farum-azula/spring_core_dart.git
```

Then in Zed: `zed: install dev extension`, and pick `spring_core_dart/extensions/zed/dart_spring`. Zed builds the Rust part itself, which needs Rust from rustup, and compiles the Properties grammar.

The language server is downloaded the first time you open a Dart file: the native binary of the extension's version, from the GitHub release `v<version>` of spring_core_dart. Zed shows the download in the status bar. On a platform without a prebuilt binary, such as an Intel Mac, build the server from the clone and put it on the `PATH`:

```sh
cd spring_core_dart
dart run tool/install_language_server.dart   # installs dart_spring_lsp into ~/.pub-cache/bin
```

Then turn on semantic highlighting for the colours of SpEL and placeholders; see [Configuration](spring-for-dart.md#configuration).

## Checking the installation

- The Extensions page (`zed: extensions`) lists each extension among the installed ones.
- Open a `.http` file: the language in the bottom right is **HTTP** and a ▶ appears next to each request.
- Open a Dart file in a Flutter project: `task: spawn` lists `Flutter: run on ...`.
- Run `theme selector: toggle`: **Farum Azula Dark** and **Farum Azula Transparent** are in the list.
- Open a Dart file in a Spring project: hovering a constructor parameter's type lists the candidate beans.

## Updating

The extensions run from the clone, so a `git pull` brings the new version:

```sh
cd zed_editor_extensions
git pull
./install.sh
```

Running the script again installs extensions added since the last time and leaves the installed ones alone. For the installed ones, press **Rebuild** next to each extension on the Extensions page so Zed loads the new version. The HTTP Client installs the runner of its new version on the next start.

Spring for Dart is updated the same way: `git pull` in the spring_core_dart clone, then **Rebuild**. The language server of the new version is downloaded on the next start.

## Uninstalling

Press **Uninstall** next to the extension on the Extensions page. It removes Zed's link to the folder; the clone stays as it is. After uninstalling Flutter Tools, install Zed's Dart extension again to keep Dart support.

## Troubleshooting

**`cargo: command not found`.** Install Rust with [rustup](https://rustup.rs) and open a new terminal.

**The build fails on the wasm target.** Run `rustup target add wasm32-wasip2`. With a Rust that is not from rustup, the target cannot be added; install rustup.

**`wasi-sdk is not available for ...`.** The script downloads the wasi-sdk for macOS (Apple Silicon and Intel) and Linux (x64 and arm64). On other systems, set `WASI_SDK_PATH` to an installed wasi-sdk.

**An extension does not appear after the script ran.** Open Zed's log (`zed: open log`) for the reason. A link left behind by a moved or deleted clone is removed by the script on its next run.

**Flutter Tools fails to load because Dart is already defined.** Uninstall Zed's Dart extension (see [Before installing Flutter Tools](#before-installing-flutter-tools)).
