diff --git a/crates/nu-cli/src/shell/completer.rs b/crates/nu-cli/src/shell/completer.rs index e7d70ae4b..9c0696d30 100644 --- a/crates/nu-cli/src/shell/completer.rs +++ b/crates/nu-cli/src/shell/completer.rs @@ -54,7 +54,14 @@ impl NuCompleter { if locations.is_empty() { (pos, Vec::new()) } else { - let pos = locations[0].span.start(); + let mut pos = locations[0].span.start(); + + for location in &locations { + if location.span.start() < pos { + pos = location.span.start(); + } + } + let suggestions = locations .into_iter() .flat_map(|location| {