Allow extensions to define providers for indexing docs (#13755)

This PR provides extensions with the ability to define providers for
indexing docs.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-07-02 19:49:20 -04:00 committed by GitHub
parent b7cb2381f2
commit 5c7a8f779a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 407 additions and 213 deletions

View file

@ -27,7 +27,7 @@ pub use wit::{
zed::extension::platform::{current_platform, Architecture, Os},
zed::extension::slash_command::{SlashCommand, SlashCommandOutput, SlashCommandOutputSection},
CodeLabel, CodeLabelSpan, CodeLabelSpanLiteral, Command, DownloadedFileType, EnvVars,
LanguageServerInstallationStatus, Range, Worktree,
KeyValueStore, LanguageServerInstallationStatus, Range, Worktree,
};
// Undocumented WIT re-exports.
@ -127,6 +127,15 @@ pub trait Extension: Send + Sync {
) -> Result<SlashCommandOutput, String> {
Err("`run_slash_command` not implemented".to_string())
}
fn index_docs(
&self,
_provider: String,
_package: String,
_database: &KeyValueStore,
) -> Result<(), String> {
Err("`index_docs` not implemented".to_string())
}
}
/// Registers the provided type as a Zed extension.
@ -249,6 +258,14 @@ impl wit::Guest for Component {
) -> Result<SlashCommandOutput, String> {
extension().run_slash_command(command, argument, worktree)
}
fn index_docs(
provider: String,
package: String,
database: &KeyValueStore,
) -> Result<(), String> {
extension().index_docs(provider, package, database)
}
}
/// The ID of a language server.