mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
82f5f36422
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
17 lines
258 B
TOML
17 lines
258 B
TOML
[package]
|
|
name = "zed_gleam"
|
|
version = "0.1.3"
|
|
edition = "2021"
|
|
publish = false
|
|
license = "Apache-2.0"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
path = "src/gleam.rs"
|
|
crate-type = ["cdylib"]
|
|
|
|
[dependencies]
|
|
zed_extension_api = { path = "../../crates/extension_api" }
|