diff --git a/crates/nu-cli/src/completions/completer.rs b/crates/nu-cli/src/completions/completer.rs index 290000d56cfcd..87c51eabf6cea 100644 --- a/crates/nu-cli/src/completions/completer.rs +++ b/crates/nu-cli/src/completions/completer.rs @@ -2,6 +2,7 @@ use crate::completions::{ CommandCompletion, Completer, CompletionOptions, CustomCompletion, DirectoryCompletion, DotNuCompletion, FileCompletion, FlagCompletion, VariableCompletion, }; +use nu_color_config::{color_record_to_nustyle, lookup_ansi_color_style}; use nu_engine::eval_block; use nu_parser::{flatten_expression, parse, FlatShape}; use nu_protocol::{ @@ -508,6 +509,16 @@ pub fn map_value_completions<'a>( suggestion.description = Some(desc_str); } } + + // Match `style` column + if it.0 == "style" { + // Convert the value to string + suggestion.style = match it.1 { + Value::String { val, .. } => Some(lookup_ansi_color_style(val)), + Value::Record { .. } => Some(color_record_to_nustyle(it.1)), + _ => None, + }; + } }); return Some(suggestion); diff --git a/crates/nu-utils/src/sample_config/default_config.nu b/crates/nu-utils/src/sample_config/default_config.nu index 50e8e27c5dbdd..18c9347173434 100644 --- a/crates/nu-utils/src/sample_config/default_config.nu +++ b/crates/nu-utils/src/sample_config/default_config.nu @@ -265,7 +265,7 @@ $env.config = { } style: { text: green - selected_text: green_reverse + selected_text: {attr: r} description_text: yellow } }