From cef8e9ddd3f8daa40e5430af1357951298ba45df Mon Sep 17 00:00:00 2001 From: Felix Zeller Date: Tue, 12 Mar 2024 16:15:38 -0400 Subject: [PATCH] wrap in an arc --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index eaeb2922..9a245047 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ use std::collections::HashSet; use std::ops::{Deref, DerefMut}; use std::path::{Path, PathBuf}; +use std::sync::Arc; use completion::get_completions; use diagnostics::diagnostics; @@ -32,11 +33,12 @@ mod tokens; mod ui; mod vault; + #[derive(Debug)] struct Backend { client: Client, - vault: RwLock>, - opened_files: RwLock>, + vault: Arc>>, + opened_files: Arc>>, } struct TextDocumentItem { @@ -522,8 +524,8 @@ async fn main() { let (service, socket) = LspService::new(|client| Backend { client, - vault: None.into(), - opened_files: HashSet::new().into(), + vault: Arc::new(None.into()), + opened_files: Arc::new(HashSet::new().into()), }); Server::new(stdin, stdout, socket).serve(service).await; }