Sort suggestions case-insensitively
This commit is contained in:
parent
182168acd5
commit
2def16ba85
2 changed files with 4 additions and 4 deletions
|
@ -97,7 +97,7 @@ public class Suggestions {
|
||||||
texts.add(suggestion.expand(command, range));
|
texts.add(suggestion.expand(command, range));
|
||||||
}
|
}
|
||||||
final List<String> sorted = Lists.newArrayList(texts);
|
final List<String> sorted = Lists.newArrayList(texts);
|
||||||
Collections.sort(sorted);
|
sorted.sort(String::compareToIgnoreCase);
|
||||||
return new Suggestions(range, sorted);
|
return new Suggestions(range, sorted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ public class SuggestionsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void merge_multiple() {
|
public void merge_multiple() {
|
||||||
final Suggestions a = new Suggestions(StringRange.at(5), Lists.newArrayList("ar", "az"));
|
final Suggestions a = new Suggestions(StringRange.at(5), Lists.newArrayList("ar", "az", "Az"));
|
||||||
final Suggestions b = new Suggestions(StringRange.between(4, 5), Lists.newArrayList("foo", "qux", "apple"));
|
final Suggestions b = new Suggestions(StringRange.between(4, 5), Lists.newArrayList("foo", "qux", "apple", "Bar"));
|
||||||
final Suggestions merged = Suggestions.merge("foo b", Lists.newArrayList(a, b));
|
final Suggestions merged = Suggestions.merge("foo b", Lists.newArrayList(a, b));
|
||||||
assertThat(merged.getList(), equalTo(Lists.newArrayList("apple", "bar", "baz", "foo", "qux")));
|
assertThat(merged.getList(), equalTo(Lists.newArrayList("apple", "bar", "Bar", "baz", "bAz", "foo", "qux")));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue