Skip to content

Commit

Permalink
feat(integrations): clone and debug for integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
timonv committed Jun 16, 2024
1 parent 678106c commit bdaed53
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
10 changes: 10 additions & 0 deletions swiftide/src/integrations/qdrant/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,13 @@ impl Qdrant {
Ok(())
}
}

impl std::fmt::Debug for Qdrant {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Qdrant")
.field("collection_name", &self.collection_name)
.field("vector_size", &self.vector_size)
.field("batch_size", &self.batch_size)
.finish()
}
}
10 changes: 10 additions & 0 deletions swiftide/src/integrations/redis/node_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ impl Debug for RedisNodeCache {
}
}

impl Clone for RedisNodeCache {
fn clone(&self) -> Self {
Self {
client: self.client.clone(),
connection_manager: RwLock::new(None),
key_prefix: self.key_prefix.clone(),
}
}
}

#[async_trait]
impl NodeCache for RedisNodeCache {
/// Checks if a node is present in the cache.
Expand Down
2 changes: 1 addition & 1 deletion swiftide/src/integrations/treesitter/splitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use super::supported_languages::SupportedLanguages;
// TODO: Instead of counting bytes, count tokens with titktoken
const DEFAULT_MAX_BYTES: usize = 1500;

#[derive(Debug, Builder)]
#[derive(Debug, Builder, Clone)]
/// Splits code files into meaningful chunks
///
/// Supports splitting code files into chunks based on a maximum size or a range of bytes.
Expand Down

0 comments on commit bdaed53

Please sign in to comment.