Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "completionList" methods instead of "memberList" ones, since they're identical #12730

Merged
1 commit merged into from
Dec 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 5 additions & 60 deletions src/harness/fourslash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,23 +607,13 @@ namespace FourSlash {
});
}

public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
const members = this.getMemberListAtCaret();
if (members) {
this.assertItemInCompletionList(members.entries, symbol, text, documentation, kind);
}
else {
this.raiseError("Expected a member list, but none was provided");
}
}

public verifyMemberListCount(expectedCount: number, negative: boolean) {
public verifyCompletionListCount(expectedCount: number, negative: boolean) {
if (expectedCount === 0 && negative) {
this.verifyMemberListIsEmpty(/*negative*/ false);
this.verifyCompletionListIsEmpty(/*negative*/ false);
return;
}

const members = this.getMemberListAtCaret();
const members = this.getCompletionListAtCaret();

if (members) {
const match = members.entries.length === expectedCount;
Expand All @@ -637,13 +627,6 @@ namespace FourSlash {
}
}

public verifyMemberListDoesNotContain(symbol: string) {
const members = this.getMemberListAtCaret();
if (members && members.entries.filter(e => e.name === symbol).length !== 0) {
this.raiseError(`Member list did contain ${symbol}`);
}
}

public verifyCompletionListItemsCountIsGreaterThan(count: number, negative: boolean) {
const completions = this.getCompletionListAtCaret();
const itemsCount = completions.entries.length;
Expand Down Expand Up @@ -685,16 +668,6 @@ namespace FourSlash {
}
}

public verifyMemberListIsEmpty(negative: boolean) {
const members = this.getMemberListAtCaret();
if ((!members || members.entries.length === 0) && negative) {
this.raiseError("Member list is empty at Caret");
}
else if ((members && members.entries.length !== 0) && !negative) {
this.raiseError(`Member list is not empty at Caret:\nMember List contains: ${stringify(members.entries.map(e => e.name))}`);
}
}

public verifyCompletionListIsEmpty(negative: boolean) {
const completions = this.getCompletionListAtCaret();
if ((!completions || completions.entries.length === 0) && negative) {
Expand Down Expand Up @@ -892,10 +865,6 @@ namespace FourSlash {
this.raiseError(`verifyReferencesAtPositionListContains failed - could not find the item: ${stringify(missingItem)} in the returned list: (${stringify(references)})`);
}

private getMemberListAtCaret() {
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
}

private getCompletionListAtCaret() {
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
}
Expand Down Expand Up @@ -1353,11 +1322,6 @@ namespace FourSlash {
Harness.IO.log(stringify(sigHelp));
}

public printMemberListMembers() {
const members = this.getMemberListAtCaret();
this.printMembersOrCompletions(members);
}

public printCompletionListMembers() {
const completions = this.getCompletionListAtCaret();
this.printMembersOrCompletions(completions);
Expand Down Expand Up @@ -3061,19 +3025,8 @@ namespace FourSlashInterface {
}
}

// Verifies the member list contains the specified symbol. The
// member list is brought up if necessary
public memberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
if (this.negative) {
this.state.verifyMemberListDoesNotContain(symbol);
}
else {
this.state.verifyMemberListContains(symbol, text, documentation, kind);
}
}

public memberListCount(expectedCount: number) {
this.state.verifyMemberListCount(expectedCount, this.negative);
public completionListCount(expectedCount: number) {
this.state.verifyCompletionListCount(expectedCount, this.negative);
}

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

public memberListIsEmpty() {
this.state.verifyMemberListIsEmpty(this.negative);
}

public signatureHelpPresent() {
this.state.verifySignatureHelpPresent(!this.negative);
}
Expand Down Expand Up @@ -3514,10 +3463,6 @@ namespace FourSlashInterface {
this.state.printCurrentSignatureHelp();
}

public printMemberListMembers() {
this.state.printMemberListMembers();
}

public printCompletionListMembers() {
this.state.printCompletionListMembers();
}
Expand Down
6 changes: 3 additions & 3 deletions tests/cases/fourslash/basicClassMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

goTo.eof();
edit.insert('t.');
verify.memberListContains('x');
verify.memberListContains('y');
verify.not.memberListContains('z');
verify.completionListContains('x');
verify.completionListContains('y');
verify.not.completionListContains('z');
Loading