提交 21a84ab8 编写于 作者: J Johannes Rieken

keep sort text, sort by label if no or equal sort text

上级 cf72b12c
......@@ -21,7 +21,7 @@ class MyCompletionItem extends CompletionItem {
constructor(entry: CompletionEntry) {
super(entry.name);
this.sortText = `${entry.name}-${entry.sortText}`; // tsserver sortText is "0" and "1" which is not good when comparing to snippets for instance
this.sortText = entry.sortText;
this.kind = MyCompletionItem.convertKind(entry.kind);
}
......
......@@ -247,7 +247,15 @@ class Sorter implements Tree.ISorter {
}
private static suggestionCompare(a: ISuggestion, b: ISuggestion): number {
return (a.sortText || a.label).localeCompare((b.sortText || b.label));
let cmp = 0;
if (typeof a.sortText === 'string' && typeof b.sortText === 'string') {
cmp = a.sortText.localeCompare(b.sortText);
}
if (cmp === 0) {
cmp = a.label.localeCompare(b.label);
}
return cmp;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册