From b8b5980679df434f0bc19031eb9145e327a119f6 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Mon, 25 Jan 2016 18:11:57 +0100 Subject: [PATCH] suggest: fix sorting --- .../contrib/suggest/browser/suggestWidget.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/vs/editor/contrib/suggest/browser/suggestWidget.ts b/src/vs/editor/contrib/suggest/browser/suggestWidget.ts index d147c4ce1bd..a9fbe1083a5 100644 --- a/src/vs/editor/contrib/suggest/browser/suggestWidget.ts +++ b/src/vs/editor/contrib/suggest/browser/suggestWidget.ts @@ -40,10 +40,16 @@ function completionItemCompare(item: CompletionItem, otherItem: CompletionItem): const suggestion = item.suggestion; const otherSuggestion = otherItem.suggestion; - // TODO@jrieken - // if (typeof suggestion.sortText === 'string' && typeof otherSuggestion.sortText === 'string') { - // return suggestion.sortText < otherSuggestion.sortText ? -1 : 1; - // } + if (typeof suggestion.sortText === 'string' && typeof otherSuggestion.sortText === 'string') { + const one = suggestion.sortText.toLowerCase(); + const other = otherSuggestion.sortText.toLowerCase(); + + if (one < other) { + return -1; + } else if (one > other) { + return 1; + } + } return suggestion.label.toLowerCase() < otherSuggestion.label.toLowerCase() ? -1 : 1; } -- GitLab