Skip to content

Commit b0bbbcb

Browse files
author
Andy
authored
Merge pull request #12730 from Microsoft/memberList_to_completionList
Use "completionList" methods instead of "memberList" ones, since they're identical
2 parents 420d6a2 + 9f20077 commit b0bbbcb

File tree

174 files changed

+1235
-1293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+1235
-1293
lines changed

src/harness/fourslash.ts

Lines changed: 5 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -607,23 +607,13 @@ namespace FourSlash {
607607
});
608608
}
609609

610-
public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
611-
const members = this.getMemberListAtCaret();
612-
if (members) {
613-
this.assertItemInCompletionList(members.entries, symbol, text, documentation, kind);
614-
}
615-
else {
616-
this.raiseError("Expected a member list, but none was provided");
617-
}
618-
}
619-
620-
public verifyMemberListCount(expectedCount: number, negative: boolean) {
610+
public verifyCompletionListCount(expectedCount: number, negative: boolean) {
621611
if (expectedCount === 0 && negative) {
622-
this.verifyMemberListIsEmpty(/*negative*/ false);
612+
this.verifyCompletionListIsEmpty(/*negative*/ false);
623613
return;
624614
}
625615

626-
const members = this.getMemberListAtCaret();
616+
const members = this.getCompletionListAtCaret();
627617

628618
if (members) {
629619
const match = members.entries.length === expectedCount;
@@ -637,13 +627,6 @@ namespace FourSlash {
637627
}
638628
}
639629

640-
public verifyMemberListDoesNotContain(symbol: string) {
641-
const members = this.getMemberListAtCaret();
642-
if (members && members.entries.filter(e => e.name === symbol).length !== 0) {
643-
this.raiseError(`Member list did contain ${symbol}`);
644-
}
645-
}
646-
647630
public verifyCompletionListItemsCountIsGreaterThan(count: number, negative: boolean) {
648631
const completions = this.getCompletionListAtCaret();
649632
const itemsCount = completions.entries.length;
@@ -685,16 +668,6 @@ namespace FourSlash {
685668
}
686669
}
687670

688-
public verifyMemberListIsEmpty(negative: boolean) {
689-
const members = this.getMemberListAtCaret();
690-
if ((!members || members.entries.length === 0) && negative) {
691-
this.raiseError("Member list is empty at Caret");
692-
}
693-
else if ((members && members.entries.length !== 0) && !negative) {
694-
this.raiseError(`Member list is not empty at Caret:\nMember List contains: ${stringify(members.entries.map(e => e.name))}`);
695-
}
696-
}
697-
698671
public verifyCompletionListIsEmpty(negative: boolean) {
699672
const completions = this.getCompletionListAtCaret();
700673
if ((!completions || completions.entries.length === 0) && negative) {
@@ -892,10 +865,6 @@ namespace FourSlash {
892865
this.raiseError(`verifyReferencesAtPositionListContains failed - could not find the item: ${stringify(missingItem)} in the returned list: (${stringify(references)})`);
893866
}
894867

895-
private getMemberListAtCaret() {
896-
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
897-
}
898-
899868
private getCompletionListAtCaret() {
900869
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
901870
}
@@ -1353,11 +1322,6 @@ namespace FourSlash {
13531322
Harness.IO.log(stringify(sigHelp));
13541323
}
13551324

1356-
public printMemberListMembers() {
1357-
const members = this.getMemberListAtCaret();
1358-
this.printMembersOrCompletions(members);
1359-
}
1360-
13611325
public printCompletionListMembers() {
13621326
const completions = this.getCompletionListAtCaret();
13631327
this.printMembersOrCompletions(completions);
@@ -3061,19 +3025,8 @@ namespace FourSlashInterface {
30613025
}
30623026
}
30633027

3064-
// Verifies the member list contains the specified symbol. The
3065-
// member list is brought up if necessary
3066-
public memberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
3067-
if (this.negative) {
3068-
this.state.verifyMemberListDoesNotContain(symbol);
3069-
}
3070-
else {
3071-
this.state.verifyMemberListContains(symbol, text, documentation, kind);
3072-
}
3073-
}
3074-
3075-
public memberListCount(expectedCount: number) {
3076-
this.state.verifyMemberListCount(expectedCount, this.negative);
3028+
public completionListCount(expectedCount: number) {
3029+
this.state.verifyCompletionListCount(expectedCount, this.negative);
30773030
}
30783031

30793032
// Verifies the completion list contains the specified symbol. The
@@ -3109,10 +3062,6 @@ namespace FourSlashInterface {
31093062
this.state.verifyCompletionListAllowsNewIdentifier(this.negative);
31103063
}
31113064

3112-
public memberListIsEmpty() {
3113-
this.state.verifyMemberListIsEmpty(this.negative);
3114-
}
3115-
31163065
public signatureHelpPresent() {
31173066
this.state.verifySignatureHelpPresent(!this.negative);
31183067
}
@@ -3514,10 +3463,6 @@ namespace FourSlashInterface {
35143463
this.state.printCurrentSignatureHelp();
35153464
}
35163465

3517-
public printMemberListMembers() {
3518-
this.state.printMemberListMembers();
3519-
}
3520-
35213466
public printCompletionListMembers() {
35223467
this.state.printCompletionListMembers();
35233468
}

tests/cases/fourslash/basicClassMembers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
goTo.eof();
99
edit.insert('t.');
10-
verify.memberListContains('x');
11-
verify.memberListContains('y');
12-
verify.not.memberListContains('z');
10+
verify.completionListContains('x');
11+
verify.completionListContains('y');
12+
verify.not.completionListContains('z');

0 commit comments

Comments
 (0)