Skip to content

Commit e3b812a

Browse files
committed
delete isfulfilled to pass tests
1 parent 584be33 commit e3b812a

File tree

5 files changed

+24
-30
lines changed

5 files changed

+24
-30
lines changed

src/harness/fourslash.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -844,11 +844,8 @@ namespace FourSlash {
844844

845845
let isSortTextEqual: boolean;
846846
if (!sortText) {
847-
isSortTextEqual = actual.isFulfilled
848-
? actual.sortText === ts.Completions.SortText.LocationPriorityFulfilled
849-
: actual.kindModifiers === 'optional'
850-
? actual.sortText === ts.Completions.SortText.LocationPriorityOptional
851-
: actual.sortText === ts.Completions.SortText.LocationPriority
847+
isSortTextEqual = [ts.Completions.SortText.LocationPriorityFulfilled, ts.Completions.SortText.LocationPriority].indexOf(actual.sortText as ts.Completions.SortText) !== -1
848+
|| (actual.kindModifiers === "optional" && actual.sortText === ts.Completions.SortText.LocationPriorityOptional);
852849
}
853850
else {
854851
isSortTextEqual = actual.sortText === sortText;

src/services/completions.ts

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ namespace ts.Completions {
244244
propertyAccessToConvert: PropertyAccessExpression | undefined,
245245
isJsxInitializer: IsJsxInitializer | undefined,
246246
preferences: UserPreferences,
247-
isFulfilled: boolean
248247
): CompletionEntry | undefined {
249248
let insertText: string | undefined;
250249
let replacementSpan: TextSpan | undefined;
@@ -291,7 +290,6 @@ namespace ts.Completions {
291290
isRecommended: trueOrUndefined(isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker)),
292291
insertText,
293292
replacementSpan,
294-
isFulfilled
295293
};
296294
}
297295

@@ -343,17 +341,17 @@ namespace ts.Completions {
343341
}
344342

345343
let sortText = symbolToSortTextMap && symbolToSortTextMap[getSymbolId(symbol)];
346-
let isFulfilled = false;
347344
if (!sortText) {
348-
fulfilledSymbols && fulfilledSymbols.forEach(fulfilledSymbol => {
349-
if (fulfilledSymbol.name === symbol.name) {
350-
sortText = SortText.LocationPriorityFulfilled;
351-
isFulfilled = true;
352-
}
353-
});
345+
if (fulfilledSymbols && fulfilledSymbols.length > 0) {
346+
fulfilledSymbols.forEach(fulfilledSymbol => {
347+
if (fulfilledSymbol.name === symbol.name) {
348+
sortText = SortText.LocationPriorityFulfilled;
349+
}
350+
});
351+
}
354352
}
355353
if (!sortText) {
356-
sortText = SymbolDisplay.getSymbolModifiers(symbol) === 'optional' ? SortText.LocationPriorityOptional : SortText.LocationPriority;
354+
sortText = SymbolDisplay.getSymbolModifiers(symbol) === "optional" ? SortText.LocationPriorityOptional : SortText.LocationPriority;
357355
}
358356

359357
const entry = createCompletionEntry(
@@ -369,7 +367,6 @@ namespace ts.Completions {
369367
propertyAccessToConvert,
370368
isJsxInitializer,
371369
preferences,
372-
isFulfilled
373370
);
374371
if (!entry) {
375372
continue;
@@ -1519,14 +1516,16 @@ namespace ts.Completions {
15191516
if (typeMembers && typeMembers.length > 0) {
15201517
// Add filtered items to the completion list
15211518
symbols = filterObjectMembersList(typeMembers, Debug.assertDefined(existingMembers));
1522-
existingMembers && existingMembers.forEach(member => {
1523-
if (member.kind === SyntaxKind.SpreadAssignment) {
1524-
const expression = (<SpreadAssignment>member).expression;
1525-
const symbol = typeChecker.getSymbolAtLocation(expression);
1526-
const type = symbol && typeChecker.getTypeOfSymbolAtLocation(symbol, expression);
1527-
fulfilledSymbols = type && (<ObjectType>type).properties;
1528-
}
1529-
});
1519+
if (existingMembers && existingMembers.length > 0) {
1520+
existingMembers.forEach(member => {
1521+
if (member.kind === SyntaxKind.SpreadAssignment) {
1522+
const expression = (<SpreadAssignment>member).expression;
1523+
const symbol = typeChecker.getSymbolAtLocation(expression);
1524+
const type = symbol && typeChecker.getTypeOfSymbolAtLocation(symbol, expression);
1525+
fulfilledSymbols = type && (<ObjectType>type).properties;
1526+
}
1527+
});
1528+
}
15301529
}
15311530
return GlobalsSearch.Success;
15321531
}

src/services/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,6 @@ namespace ts {
919919
hasAction?: true;
920920
source?: string;
921921
isRecommended?: true;
922-
isFulfilled?: boolean;
923922
}
924923

925924
export interface CompletionEntryDetails {

tests/cases/fourslash/completionsPropertiesPriorities.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
verify.completions({
2222
marker: ['a'],
2323
exact: [
24-
{ name: 'B', isFulfilled: true, kindModifiers: 'optional', sortText: completion.SortText.LocationPriorityFulfilled, kind: 'property' },
25-
{ name: 'a', isFulfilled: true, sortText: completion.SortText.LocationPriorityFulfilled, kind: 'property' },
26-
{ name: 'c', isFulfilled: false, kindModifiers: 'optional', sortText: completion.SortText.LocationPriorityOptional, kind: 'property' },
27-
{ name: 'd', isFulfilled: false, sortText: completion.SortText.LocationPriority, kind: 'property' }
24+
{ name: 'B', kindModifiers: 'optional', sortText: completion.SortText.LocationPriorityFulfilled, kind: 'property' },
25+
{ name: 'a', sortText: completion.SortText.LocationPriorityFulfilled, kind: 'property' },
26+
{ name: 'c', kindModifiers: 'optional', sortText: completion.SortText.LocationPriorityOptional, kind: 'property' },
27+
{ name: 'd', sortText: completion.SortText.LocationPriority, kind: 'property' }
2828
]
2929
});

tests/cases/fourslash/fourslash.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,6 @@ declare namespace FourSlashInterface {
548548
readonly kind?: string;
549549
readonly kindModifiers?: string;
550550
readonly sortText?: completion.SortText;
551-
readonly isFulfilled?: boolean;
552551

553552
// details
554553
readonly text?: string;

0 commit comments

Comments
 (0)