Skip to content

Commit

Permalink
fix: a dashmap deadlock (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
wlh320 committed Nov 26, 2023
1 parent 0b8ad0c commit 747bc9c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use dashmap::DashMap;
use regex::Regex;
use ropey::Rope;
use serde_json::Value;
use std::borrow::Cow;
use tokio::sync::RwLock;
use tower_lsp::jsonrpc::Result;
use tower_lsp::lsp_types::*;
use tower_lsp::{Client, LanguageServer};
use std::borrow::Cow;

use crate::config::{apply_setting, Config, Settings};
use crate::consts::{trigger_ptn, NT_RE};
Expand Down Expand Up @@ -330,17 +330,17 @@ impl LanguageServer for Backend {
}

async fn did_change(&self, params: DidChangeTextDocumentParams) {
let mut rope = self
.documents
.get_mut(params.text_document.uri.as_str())
.unwrap();
for change in params.content_changes {
let TextDocumentContentChangeEvent {
range,
range_length: _,
text,
} = change;
if let Some(Range { start, end }) = range {
let mut rope = self
.documents
.get_mut(params.text_document.uri.as_str())
.unwrap();
let s = utils::position_to_offset(&rope, start);
let e = utils::position_to_offset(&rope, end);
if let (Some(s), Some(e)) = (s, e) {
Expand Down

0 comments on commit 747bc9c

Please sign in to comment.