Allow extensions to suggest packages for /docs
completions (#16185)
This PR gives extensions the ability to suggest packages to show up in `/docs` completions by default. Release Notes: - N/A
This commit is contained in:
parent
c6a1d9aa33
commit
aa12ae0e3c
5 changed files with 64 additions and 1 deletions
|
@ -129,6 +129,16 @@ pub trait Extension: Send + Sync {
|
|||
Err("`run_slash_command` not implemented".to_string())
|
||||
}
|
||||
|
||||
/// Returns a list of package names as suggestions to be included in the
|
||||
/// search results of the `/docs` slash command.
|
||||
///
|
||||
/// This can be used to provide completions for known packages (e.g., from the
|
||||
/// local project or a registry) before a package has been indexed.
|
||||
fn suggest_docs_packages(&self, _provider: String) -> Result<Vec<String>, String> {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
/// Indexes the docs for the specified package.
|
||||
fn index_docs(
|
||||
&self,
|
||||
_provider: String,
|
||||
|
@ -260,6 +270,10 @@ impl wit::Guest for Component {
|
|||
extension().run_slash_command(command, argument, worktree)
|
||||
}
|
||||
|
||||
fn suggest_docs_packages(provider: String) -> Result<Vec<String>, String> {
|
||||
extension().suggest_docs_packages(provider)
|
||||
}
|
||||
|
||||
fn index_docs(
|
||||
provider: String,
|
||||
package: String,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue