aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-08-29 10:16:57 +0000
committerDmitry Sharshakov2021-08-29 10:16:57 +0000
commit98fda6b8f004549cdbccb4b5567b0388b90fdb37 (patch)
tree2f2a6e86fd01308c60e2565a27a5af63e3a6640d
parent9d2f2a9e321cdc83999ebe0a257709d9ce0b33ca (diff)
better completion
-rw-r--r--helix-term/src/ui/editor.rs14
-rw-r--r--languages.toml8
2 files changed, 10 insertions, 12 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 5669a6e7..99fffbbd 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -26,7 +26,6 @@ use helix_view::{
keyboard::{KeyCode, KeyModifiers},
Document, Editor, Theme, View,
};
-use log::warn;
use std::borrow::Cow;
use crossterm::event::{Event, MouseButton, MouseEvent, MouseEventKind};
@@ -715,18 +714,17 @@ impl EditorView {
config_name: String,
mut params: Vec<String>,
) -> Prompt {
+ let i = params.len();
+ let field_type = completions.get(i).map(|x| x.as_str());
+
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("directory") => super::completers::directory,
- Some(complete) => {
- warn!("Unknown debug config autocompleter: {}", complete);
- noop
- }
- None => noop,
+ _ => noop,
};
Prompt::new(
- "arg: ".to_owned(),
+ format!("{}: ", field_type.unwrap_or("arg")),
None,
completer,
move |cx: &mut crate::compositor::Context, input: &str, event: PromptEvent| {
diff --git a/languages.toml b/languages.toml
index 6dbbb8c7..1256ffe1 100644
--- a/languages.toml
+++ b/languages.toml
@@ -36,7 +36,7 @@ args = { console = "internalConsole", program = "{0}" }
[[language.debugger.templates]]
name = "attach"
request = "attach"
-completion = [ "none" ]
+completion = [ "pid" ]
args = { console = "internalConsole", pid = "{0}" }
[[language]]
@@ -105,7 +105,7 @@ args = { console = "internalConsole", program = "{0}" }
[[language.debugger.templates]]
name = "attach"
request = "attach"
-completion = [ "none" ]
+completion = [ "pid" ]
args = { console = "internalConsole", pid = "{0}" }
[[language]]
@@ -135,7 +135,7 @@ args = { console = "internalConsole", program = "{0}" }
[[language.debugger.templates]]
name = "attach"
request = "attach"
-completion = [ "none" ]
+completion = [ "pid" ]
args = { console = "internalConsole", pid = "{0}" }
[[language]]
@@ -179,7 +179,7 @@ args = { mode = "test", program = "{0}", output = "{1}" }
[[language.debugger.templates]]
name = "attach"
request = "attach"
-completion = [ "none" ]
+completion = [ "pid" ]
args = { mode = "local", processId = "{0}" }
[[language]]