Fix completion crash (#3574)

This commit is contained in:
JT 2021-06-08 18:56:36 +12:00 committed by GitHub
parent 4e6c2c0fa1
commit bc6fa85a4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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| {