on master help sign in
dap: Minor simplifications
9963a56Blaž Hrastnik
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
123 thread.name,
123 thread.name,
124 thread_states
124 thread_states
125 .get(&thread.id)
125 .get(&thread.id)
126+ .map(|state| state.as_str())
126− .unwrap_or(&"unknown".to_owned())
127+ .unwrap_or("unknown")
127 )
128 )
128 .into()
129 .into()
129 },
130 },
@@ -173,9 +174,7 @@ pub fn dap_start_impl(
173 {
174 {
174 Some(c) => c,
175 Some(c) => c,
175 None => {
176 None => {
176− editor.set_error(
177− "Can't start debug: no debug adapter available for language".to_string(),
177+ editor.set_error("No debug adapter available for language".to_string());
178− );
179 return;
178 return;
180 }
179 }
181 };
180 };
@@ -215,7 +214,7 @@ pub fn dap_start_impl(
215 let start_config = match start_config {
214 let start_config = match start_config {
216 Some(c) => c,
215 Some(c) => c,
217 None => {
216 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());
219 return;
218 return;
220 }
219 }
221 };
220 };
@@ -288,7 +287,7 @@ pub fn dap_start_impl(
288pub fn dap_launch(cx: &mut Context) {
287pub fn dap_launch(cx: &mut Context) {
289 if cx.editor.debugger.is_some() {
288 if cx.editor.debugger.is_some() {
290 cx.editor
289 cx.editor
291− .set_error("Can't start debug: debugger is running".to_string());
290+ .set_error("Debugger is already running".to_string());
292 return;
291 return;
293 }
292 }
294
293
@@ -300,9 +299,8 @@ pub fn dap_launch(cx: &mut Context) {
300 {
299 {
301 Some(c) => c,
300 Some(c) => c,
302 None => {
301 None => {
303− cx.editor.set_error(
302+ cx.editor
304− "Can't start debug: no debug adapter available for language".to_string(),
303+ .set_error("No debug adapter available for language".to_string());
305− );
306 return;
304 return;
307 }
305 }
308 };
306 };
@@ -658,7 +656,7 @@ pub fn dap_edit_condition(cx: &mut Context) {
658 return;
656 return;
659 }
657 }
660
658
661− let (_, doc) = current!(cx.editor);
659+ let doc = doc!(cx.editor);
662 let path = match doc.path() {
660 let path = match doc.path() {
663 Some(path) => path,
661 Some(path) => path,
664 None => {
662 None => {
@@ -737,7 +735,7 @@ pub fn dap_edit_log(cx: &mut Context) {
737 return;
735 return;
738 }
736 }
739
737
740− let (_, doc) = current!(cx.editor);
738+ let doc = doc!(cx.editor);
741 let path = match doc.path() {
739 let path = match doc.path() {
742 Some(path) => path,
740 Some(path) => path,
743 None => {
741 None => {