zed/extensions/slash-commands-example
Peter Tripp 16942610cb
examples: Update slash-commands-example readme (#17204)
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-09-01 14:02:14 -04:00
..
src Add example extension to showcase slash commands (#16300) 2024-08-15 12:26:13 -04:00
Cargo.toml Add example extension to showcase slash commands (#16300) 2024-08-15 12:26:13 -04:00
extension.toml Remove tooltip_text from extension manifests (#16312) 2024-08-15 15:54:53 -04:00
LICENSE-APACHE Add example extension to showcase slash commands (#16300) 2024-08-15 12:26:13 -04:00
README.md examples: Update slash-commands-example readme (#17204) 2024-09-01 14:02:14 -04:00

Slash Commands Example Extension

This is an example extension showcasing how to write slash commands.

See: Extensions: Slash Commands in the Zed Docs.

Pre-requisites

Install Rust Toolchain:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Setup

git clone https://github.com/zed-industries/zed.git
cp -RL zed/extensions/slash-commands-example .

cd slash-commands-example/

sed -i '' '/\[lints]/,/^$/s/^workspace/#&/' Cargo.toml
curl -O https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-APACHE
echo "# Zed Slash Commands Example Extension" > README.md
echo "Cargo.lock" > .gitignore
echo "target/" >> .gitignore
echo "*.wasm" >> .gitignore

git init
git add .
git commit -m "Initial commit"

cd ..
mv slash-commands-example MY-SUPER-COOL-ZED-EXTENSION
zed $_

Installation

  1. Open the command palette (cmd-shift-p or ctrl-shift-p).
  2. Launch zed: install dev extension
  3. Select the slash-commands-example folder created above

Test

Open the assistant and type /echo and /pick-one at the beginning of a line.

Customization

Open the extensions.toml file and set the id, name, description, authors and repository fields.

Rename slash-commands-example.rs you'll also have to update `Cargo.toml

Rebuild

Rebuild to see these changes reflected:

  1. Open Zed Extensions (cmd-shift-x or ctrl-shift-x).
  2. Click Rebuild next to your Dev Extension (formerly "Slash Command Example")

Troubleshooting / Logs

  • MacOS: tail -f ~/Library/Logs/Zed/Zed.log
  • Linux: tail -f ~/.local/share/zed/logs/Zed.log

Documentation