Extension refactor (#20305)

This contains the main changes to the extensions crate from #20049. The
primary goal here is removing dependencies that we can't include on the
remote.


Release Notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
Conrad Irwin 2024-11-06 10:06:25 -07:00 committed by GitHub
parent f22e56ff42
commit 608addf641
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 675 additions and 236 deletions

View file

@ -30,6 +30,7 @@ paths.workspace = true
serde.workspace = true
strum.workspace = true
util.workspace = true
extension_host.workspace = true
[dev-dependencies]
indoc.workspace = true

View file

@ -2,6 +2,7 @@ mod item;
mod to_markdown;
use cargo_metadata::MetadataCommand;
use extension_host::DocsDatabase;
use futures::future::BoxFuture;
pub use item::*;
use parking_lot::RwLock;
@ -208,7 +209,7 @@ impl IndexedDocsProvider for DocsDotRsProvider {
async fn index_rustdoc(
package: PackageName,
database: Arc<IndexedDocsDatabase>,
database: Arc<dyn DocsDatabase>,
fetch_page: impl Fn(&PackageName, Option<&RustdocItem>) -> BoxFuture<'static, Result<Option<String>>>
+ Send
+ Sync,

View file

@ -324,8 +324,10 @@ impl IndexedDocsDatabase {
Ok(any)
})
}
}
pub fn insert(&self, key: String, docs: String) -> Task<Result<()>> {
impl extension_host::DocsDatabase for IndexedDocsDatabase {
fn insert(&self, key: String, docs: String) -> Task<Result<()>> {
let env = self.env.clone();
let entries = self.entries;