aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-11-07 09:57:44 +0000
committerBlaž Hrastnik2021-11-07 09:58:47 +0000
commit9dd17c46a25081adb15fcc8a1609a5b01f761caf (patch)
treea896016917da30eb475086c3edb35fbcc95a3199 /helix-term/src
parent757babb1b4390a7446a2a4f3efb1d9302961a1f6 (diff)
dap: Avoid cloning old_breakpoints if we are immediately replacing them
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands/dap.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs
index 57459779..89018bc1 100644
--- a/helix-term/src/commands/dap.rs
+++ b/helix-term/src/commands/dap.rs
@@ -175,7 +175,7 @@ pub fn dap_start_impl(
}
};
- let language_config = editor.syn_loader.language_config_for_file_name(&path);
+ let language_config = editor.syn_loader.language_config_for_file_name(path);
let config = match language_config
.as_deref()
.and_then(|config| config.debugger.as_ref())
@@ -216,6 +216,7 @@ pub fn dap_start_impl(
debugger.quirks = config.quirks.clone();
+ // TODO: avoid refetching all of this... pass a config in
let start_config = match name {
Some(name) => config.templates.iter().find(|t| t.name == name),
None => config.templates.get(0),
@@ -452,8 +453,8 @@ pub fn dap_toggle_breakpoint(cx: &mut Context) {
let request = debugger.set_breakpoints(path.clone(), breakpoints);
match block_on(request) {
Ok(Some(breakpoints)) => {
- let old_breakpoints = debugger.breakpoints.clone();
- debugger.breakpoints = breakpoints.clone();
+ // TODO: avoid this clone here
+ let old_breakpoints = std::mem::replace(&mut debugger.breakpoints, breakpoints.clone());
for bp in breakpoints {
if !old_breakpoints.iter().any(|b| b.message == bp.message) {
if let Some(msg) = &bp.message {