diff options
author | Dmitry Sharshakov | 2021-08-21 14:21:35 +0000 |
---|---|---|
committer | Dmitry Sharshakov | 2021-08-21 14:21:35 +0000 |
commit | a938f5a87a2b67dd8667337cd569cc6627d0f666 (patch) | |
tree | ecce252fd9c451f23c583bb734dc9912d39c13e7 /helix-term/src/ui | |
parent | 3fc501c99f8f8c539dc4714a200bac45a7169138 (diff) |
refactor: handle DAP events in editor main loop
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/editor.rs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 7f441a7d..f8035ae4 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -25,8 +25,7 @@ use helix_view::{ keyboard::{KeyCode, KeyModifiers}, Document, Editor, Theme, View, }; -use std::{borrow::Cow, sync::Arc}; -use tokio::sync::Mutex; +use std::borrow::Cow; use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind}; use tui::buffer::Buffer as Surface; @@ -73,7 +72,7 @@ impl EditorView { is_focused: bool, loader: &syntax::Loader, config: &helix_view::editor::Config, - debugger: Option<Arc<Mutex<helix_dap::Client>>>, + debugger: &Option<helix_dap::Client>, ) { let inner = view.inner_area(); let area = view.area; @@ -414,9 +413,8 @@ impl EditorView { theme: &Theme, is_focused: bool, config: &helix_view::editor::Config, - debugger: Option<Arc<Mutex<helix_dap::Client>>>, + debugger: &Option<helix_dap::Client>, ) { - use helix_lsp::block_on; let text = doc.text().slice(..); let last_line = view.last_line(doc); @@ -449,9 +447,8 @@ impl EditorView { let mut stack_pointer: Option<StackFrame> = None; if let Some(debugger) = debugger { if let Some(path) = doc.path() { - let dbg = block_on(debugger.lock()); - breakpoints = dbg.breakpoints.get(path).cloned(); - stack_pointer = dbg.stack_pointer.clone() + breakpoints = debugger.breakpoints.get(path).cloned(); + stack_pointer = debugger.stack_pointer.clone() } } @@ -1047,10 +1044,6 @@ impl Component for EditorView { for (view, is_focused) in cx.editor.tree.views() { let doc = cx.editor.document(view.doc).unwrap(); let loader = &cx.editor.syn_loader; - let mut dbg: Option<Arc<Mutex<helix_dap::Client>>> = None; - if let Some(debugger) = &cx.editor.debugger { - dbg = Some(Arc::clone(debugger)); - } self.render_view( doc, view, @@ -1060,7 +1053,7 @@ impl Component for EditorView { is_focused, loader, &cx.editor.config, - dbg, + &cx.editor.debugger, ); } |