Skip to content

Commit

Permalink
wrap in an arc
Browse files Browse the repository at this point in the history
  • Loading branch information
Feel-ix-343 committed Mar 12, 2024
1 parent 28e0e12 commit cef8e9d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -32,11 +33,12 @@ mod tokens;
mod ui;
mod vault;


#[derive(Debug)]
struct Backend {
client: Client,
vault: RwLock<Option<Vault>>,
opened_files: RwLock<HashSet<PathBuf>>,
vault: Arc<RwLock<Option<Vault>>>,
opened_files: Arc<RwLock<HashSet<PathBuf>>>,
}

struct TextDocumentItem {
Expand Down Expand Up @@ -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;
}

0 comments on commit cef8e9d

Please sign in to comment.