on master help sign in
dap: Minor simplifications
commit9963a5614d09bb0677464ad4cecc41d94cf2d7c4 authorBlaž Hrastnik <blaz@mxxn.io> dateSun 7 Nov 2021, 21:37 (5 years ago) parent6586808
1 file changed+9−11
helix-term/src/commands/dap.rs+9−11
helix-term/src/commands/dap.rs+9−11
@@ -123,7 +123,8 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa
123123 thread.name,
124124 thread_states
125125 .get(&thread.id)
126− .unwrap_or(&"unknown".to_owned())
126+ .map(|state| state.as_str())
127+ .unwrap_or("unknown")
127128 )
128129 .into()
129130 },
@@ -173,9 +174,7 @@ pub fn dap_start_impl(
173174 {
174175 Some(c) => c,
175176 None => {
176− editor.set_error(
177− "Can't start debug: no debug adapter available for language".to_string(),
178− );
177+ editor.set_error("No debug adapter available for language".to_string());
179178 return;
180179 }
181180 };
@@ -215,7 +214,7 @@ pub fn dap_start_impl(
215214 let start_config = match start_config {
216215 Some(c) => c,
217216 None => {
218− editor.set_error("Can't start debug: no debug config with given name".to_string());
217+ editor.set_error("No debug config with given name".to_string());
219218 return;
220219 }
221220 };
@@ -288,7 +287,7 @@ pub fn dap_start_impl(
288287pub fn dap_launch(cx: &mut Context) {
289288 if cx.editor.debugger.is_some() {
290289 cx.editor
291− .set_error("Can't start debug: debugger is running".to_string());
290+ .set_error("Debugger is already running".to_string());
292291 return;
293292 }
294293
@@ -300,9 +299,8 @@ pub fn dap_launch(cx: &mut Context) {
300299 {
301300 Some(c) => c,
302301 None => {
303− cx.editor.set_error(
304− "Can't start debug: no debug adapter available for language".to_string(),
305− );
302+ cx.editor
303+ .set_error("No debug adapter available for language".to_string());
306304 return;
307305 }
308306 };
@@ -658,7 +656,7 @@ pub fn dap_edit_condition(cx: &mut Context) {
658656 return;
659657 }
660658
661− let (_, doc) = current!(cx.editor);
659+ let doc = doc!(cx.editor);
662660 let path = match doc.path() {
663661 Some(path) => path,
664662 None => {
@@ -737,7 +735,7 @@ pub fn dap_edit_log(cx: &mut Context) {
737735 return;
738736 }
739737
740− let (_, doc) = current!(cx.editor);
738+ let doc = doc!(cx.editor);
741739 let path = match doc.path() {
742740 Some(path) => path,
743741 None => {