aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-11-07 13:03:55 +0000
committerBlaž Hrastnik2021-11-07 13:03:55 +0000
commit09f5796537ffe0ae6b1278fc4d783a7c2eb4b8c1 (patch)
tree99672e1e837be0345ec4e1fc9900b03a320b2109 /helix-term
parentc39d9f44a0afb041f73d87c69787fea5f6747ffd (diff)
dap: Simplify get_breakpoint_at_current_line
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 0b617dc8..12dd2460 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -2268,13 +2268,13 @@ mod cmd {
let pos = doc.selection(view.id).primary().cursor(text);
let line = text.char_to_line(pos) + 1; // 1-indexing in DAP, 0-indexing in Helix
let path = match doc.path() {
- Some(path) => path.to_path_buf(),
+ Some(path) => path,
None => return None,
};
- let vec = vec![];
- let breakpoints = editor.breakpoints.get(&path).unwrap_or(&vec);
- let i = breakpoints.iter().position(|b| b.line == line);
- i.map(|i| (i, breakpoints.get(i).unwrap().clone()))
+ editor.breakpoints.get(path).and_then(|breakpoints| {
+ let i = breakpoints.iter().position(|b| b.line == line);
+ i.map(|i| (i, breakpoints[i].clone()))
+ })
}
fn debug_start(