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
20 lines
529 B
TOML
20 lines
529 B
TOML
id = "gleam"
|
|
name = "Gleam"
|
|
description = "Gleam support."
|
|
version = "0.1.3"
|
|
schema_version = 1
|
|
authors = ["Marshall Bowers <elliott.codes@gmail.com>"]
|
|
repository = "https://github.com/zed-industries/zed"
|
|
|
|
[language_servers.gleam]
|
|
name = "Gleam LSP"
|
|
language = "Gleam"
|
|
|
|
[grammars.gleam]
|
|
repository = "https://github.com/gleam-lang/tree-sitter-gleam"
|
|
commit = "8432ffe32ccd360534837256747beb5b1c82fca1"
|
|
|
|
[slash_commands.gleam-project]
|
|
description = "Returns information about the current Gleam project."
|
|
requires_argument = false
|