feat: external completions for commands/flags (#6295)

* wip

* wip

* cleanup

* error message

* cleanup

* cleanup

* fix clippy

* add test

* fix span

* cleanup

* cleanup

* cleanup

* fixed completion

* push char

* wip

* small fixes

* fix remove last span

* fmt

* cleanup

* fixes + more tests

* fix test

* only complete for commands

* also complete flags

* change decl_id to block_id

* use nu completion first

* fix test

* ignore test

* update config section
This commit is contained in:
Herlon Aguiar
2022-08-22 20:38:51 +02:00
committed by GitHub
parent 772ad896c8
commit 646aace05b
5 changed files with 271 additions and 84 deletions

View File

@ -52,6 +52,7 @@ impl Default for Hooks {
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Config {
pub external_completer: Option<usize>,
pub filesize_metric: bool,
pub table_mode: String,
pub use_ls_colors: bool,
@ -90,6 +91,7 @@ impl Default for Config {
Config {
filesize_metric: false,
table_mode: "rounded".into(),
external_completer: None,
use_ls_colors: true,
color_config: HashMap::new(),
use_grid_icons: false,
@ -183,6 +185,11 @@ impl Value {
eprintln!("$config.filesize_metric is not a bool")
}
}
"external_completer" => {
if let Ok(v) = value.as_block() {
config.external_completer = Some(v)
}
}
"table_mode" => {
if let Ok(v) = value.as_string() {
config.table_mode = v;