Skip to content

Commit

Permalink
Try to understand why content syncing is not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof-Cieslak committed Jan 7, 2025
1 parent 9652568 commit cd207c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,18 @@ fn sync_to_disk(doc: &FullTextDocument, uri: &Uri) -> io::Result<()> {
if doc_hash != file_hash {
file.write_all(content.as_bytes())?;
}
else {
println!(" No changes to sync");
}

Ok(())
}

async fn sync(documents: &Arc<DashMap<Uri, FullTextDocument>>) {
for doc in documents.iter() {
println!("Syncing: {}", doc.key().as_str());
let d = doc.value();
let len = d.content_len();
println!("Syncing: {}, length: {}", doc.key().as_str(), len);
let result = sync_to_disk(doc.value(), doc.key());
if let Err(e) = result {
eprintln!(" Error syncing file: {}", e);
Expand Down

0 comments on commit cd207c7

Please sign in to comment.