Skip to content

Commit

Permalink
fix: Use Arc for document index
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-cho committed Oct 13, 2024
1 parent 972a33c commit e042ecd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions fluent-bit-language-server/src/language_server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, str::FromStr};
use std::{collections::HashMap, str::FromStr, sync::Arc};

use flb_schema::section::FlbSectionType;
use ropey::Rope;
Expand Down Expand Up @@ -26,7 +26,7 @@ use crate::{

pub struct Backend {
pub(crate) client: Client,
pub(crate) map: RwLock<HashMap<Url, TextDocument>>,
pub(crate) map: Arc<RwLock<HashMap<Url, TextDocument>>>,
}

impl Backend {
Expand Down
4 changes: 2 additions & 2 deletions fluent-bit-language-server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::HashMap;
use std::{collections::HashMap, sync::Arc};

use tokio::sync::RwLock;
use tower_lsp::{LspService, Server};
Expand All @@ -17,7 +17,7 @@ async fn main() {

let (service, socket) = LspService::build(|client| Backend {
client,
map: RwLock::new(HashMap::new()),
map: Arc::new(RwLock::new(HashMap::new())),
})
.finish();

Expand Down

0 comments on commit e042ecd

Please sign in to comment.