Add support for context server extensions (#20250)
This PR adds support for context servers provided by extensions. To provide a context server from an extension, you need to list the context servers in your `extension.toml`: ```toml [context_servers.my-context-server] ``` And then implement the `context_server_command` method to return the command that will be used to start the context server: ```rs use zed_extension_api::{self as zed, Command, ContextServerId, Result}; struct ExampleContextServerExtension; impl zed::Extension for ExampleContextServerExtension { fn new() -> Self { ExampleContextServerExtension } fn context_server_command(&mut self, _context_server_id: &ContextServerId) -> Result<Command> { Ok(Command { command: "node".to_string(), args: vec!["/path/to/example-context-server/index.js".to_string()], env: Vec::new(), }) } } zed::register_extension!(ExampleContextServerExtension); ``` Release Notes: - N/A
This commit is contained in:
parent
ff4f67993b
commit
f92e6e9a95
17 changed files with 340 additions and 22 deletions
|
@ -135,6 +135,9 @@ world extension {
|
|||
/// Returns the output from running the provided slash command.
|
||||
export run-slash-command: func(command: slash-command, args: list<string>, worktree: option<borrow<worktree>>) -> result<slash-command-output, string>;
|
||||
|
||||
/// Returns the command used to start up a context server.
|
||||
export context-server-command: func(context-server-id: string) -> result<command, string>;
|
||||
|
||||
/// Returns a list of packages as suggestions to be included in the `/docs`
|
||||
/// search results.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue