@@ -1,7 +1,6 @@
1use crate::{
1use crate::{
3− compositor::{Component, Compositor, Context, EventResult},
3+ compositor::{Component, Context, EventResult},
6 keymap::{KeymapResult, KeymapResultKind, Keymaps},
5 keymap::{KeymapResult, KeymapResultKind, Keymaps},
7 ui::{Completion, ProgressSpinners},
6 ui::{Completion, ProgressSpinners},
@@ -11,7 +10,7 @@ use helix_core::{
11 coords_at_pos,
10 coords_at_pos,
12 graphemes::{ensure_grapheme_boundary_next, next_grapheme_boundary, prev_grapheme_boundary},
11 graphemes::{ensure_grapheme_boundary_next, next_grapheme_boundary, prev_grapheme_boundary},
13 movement::Direction,
12 movement::Direction,
14− syntax::{self, DebugConfigCompletion, HighlightEvent},
13+ syntax::{self, HighlightEvent},
15 unicode::segmentation::UnicodeSegmentation,
14 unicode::segmentation::UnicodeSegmentation,
16 unicode::width::UnicodeWidthStr,
15 unicode::width::UnicodeWidthStr,
17 LineEnding, Position, Range, Selection,
16 LineEnding, Position, Range, Selection,
@@ -31,8 +30,6 @@ use std::{borrow::Cow, collections::HashMap, path::PathBuf};
31use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind};
30use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind};
32use tui::buffer::Buffer as Surface;
31use tui::buffer::Buffer as Surface;
34−use super::{Prompt, PromptEvent};
36pub struct EditorView {
33pub struct EditorView {
37 keymaps: Keymaps,
34 keymaps: Keymaps,
38 on_next_key: Option<Box<dyn FnOnce(&mut commands::Context, KeyEvent)>>,
35 on_next_key: Option<Box<dyn FnOnce(&mut commands::Context, KeyEvent)>>,
@@ -815,79 +812,6 @@ impl EditorView {
818− fn debug_parameter_prompt(
819− completions: Vec<DebugConfigCompletion>,
820− config_name: String,
821− mut params: Vec<String>,
823− let i = params.len();
824− let completion = completions.get(i).unwrap();
825− let field_type = if let DebugConfigCompletion::Advanced(cfg) = completion {
826− cfg.completion.clone().unwrap_or_else(|| "".to_owned())
830− let name = match completion {
831− DebugConfigCompletion::Advanced(cfg) => {
832− cfg.name.clone().unwrap_or_else(|| field_type.to_owned())
834− DebugConfigCompletion::Named(name) => name.clone(),
836− let default_val = match completion {
837− DebugConfigCompletion::Advanced(cfg) => {
838− cfg.default.clone().unwrap_or_else(|| "".to_owned())
843− let noop = |_input: &str| Vec::new();
844− let completer = match &field_type[..] {
845− "filename" => super::completers::filename,
846− "directory" => super::completers::directory,
850− format!("{}: ", name).into(),
853− move |cx: &mut crate::compositor::Context, input: &str, event: PromptEvent| {
854− if event != PromptEvent::Validate {
858− let mut value = input.to_owned();
859− if value.is_empty() {
860− value = default_val.clone();
864− if params.len() < completions.len() {
865− let completions = completions.clone();
866− let config_name = config_name.clone();
867− let params = params.clone();
868− let callback = Box::pin(async move {
869− let call: Callback =
870− Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
872− Self::debug_parameter_prompt(completions, config_name, params);
873− compositor.push(Box::new(prompt));
877− cx.jobs.callback(callback);
879− commands::dap_start_impl(
883− Some(params.iter().map(|x| x.as_str()).collect()),
891 /// Handle events by looking them up in `self.keymaps`. Returns None
815 /// Handle events by looking them up in `self.keymaps`. Returns None
892 /// if event was handled (a command was executed or a subkeymap was
816 /// if event was handled (a command was executed or a subkeymap was
893 /// activated). Only KeymapResultKind::{NotFound, Cancelled} is returned
817 /// activated). Only KeymapResultKind::{NotFound, Cancelled} is returned
@@ -898,14 +822,6 @@ impl EditorView {
898 cxt: &mut commands::Context,
822 cxt: &mut commands::Context,
899 event: KeyEvent,
823 event: KeyEvent,
900 ) -> Option<KeymapResult> {
824 ) -> Option<KeymapResult> {
901− if !cxt.editor.debug_config_completions.is_empty() {
902− let completions = std::mem::take(&mut cxt.editor.debug_config_completions);
904− let prompt = Self::debug_parameter_prompt(completions, "test".to_string(), Vec::new());
905− cxt.push_layer(Box::new(prompt));
909 let key_result = self.keymaps.get_mut(&mode).unwrap().get(event);
825 let key_result = self.keymaps.get_mut(&mode).unwrap().get(event);
910 self.autoinfo = key_result.sticky.map(|node| node.infobox());
826 self.autoinfo = key_result.sticky.map(|node| node.infobox());