mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 17:36:19 +04:00
better completion
This commit is contained in:
parent
9d2f2a9e32
commit
98fda6b8f0
@ -26,7 +26,6 @@
|
|||||||
keyboard::{KeyCode, KeyModifiers},
|
keyboard::{KeyCode, KeyModifiers},
|
||||||
Document, Editor, Theme, View,
|
Document, Editor, Theme, View,
|
||||||
};
|
};
|
||||||
use log::warn;
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind};
|
use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind};
|
||||||
@ -715,18 +714,17 @@ fn debug_parameter_prompt(
|
|||||||
config_name: String,
|
config_name: String,
|
||||||
mut params: Vec<String>,
|
mut params: Vec<String>,
|
||||||
) -> Prompt {
|
) -> Prompt {
|
||||||
|
let i = params.len();
|
||||||
|
let field_type = completions.get(i).map(|x| x.as_str());
|
||||||
|
|
||||||
let noop = |_input: &str| Vec::new();
|
let noop = |_input: &str| Vec::new();
|
||||||
let completer = match completions.get(0).map(|x| x.as_str()) {
|
let completer = match field_type {
|
||||||
Some("filename") => super::completers::filename,
|
Some("filename") => super::completers::filename,
|
||||||
Some("directory") => super::completers::directory,
|
Some("directory") => super::completers::directory,
|
||||||
Some(complete) => {
|
_ => noop,
|
||||||
warn!("Unknown debug config autocompleter: {}", complete);
|
|
||||||
noop
|
|
||||||
}
|
|
||||||
None => noop,
|
|
||||||
};
|
};
|
||||||
Prompt::new(
|
Prompt::new(
|
||||||
"arg: ".to_owned(),
|
format!("{}: ", field_type.unwrap_or("arg")),
|
||||||
None,
|
None,
|
||||||
completer,
|
completer,
|
||||||
move |cx: &mut crate::compositor::Context, input: &str, event: PromptEvent| {
|
move |cx: &mut crate::compositor::Context, input: &str, event: PromptEvent| {
|
||||||
|
@ -36,7 +36,7 @@ args = { console = "internalConsole", program = "{0}" }
|
|||||||
[[language.debugger.templates]]
|
[[language.debugger.templates]]
|
||||||
name = "attach"
|
name = "attach"
|
||||||
request = "attach"
|
request = "attach"
|
||||||
completion = [ "none" ]
|
completion = [ "pid" ]
|
||||||
args = { console = "internalConsole", pid = "{0}" }
|
args = { console = "internalConsole", pid = "{0}" }
|
||||||
|
|
||||||
[[language]]
|
[[language]]
|
||||||
@ -105,7 +105,7 @@ args = { console = "internalConsole", program = "{0}" }
|
|||||||
[[language.debugger.templates]]
|
[[language.debugger.templates]]
|
||||||
name = "attach"
|
name = "attach"
|
||||||
request = "attach"
|
request = "attach"
|
||||||
completion = [ "none" ]
|
completion = [ "pid" ]
|
||||||
args = { console = "internalConsole", pid = "{0}" }
|
args = { console = "internalConsole", pid = "{0}" }
|
||||||
|
|
||||||
[[language]]
|
[[language]]
|
||||||
@ -135,7 +135,7 @@ args = { console = "internalConsole", program = "{0}" }
|
|||||||
[[language.debugger.templates]]
|
[[language.debugger.templates]]
|
||||||
name = "attach"
|
name = "attach"
|
||||||
request = "attach"
|
request = "attach"
|
||||||
completion = [ "none" ]
|
completion = [ "pid" ]
|
||||||
args = { console = "internalConsole", pid = "{0}" }
|
args = { console = "internalConsole", pid = "{0}" }
|
||||||
|
|
||||||
[[language]]
|
[[language]]
|
||||||
@ -179,7 +179,7 @@ args = { mode = "test", program = "{0}", output = "{1}" }
|
|||||||
[[language.debugger.templates]]
|
[[language.debugger.templates]]
|
||||||
name = "attach"
|
name = "attach"
|
||||||
request = "attach"
|
request = "attach"
|
||||||
completion = [ "none" ]
|
completion = [ "pid" ]
|
||||||
args = { mode = "local", processId = "{0}" }
|
args = { mode = "local", processId = "{0}" }
|
||||||
|
|
||||||
[[language]]
|
[[language]]
|
||||||
|
Loading…
Reference in New Issue
Block a user