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:
parent
2c66adcb0e
commit
d0ea842f1e
1 changed files with 0 additions and 10 deletions
|
@ -32,15 +32,6 @@ import SettingsStore from "../settings/SettingsStore";
|
||||||
|
|
||||||
const ROOM_REGEX = /\B#\S*/g;
|
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 = "") {
|
function matcherObject(room: Room, displayedAlias: string, matchName = "") {
|
||||||
return {
|
return {
|
||||||
room,
|
room,
|
||||||
|
@ -106,7 +97,6 @@ export default class RoomProvider extends AutocompleteProvider {
|
||||||
const matchedString = command[0];
|
const matchedString = command[0];
|
||||||
completions = this.matcher.match(matchedString, limit);
|
completions = this.matcher.match(matchedString, limit);
|
||||||
completions = sortBy(completions, [
|
completions = sortBy(completions, [
|
||||||
(c) => score(matchedString, c.displayedAlias),
|
|
||||||
(c) => c.displayedAlias.length,
|
(c) => c.displayedAlias.length,
|
||||||
]);
|
]);
|
||||||
completions = uniqBy(completions, (match) => match.room);
|
completions = uniqBy(completions, (match) => match.room);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue