From c51bdc87c7377230e260170abc35cec9a27b3971 Mon Sep 17 00:00:00 2001 From: Oliver Blanthorn Date: Fri, 17 Aug 2018 18:38:51 +0100 Subject: [PATCH] Mitigate #917 until we get our heads around async --- src/completions/Excmd.ts | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/completions/Excmd.ts b/src/completions/Excmd.ts index 2201c1cd..06ee05b7 100644 --- a/src/completions/Excmd.ts +++ b/src/completions/Excmd.ts @@ -55,18 +55,21 @@ export class ExcmdCompletionSource extends Completions.CompletionSourceFuse { } private async scoreOptions(exstrs: string[]) { - let histpos = state.cmdHistory.map(s => s.split(" ")[0]).reverse() - return exstrs.sort((a, b) => { - let posa = histpos.findIndex(x => x == a) - let posb = histpos.findIndex(x => x == b) - // If two ex commands have the same position, sort lexically - if (posa == posb) return a < b ? -1 : 1 - // If they aren't found in the list they get lower priority - if (posa == -1) return 1 - if (posb == -1) return -1 - // Finally, sort by history position - return posa < posb ? -1 : 1 - }) + return exstrs + + // Too slow with large profiles + // let histpos = state.cmdHistory.map(s => s.split(" ")[0]).reverse() + // return exstrs.sort((a, b) => { + // let posa = histpos.findIndex(x => x == a) + // let posb = histpos.findIndex(x => x == b) + // // If two ex commands have the same position, sort lexically + // if (posa == posb) return a < b ? -1 : 1 + // // If they aren't found in the list they get lower priority + // if (posa == -1) return 1 + // if (posb == -1) return -1 + // // Finally, sort by history position + // return posa < posb ? -1 : 1 + // }) } select(option: ExcmdCompletionOption) {