alpha -> alphabetical

This commit is contained in:
ysthakur 2024-07-15 18:43:27 -04:00
parent e22d8fa6c7
commit 3503d0f52a
4 changed files with 6 additions and 6 deletions

View File

@ -109,7 +109,7 @@ impl Completer for CustomCompletion {
None => completion_options.match_algorithm, None => completion_options.match_algorithm,
}, },
sort: if should_sort { sort: if should_sort {
CompletionSort::Alpha CompletionSort::Alphabetical
} else { } else {
CompletionSort::Default CompletionSort::Default
}, },

View File

@ -112,7 +112,7 @@ fn fuzzy_alpha_sort_completer() -> NuCompleter {
let config = r#" let config = r#"
$env.config.completions.algorithm = "fuzzy" $env.config.completions.algorithm = "fuzzy"
$env.config.completions.sort = "alpha" $env.config.completions.sort = "alphabetical"
"#; "#;
assert!(support::merge_input(config.as_bytes(), &mut engine, &mut stack, dir).is_ok()); assert!(support::merge_input(config.as_bytes(), &mut engine, &mut stack, dir).is_ok());

View File

@ -39,7 +39,7 @@ impl ReconstructVal for CompletionAlgorithm {
pub enum CompletionSort { pub enum CompletionSort {
#[default] #[default]
Default, Default,
Alpha, Alphabetical,
} }
impl FromStr for CompletionSort { impl FromStr for CompletionSort {
@ -48,7 +48,7 @@ impl FromStr for CompletionSort {
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_ascii_lowercase().as_str() { match s.to_ascii_lowercase().as_str() {
"default" => Ok(Self::Default), "default" => Ok(Self::Default),
"alpha" => Ok(Self::Alpha), "alphabetical" => Ok(Self::Alphabetical),
_ => Err("expected either 'default' or 'alpha'"), _ => Err("expected either 'default' or 'alpha'"),
} }
} }
@ -58,7 +58,7 @@ impl ReconstructVal for CompletionSort {
fn reconstruct_value(&self, span: Span) -> Value { fn reconstruct_value(&self, span: Span) -> Value {
let str = match self { let str = match self {
Self::Default => "default", Self::Default => "default",
Self::Alpha => "alpha", Self::Alphabetical => "alphabetical",
}; };
Value::string(str, span) Value::string(str, span)
} }

View File

@ -205,7 +205,7 @@ $env.config = {
quick: true # set this to false to prevent auto-selecting completions when only one remains quick: true # set this to false to prevent auto-selecting completions when only one remains
partial: true # set this to false to prevent partial filling of the prompt partial: true # set this to false to prevent partial filling of the prompt
algorithm: "prefix" # prefix or fuzzy algorithm: "prefix" # prefix or fuzzy
sort: "default" # default (choose based on algorithm) or alpha (always sort alphabetically) sort: "default" # "default" (choose based on algorithm) or "alphabetical"
external: { external: {
enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow
max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options