Always test replacementSpan, and don't provide if it would just be an identifier (#22918)

This commit is contained in:
Andy authored and GitHub committed 2018-03-27 15:15:50 -07:00
1 parent 0a2c160dd1
commit 6ef4d7774a
20 files changed
+152 -258

No files matched your search

+8 -5
View File
@@ -832,7 +832,12 @@ namespace FourSlash {
}
}
public verifyCompletionsAt(markerName: string, expected: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntry>, options?: FourSlashInterface.CompletionsAtOptions) {
public verifyCompletionsAt(markerName: string | ReadonlyArray<string>, expected: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntry>, options?: FourSlashInterface.CompletionsAtOptions) {
if (typeof markerName !== "string") {
for (const m of markerName) this.verifyCompletionsAt(m, expected, options);
return;
}
this.goToMarker(markerName);
const actualCompletions = this.getCompletionListAtCaret(options);
@@ -3182,9 +3187,7 @@ Actual: ${stringify(fullActual)}`);
eq(item.hasAction, hasAction, "hasAction");
eq(item.isRecommended, options && options.isRecommended, "isRecommended");
eq(item.insertText, options && options.insertText, "insertText");
if (options && options.replacementSpan) { // TODO: GH#21679
eq(item.replacementSpan, options && options.replacementSpan && ts.createTextSpanFromRange(options.replacementSpan), "replacementSpan");
}
eq(item.replacementSpan, options && options.replacementSpan && ts.createTextSpanFromRange(options.replacementSpan), "replacementSpan");
}
private findFile(indexOrName: string | number) {
@@ -3988,7 +3991,7 @@ namespace FourSlashInterface {
super(state);
}
public completionsAt(markerName: string, completions: ReadonlyArray<ExpectedCompletionEntry>, options?: CompletionsAtOptions) {
public completionsAt(markerName: string | ReadonlyArray<string>, completions: ReadonlyArray<ExpectedCompletionEntry>, options?: CompletionsAtOptions) {
this.state.verifyCompletionsAt(markerName, completions, options);
}