Skip to content

Commit 77e89e2

Browse files
authored
factor in completion description in sorting (microsoft#241505)
fix microsoft#241252
1 parent f4edc9a commit 77e89e2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalCompletionModel.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ const compareCompletionsFn = (leadingLineContent: string, a: TerminalCompletionI
6767

6868
// Sort by more detailed completions
6969
if (a.completion.kind === TerminalCompletionItemKind.Method && b.completion.kind === TerminalCompletionItemKind.Method) {
70-
score = (b.completion.detail ? 1 : 0) + (b.completion.documentation ? 2 : 0) - (a.completion.detail ? 1 : 0) - (a.completion.documentation ? 2 : 0);
70+
if (typeof a.completion.label !== 'string' && a.completion.label.description && typeof b.completion.label !== 'string' && b.completion.label.description) {
71+
score = 0;
72+
} else if (typeof a.completion.label !== 'string' && a.completion.label.description) {
73+
score = -2;
74+
} else if (typeof b.completion.label !== 'string' && b.completion.label.description) {
75+
score = 2;
76+
}
77+
score += (b.completion.detail ? 1 : 0) + (b.completion.documentation ? 2 : 0) - (a.completion.detail ? 1 : 0) - (a.completion.documentation ? 2 : 0);
7178
if (score !== 0) {
7279
return score;
7380
}

0 commit comments

Comments
 (0)