forked from extern/nushell
Fix completion crash (#3574)
This commit is contained in:
parent
4e6c2c0fa1
commit
bc6fa85a4b
@ -54,7 +54,14 @@ impl NuCompleter {
|
|||||||
if locations.is_empty() {
|
if locations.is_empty() {
|
||||||
(pos, Vec::new())
|
(pos, Vec::new())
|
||||||
} else {
|
} 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
|
let suggestions = locations
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flat_map(|location| {
|
.flat_map(|location| {
|
||||||
|
Loading…
Reference in New Issue
Block a user