Skip to content

Commit faa5580

Browse files
Ensure all SortText entries have the same length.
1 parent e3d6189 commit faa5580

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

src/services/completions.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,35 @@ namespace ts.Completions {
66

77
export type Log = (message: string) => void;
88

9+
// NOTE: Make sure that each entry has the exact same number of digits
10+
// since many implementations will sort by string contents,
11+
// where "10" is considered less than "2".
912
export enum SortText {
10-
LocalDeclarationPriority = "0",
11-
LocationPriority = "1",
12-
OptionalMember = "2",
13-
MemberDeclaredBySpreadAssignment = "3",
14-
SuggestedClassMembers = "4",
15-
GlobalsOrKeywords = "5",
16-
AutoImportSuggestions = "6",
17-
JavascriptIdentifiers = "7",
18-
DeprecatedLocalDeclarationPriority = "8",
19-
DeprecatedLocationPriority = "9",
20-
DeprecatedOptionalMember = "10",
21-
DeprecatedMemberDeclaredBySpreadAssignment = "11",
22-
DeprecatedSuggestedClassMembers = "12",
23-
DeprecatedGlobalsOrKeywords = "13",
24-
DeprecatedAutoImportSuggestions = "14"
13+
LocalDeclarationPriority = "10",
14+
LocationPriority = "11",
15+
OptionalMember = "12",
16+
MemberDeclaredBySpreadAssignment = "13",
17+
SuggestedClassMembers = "14",
18+
GlobalsOrKeywords = "15",
19+
AutoImportSuggestions = "16",
20+
JavascriptIdentifiers = "17",
21+
DeprecatedLocalDeclarationPriority = "18",
22+
DeprecatedLocationPriority = "19",
23+
DeprecatedOptionalMember = "20",
24+
DeprecatedMemberDeclaredBySpreadAssignment = "21",
25+
DeprecatedSuggestedClassMembers = "22",
26+
DeprecatedGlobalsOrKeywords = "23",
27+
DeprecatedAutoImportSuggestions = "24"
2528
}
2629

2730
enum SortTextId {
28-
LocalDeclarationPriority,
29-
LocationPriority,
30-
OptionalMember,
31-
MemberDeclaredBySpreadAssignment,
32-
SuggestedClassMembers,
33-
GlobalsOrKeywords,
34-
AutoImportSuggestions
31+
LocalDeclarationPriority = 10,
32+
LocationPriority = 11,
33+
OptionalMember = 12,
34+
MemberDeclaredBySpreadAssignment = 13,
35+
SuggestedClassMembers = 14,
36+
GlobalsOrKeywords = 15,
37+
AutoImportSuggestions = 16,
3538
}
3639

3740
// for JavaScript identifiers since they are preferred over deprecated symbols

0 commit comments

Comments
 (0)