Remove sorting by index as it is already done here: e9ea3cad76/src/autocomplete/QueryMatcher.ts (L120)

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-06-20 10:29:08 +02:00
parent 2c66adcb0e
commit d0ea842f1e
No known key found for this signature in database
GPG key ID: 9760693FDD98A790

View file

@ -32,15 +32,6 @@ import SettingsStore from "../settings/SettingsStore";
const ROOM_REGEX = /\B#\S*/g;
function score(query: string, space: string) {
const index = space.indexOf(query);
if (index === -1) {
return Infinity;
} else {
return index;
}
}
function matcherObject(room: Room, displayedAlias: string, matchName = "") {
return {
room,
@ -106,7 +97,6 @@ export default class RoomProvider extends AutocompleteProvider {
const matchedString = command[0];
completions = this.matcher.match(matchedString, limit);
completions = sortBy(completions, [
(c) => score(matchedString, c.displayedAlias),
(c) => c.displayedAlias.length,
]);
completions = uniqBy(completions, (match) => match.room);