refactor: consolidate nvim crates, extract server library, and update workspace dependencies
This commit is contained in:
1 parent
a083719cf1
commit
533adfd41b
53 files changed
+5967
-1230
No files matched your search
@@ -83,6 +83,7 @@ pub async fn start_background_indexer(state: Arc<MemoryState>) {
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_secs(),
|
||||
tags: vec![],
|
||||
embedding,
|
||||
};
|
||||
|
||||
@@ -218,4 +219,29 @@ mod tests {
|
||||
let state = Arc::new(MemoryState::new(temp_dir.path().to_str().unwrap()));
|
||||
start_background_indexer(state).await;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_chunks_rust_impl_block() {
|
||||
let code = "impl MyStruct { fn my_method(&self) {} }";
|
||||
let mut parser = Parser::new();
|
||||
parser
|
||||
.set_language(&tree_sitter_rust::LANGUAGE.into())
|
||||
.unwrap();
|
||||
let tree = parser.parse(code, None).unwrap();
|
||||
|
||||
let mut chunks = Vec::new();
|
||||
extract_chunks(tree.root_node(), code, &mut chunks, "rs");
|
||||
|
||||
assert_eq!(chunks.len(), 1);
|
||||
assert_eq!(chunks[0].0, "MyStruct::my_method");
|
||||
assert!(chunks[0].1.contains("// Parent Scope: MyStruct"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_start_background_indexer_empty_dir() {
|
||||
let temp_dir = tempfile::tempdir().unwrap();
|
||||
let state = Arc::new(MemoryState::new(temp_dir.path().to_str().unwrap()));
|
||||
start_background_indexer(state).await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user