diff --git a/Cargo.lock b/Cargo.lock index 68491382d..7e23f9b62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3277,7 +3277,7 @@ dependencies = [ [[package]] name = "reedline" version = "0.2.0" -source = "git+https://github.com/nushell/reedline?branch=main#375c779e360cd368bb75e583986eec856853bbf2" +source = "git+https://github.com/nushell/reedline?branch=main#e4cec995262fc85fab3e08cad267e28a3da60460" dependencies = [ "chrono", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index 2c907d1e0..21b3be0b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ members = [ [dependencies] reedline = { git = "https://github.com/nushell/reedline", branch = "main" } + crossterm = "0.22.*" nu-cli = { path="./crates/nu-cli" } nu-command = { path="./crates/nu-command" } diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index 99e55ee6e..ede438bc9 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -15,5 +15,6 @@ nu-color-config = { path = "../nu-color-config" } miette = { version = "3.0.0", features = ["fancy"] } thiserror = "1.0.29" reedline = { git = "https://github.com/nushell/reedline", branch = "main" } + log = "0.4" is_executable = "1.0.1" diff --git a/crates/nu-protocol/src/config.rs b/crates/nu-protocol/src/config.rs index 994cdd4fa..471ca0b77 100644 --- a/crates/nu-protocol/src/config.rs +++ b/crates/nu-protocol/src/config.rs @@ -59,6 +59,7 @@ pub struct Config { pub float_precision: i64, pub filesize_format: String, pub use_ansi_coloring: bool, + pub quick_completions: bool, pub env_conversions: HashMap, pub edit_mode: String, pub max_history_size: i64, @@ -81,6 +82,7 @@ impl Default for Config { float_precision: 4, filesize_format: "auto".into(), use_ansi_coloring: true, + quick_completions: false, env_conversions: HashMap::new(), // TODO: Add default conversoins edit_mode: "emacs".into(), max_history_size: 1000, @@ -185,6 +187,13 @@ impl Value { eprintln!("$config.use_ansi_coloring is not a bool") } } + "quick_completions" => { + if let Ok(b) = value.as_bool() { + config.quick_completions = b; + } else { + eprintln!("$config.quick_completions is not a bool") + } + } "filesize_format" => { if let Ok(v) = value.as_string() { config.filesize_format = v.to_lowercase(); diff --git a/src/repl.rs b/src/repl.rs index 5080c55d9..ccd406926 100644 --- a/src/repl.rs +++ b/src/repl.rs @@ -107,6 +107,7 @@ pub(crate) fn evaluate(engine_state: &mut EngineState) -> Result<()> { engine_state: engine_state.clone(), })) .with_completer(Box::new(NuCompleter::new(engine_state.clone()))) + .with_quick_completions(config.quick_completions) .with_ansi_colors(config.use_ansi_coloring); line_editor = add_completion_menu(line_editor, &config);