mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 09:55:42 +02:00
Signature improves, sorted completions (#545)
This commit is contained in:
@ -18,10 +18,8 @@ impl NuCompleter {
|
||||
pub fn new(engine_state: EngineState) -> Self {
|
||||
Self { engine_state }
|
||||
}
|
||||
}
|
||||
|
||||
impl Completer for NuCompleter {
|
||||
fn complete(&self, line: &str, pos: usize) -> Vec<(reedline::Span, String)> {
|
||||
fn completion_helper(&self, line: &str, pos: usize) -> Vec<(reedline::Span, String)> {
|
||||
let mut working_set = StateWorkingSet::new(&self.engine_state);
|
||||
let offset = working_set.next_span_start();
|
||||
let pos = offset + pos;
|
||||
@ -201,6 +199,16 @@ impl Completer for NuCompleter {
|
||||
}
|
||||
}
|
||||
|
||||
impl Completer for NuCompleter {
|
||||
fn complete(&self, line: &str, pos: usize) -> Vec<(reedline::Span, String)> {
|
||||
let mut output = self.completion_helper(line, pos);
|
||||
|
||||
output.sort_by(|a, b| a.1.cmp(&b.1));
|
||||
|
||||
output
|
||||
}
|
||||
}
|
||||
|
||||
fn file_path_completion(
|
||||
span: nu_protocol::Span,
|
||||
partial: &str,
|
||||
|
Reference in New Issue
Block a user