diff options
author | Blaž Hrastnik | 2021-10-17 06:14:16 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-11-06 15:28:57 +0000 |
commit | 14a3502cf132b93b47b12cf14c685f0b694893c6 (patch) | |
tree | 69a2ad2bbf6f6cf038885d2945a811587cd29b9c /helix-term/src/commands/dap.rs | |
parent | f2b709a3c3a9cc036bfea46734efd7e4100eb34b (diff) |
dap: Move template selection into a picker
It's time to move all these components out of ui/editor.rs
Diffstat (limited to 'helix-term/src/commands/dap.rs')
-rw-r--r-- | helix-term/src/commands/dap.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index 566730e1..23bb3bab 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -3,7 +3,7 @@ use crate::{ commands, compositor::Compositor, job::Callback, - ui::{FilePicker, Prompt, PromptEvent}, + ui::{FilePicker, Picker, Prompt, PromptEvent}, }; use helix_core::{ syntax::{DebugArgumentValue, DebugConfigCompletion}, @@ -319,14 +319,16 @@ pub fn dap_launch(cx: &mut Context) { } }; - cx.editor.debug_config_picker = Some(config.templates.iter().map(|t| t.name.clone()).collect()); - cx.editor.debug_config_completions = Some( - config - .templates - .iter() - .map(|t| t.completion.clone()) - .collect(), - ); + cx.push_layer(Box::new(Picker::new( + true, + config.templates.clone(), + |template| template.name.as_str().into(), + |editor, template, _action| { + let completions = template.completion.clone(); + editor.debug_config_completions = completions; + // TODO: need some way to manipulate the compositor to push a new prompt here + }, + ))); // TODO: wrap in popup with fixed size } pub fn dap_toggle_breakpoint(cx: &mut Context) { |