Use match_indices: None for all suggestions

This commit is contained in:
ysthakur 2024-06-01 17:20:08 -04:00
parent 64afb52ffa
commit 31d3008d89
11 changed files with 21 additions and 2 deletions

2
Cargo.lock generated
View File

@ -4819,7 +4819,7 @@ dependencies = [
[[package]] [[package]]
name = "reedline" name = "reedline"
version = "0.32.0" version = "0.32.0"
source = "git+https://github.com/nushell/reedline?branch=main#a580ea56d4e5a889468b2969d2a1534379504ab6" source = "git+https://github.com/ysthakur/reedline?branch=fuzzy-select-underline#a747c7110eb5113c347c99cd6f1ee09d2c4a0084"
dependencies = [ dependencies = [
"arboard", "arboard",
"chrono", "chrono",

View File

@ -298,7 +298,7 @@ bench = false
# To use a development version of a dependency please use a global override here # To use a development version of a dependency please use a global override here
# changing versions in each sub-crate of the workspace is tedious # changing versions in each sub-crate of the workspace is tedious
[patch.crates-io] [patch.crates-io]
reedline = { git = "https://github.com/nushell/reedline", branch = "main" } reedline = { git = "https://github.com/ysthakur/reedline", branch = "fuzzy-select-underline" }
# nu-ansi-term = {git = "https://github.com/nushell/nu-ansi-term.git", branch = "main"} # nu-ansi-term = {git = "https://github.com/nushell/nu-ansi-term.git", branch = "main"}
# Run all benchmarks with `cargo bench` # Run all benchmarks with `cargo bench`

View File

@ -103,6 +103,7 @@ impl CommandCompletion {
extra: None, extra: None,
span: reedline::Span::new(span.start - offset, span.end - offset), span: reedline::Span::new(span.start - offset, span.end - offset),
append_whitespace: true, append_whitespace: true,
match_indices: None,
}, },
kind: Some(SuggestionKind::Command(x.2)), kind: Some(SuggestionKind::Command(x.2)),
}) })
@ -123,6 +124,7 @@ impl CommandCompletion {
extra: None, extra: None,
span: reedline::Span::new(span.start - offset, span.end - offset), span: reedline::Span::new(span.start - offset, span.end - offset),
append_whitespace: true, append_whitespace: true,
match_indices: None,
}, },
// TODO: is there a way to create a test? // TODO: is there a way to create a test?
kind: None, kind: None,
@ -141,6 +143,7 @@ impl CommandCompletion {
extra: None, extra: None,
span: external.suggestion.span, span: external.suggestion.span,
append_whitespace: true, append_whitespace: true,
match_indices: None,
}, },
kind: external.kind, kind: external.kind,
}) })

View File

@ -457,6 +457,7 @@ pub fn map_value_completions<'a>(
end: span.end - offset, end: span.end - offset,
}, },
append_whitespace: false, append_whitespace: false,
match_indices: None,
}, },
kind: Some(SuggestionKind::Type(x.get_type())), kind: Some(SuggestionKind::Type(x.get_type())),
}); });
@ -474,6 +475,7 @@ pub fn map_value_completions<'a>(
end: span.end - offset, end: span.end - offset,
}, },
append_whitespace: false, append_whitespace: false,
match_indices: None,
}; };
// Iterate the cols looking for `value` and `description` // Iterate the cols looking for `value` and `description`

View File

@ -56,6 +56,7 @@ impl Completer for DirectoryCompletion {
end: x.0.end - offset, end: x.0.end - offset,
}, },
append_whitespace: false, append_whitespace: false,
match_indices: None,
}, },
// TODO???? // TODO????
kind: None, kind: None,

View File

@ -124,6 +124,7 @@ impl Completer for DotNuCompletion {
end: x.0.end - offset, end: x.0.end - offset,
}, },
append_whitespace: true, append_whitespace: true,
match_indices: None,
}, },
// TODO???? // TODO????
kind: None, kind: None,

View File

@ -61,6 +61,7 @@ impl Completer for FileCompletion {
end: x.0.end - offset, end: x.0.end - offset,
}, },
append_whitespace: false, append_whitespace: false,
match_indices: None,
}, },
// TODO???? // TODO????
kind: None, kind: None,

View File

@ -56,6 +56,7 @@ impl Completer for FlagCompletion {
end: span.end - offset, end: span.end - offset,
}, },
append_whitespace: true, append_whitespace: true,
match_indices: None,
}, },
// TODO???? // TODO????
kind: None, kind: None,
@ -83,6 +84,7 @@ impl Completer for FlagCompletion {
end: span.end - offset, end: span.end - offset,
}, },
append_whitespace: true, append_whitespace: true,
match_indices: None,
}, },
// TODO???? // TODO????
kind: None, kind: None,

View File

@ -87,6 +87,7 @@ impl Completer for VariableCompletion {
extra: None, extra: None,
span: current_span, span: current_span,
append_whitespace: false, append_whitespace: false,
match_indices: None,
}, },
kind: Some(SuggestionKind::Type(env_var.1.get_type())), kind: Some(SuggestionKind::Type(env_var.1.get_type())),
}); });
@ -159,6 +160,7 @@ impl Completer for VariableCompletion {
extra: None, extra: None,
span: current_span, span: current_span,
append_whitespace: false, append_whitespace: false,
match_indices: None,
}, },
// TODO is there a way to get the VarId to get the type??? // TODO is there a way to get the VarId to get the type???
kind: None, kind: None,
@ -186,6 +188,7 @@ impl Completer for VariableCompletion {
extra: None, extra: None,
span: current_span, span: current_span,
append_whitespace: false, append_whitespace: false,
match_indices: None,
}, },
kind: Some(SuggestionKind::Type( kind: Some(SuggestionKind::Type(
working_set.get_variable(*v.1).ty.clone(), working_set.get_variable(*v.1).ty.clone(),
@ -217,6 +220,7 @@ impl Completer for VariableCompletion {
extra: None, extra: None,
span: current_span, span: current_span,
append_whitespace: false, append_whitespace: false,
match_indices: None,
}, },
kind: Some(SuggestionKind::Type( kind: Some(SuggestionKind::Type(
working_set.get_variable(*v.1).ty.clone(), working_set.get_variable(*v.1).ty.clone(),
@ -255,6 +259,7 @@ fn nested_suggestions(
extra: None, extra: None,
span: current_span, span: current_span,
append_whitespace: false, append_whitespace: false,
match_indices: None,
}, },
kind: Some(kind.clone()), kind: Some(kind.clone()),
}); });
@ -272,6 +277,7 @@ fn nested_suggestions(
extra: None, extra: None,
span: current_span, span: current_span,
append_whitespace: false, append_whitespace: false,
match_indices: None,
}, },
kind: Some(kind.clone()), kind: Some(kind.clone()),
}); });

View File

@ -108,6 +108,7 @@ impl NuHelpCompleter {
end: pos, end: pos,
}, },
append_whitespace: false, append_whitespace: false,
match_indices: None,
} }
}) })
.collect() .collect()

View File

@ -146,6 +146,7 @@ fn convert_to_suggestions(
extra, extra,
span, span,
append_whitespace: false, append_whitespace: false,
match_indices: None,
}] }]
} }
Value::List { vals, .. } => vals Value::List { vals, .. } => vals
@ -170,6 +171,7 @@ fn convert_to_suggestions(
}, },
}, },
append_whitespace: false, append_whitespace: false,
match_indices: None,
}], }],
} }
} }