README.md

 1# Slash Commands Example Extension
 2
 3This is an example extension showcasing how to write slash commands.
 4
 5See: [Extensions: Slash Commands](https://zed.dev/docs/extensions/slash-commands) in the Zed Docs.
 6
 7## Pre-requisites
 8
 9[Install Rust Toolchain](https://www.rust-lang.org/tools/install):
10
11```sh
12curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
13```
14
15## Setup
16
17```sh
18git clone https://github.com/zed-industries/zed.git
19cp -RL zed/extensions/slash-commands-example .
20
21cd slash-commands-example/
22
23sed -i '' '/\[lints]/,/^$/s/^workspace/#&/' Cargo.toml
24curl -O https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-APACHE
25echo "# Zed Slash Commands Example Extension" > README.md
26echo "Cargo.lock" > .gitignore
27echo "target/" >> .gitignore
28echo "*.wasm" >> .gitignore
29
30git init
31git add .
32git commit -m "Initial commit"
33
34cd ..
35mv slash-commands-example MY-SUPER-COOL-ZED-EXTENSION
36zed $_
37```
38
39## Installation
40
411. Open the command palette (`cmd-shift-p` or `ctrl-shift-p`).
422. Launch `zed: install dev extension`
433. Select the `slash-commands-example` folder created above
44
45## Test
46
47Open the assistant and type `/echo` and `/pick-one` at the beginning of a line.
48
49## Customization
50
51Open the `extensions.toml` file and set the `id`, `name`, `description`, `authors` and `repository` fields.
52
53Rename `slash-commands-example.rs` you'll also have to update `Cargo.toml
54
55## Rebuild
56
57Rebuild to see these changes reflected:
58
591. Open Zed Extensions (`cmd-shift-x` or `ctrl-shift-x`).
602. Click `Rebuild` next to your Dev Extension (formerly "Slash Command Example")
61
62## Troubleshooting / Logs
63
64- MacOS: `tail -f ~/Library/Logs/Zed/Zed.log`
65- Linux: `tail -f ~/.local/share/zed/logs/Zed.log`
66
67## Documentation
68
69- [zed.dev docs: Extensions: Developing Extensions](https://zed.dev/docs/extensions/developing-extensions)
70- [zed.dev docs: Extensions: Slash Commands](https://zed.dev/docs/extensions/slash-commands)