Use SymbolDisplayParts api

This commit is contained in:
Sheetal Nandi 2014-09-29 09:45:03 -07:00
parent d1a09da676
commit 743046bf45
10 changed files with 625 additions and 933 deletions

View File

@ -45,6 +45,14 @@ module ts {
string(): string;
}
// TODO this should go back in services
export function getSymbolDisplayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart {
return <SymbolDisplayPart> {
text: text,
kind: kind
};
}
/// fullTypeCheck denotes if this instance of the typechecker will be used to get semantic diagnostics.
/// If fullTypeCheck === true, then the typechecker should do every possible check to produce all errors
/// If fullTypeCheck === false, the typechecker can take shortcuts and skip checks that only produce errors.
@ -931,7 +939,7 @@ module ts {
var displayParts: SymbolDisplayPart[] = [];
return {
displayParts: () => displayParts,
writeKind: (text, kind) => displayParts.push(new SymbolDisplayPart(text, kind, undefined)),
writeKind: (text, kind) => displayParts.push(getSymbolDisplayPart(text, kind)),
writeSymbol: (text, symbol) => displayParts.push(symbolPart(text, symbol)),
// Completely ignore indentation for display part writers. And map newlines to
@ -7699,27 +7707,27 @@ module ts {
}
export function spacePart() {
return new SymbolDisplayPart(" ", SymbolDisplayPartKind.space, undefined);
return getSymbolDisplayPart(" ", SymbolDisplayPartKind.space, undefined);
}
export function keywordPart(kind: SyntaxKind) {
return new SymbolDisplayPart(tokenToString(kind), SymbolDisplayPartKind.keyword, undefined);
return getSymbolDisplayPart(tokenToString(kind), SymbolDisplayPartKind.keyword, undefined);
}
export function punctuationPart(kind: SyntaxKind) {
return new SymbolDisplayPart(tokenToString(kind), SymbolDisplayPartKind.punctuation, undefined);
return getSymbolDisplayPart(tokenToString(kind), SymbolDisplayPartKind.punctuation, undefined);
}
export function operatorPart(kind: SyntaxKind) {
return new SymbolDisplayPart(tokenToString(kind), SymbolDisplayPartKind.operator, undefined);
return getSymbolDisplayPart(tokenToString(kind), SymbolDisplayPartKind.operator, undefined);
}
export function textPart(text: string) {
return new SymbolDisplayPart(text, SymbolDisplayPartKind.text, undefined);
return getSymbolDisplayPart(text, SymbolDisplayPartKind.text, undefined);
}
export function symbolPart(text: string, symbol: Symbol) {
return new SymbolDisplayPart(text, displayPartKind(symbol), symbol)
return getSymbolDisplayPart(text, displayPartKind(symbol), symbol)
}
function displayPartKind(symbol: Symbol): SymbolDisplayPartKind {

View File

@ -1190,22 +1190,9 @@ module ts {
verticalTab = 0x0B, // \v
}
export class SymbolDisplayPart {
constructor(public text: string,
public kind: SymbolDisplayPartKind,
public symbol: Symbol) {
}
public toJSON() {
return {
text: this.text,
kind: SymbolDisplayPartKind[this.kind]
};
}
public static toString(parts: SymbolDisplayPart[]) {
return parts.map(p => p.text).join("");
}
export interface SymbolDisplayPart {
text: string;
kind: SymbolDisplayPartKind;
}
export enum SymbolDisplayPartKind {
@ -1215,20 +1202,17 @@ module ts {
fieldName,
interfaceName,
keyword,
labelName,
lineBreak,
numericLiteral,
stringLiteral,
localName,
methodName,
moduleName,
namespaceName,
operator,
parameterName,
propertyName,
punctuation,
space,
anonymousTypeIndicator,
text,
typeParameterName,
enumMemberName,

View File

@ -523,17 +523,17 @@ module FourSlash {
}
}
public verifyMemberListContains(symbol: string, type?: string, docComment?: string, fullSymbolName?: string, kind?: string) {
public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
this.scenarioActions.push('<ShowCompletionList />');
this.scenarioActions.push('<VerifyCompletionContainsItem ItemName="' + symbol + '"/>');
if (type || docComment || fullSymbolName || kind) {
if (text || documentation || kind) {
this.taoInvalidReason = 'verifyMemberListContains only supports the "symbol" parameter';
}
var members = this.getMemberListAtCaret();
if (members) {
this.assertItemInCompletionList(members.entries, symbol, type, docComment, fullSymbolName, kind);
this.assertItemInCompletionList(members.entries, symbol, text, documentation, kind);
}
else {
this.raiseError("Expected a member list, but none was provided");
@ -632,9 +632,9 @@ module FourSlash {
}
}
public verifyCompletionListContains(symbol: string, type?: string, docComment?: string, fullSymbolName?: string, kind?: string) {
public verifyCompletionListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
var completions = this.getCompletionListAtCaret();
this.assertItemInCompletionList(completions.entries, symbol, type, docComment, fullSymbolName, kind);
this.assertItemInCompletionList(completions.entries, symbol, text, documentation, kind);
}
public verifyCompletionListDoesNotContain(symbol: string) {
@ -647,19 +647,15 @@ module FourSlash {
}
}
public verifyCompletionEntryDetails(entryName: string, type: string, docComment?: string, fullSymbolName?: string, kind?: string) {
public verifyCompletionEntryDetails(entryName: string, expectedText: string, expectedDocumentation?: string, kind?: string) {
this.taoInvalidReason = 'verifyCompletionEntryDetails NYI';
var details = this.getCompletionEntryDetails(entryName);
assert.equal(details.type, type);
assert.equal(ts.displayPartsToString(details.displayParts), expectedText);
if (docComment != undefined) {
assert.equal(details.docComment, docComment);
}
if (fullSymbolName !== undefined) {
assert.equal(details.fullSymbolName, fullSymbolName);
if (expectedDocumentation != undefined) {
assert.equal(ts.displayPartsToString(details.documentation), expectedDocumentation);
}
if (kind !== undefined) {
@ -758,49 +754,35 @@ module FourSlash {
return this.languageService.getImplementorsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
}
public verifyQuickInfo(negative: boolean, expectedTypeName?: string, docComment?: string, symbolName?: string, kind?: string) {
[expectedTypeName, docComment, symbolName, kind].forEach(str => {
public verifyQuickInfo(negative: boolean, expectedText?: string, expectedDocumentation?: string) {
[expectedText, expectedDocumentation].forEach(str => {
if (str) {
this.scenarioActions.push('<ShowQuickInfo />');
this.scenarioActions.push('<VerifyQuickInfoTextContains IgnoreSpacing="true" Text="' + escapeXmlAttributeValue(str) + '" ' + (negative ? 'ExpectsFailure="true"' : '') + ' />');
}
});
var actualQuickInfo = this.languageService.getTypeAtPosition(this.activeFile.fileName, this.currentCaretPosition);
var actualQuickInfoMemberName = actualQuickInfo ? actualQuickInfo.memberName.toString() : "";
var actualQuickInfoDocComment = actualQuickInfo ? actualQuickInfo.docComment : "";
var actualQuickInfoSymbolName = actualQuickInfo ? actualQuickInfo.fullSymbolName : "";
var actualQuickInfoKind = actualQuickInfo ? actualQuickInfo.kind : "";
var actualQuickInfo = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, this.currentCaretPosition);
var actualQuickInfoText = actualQuickInfo ? ts.displayPartsToString(actualQuickInfo.displayParts) : "";
var actualQuickInfoDocumentation = actualQuickInfo ? ts.displayPartsToString(actualQuickInfo.documentation) : "";
function assertionMessage(msg: string) {
return "\nMarker: " + currentTestState.lastKnownMarker + "\nChecking: " + msg + "\n\n";
}
if (negative) {
if (expectedTypeName !== undefined) {
assert.notEqual(actualQuickInfoMemberName, expectedTypeName, assertionMessage("quick info member name"));
if (expectedText !== undefined) {
assert.notEqual(actualQuickInfoText, expectedText, assertionMessage("quick info text"));
}
if (docComment != undefined) {
assert.notEqual(actualQuickInfoDocComment, docComment, assertionMessage("quick info doc comment"));
}
if (symbolName !== undefined) {
assert.notEqual(actualQuickInfoSymbolName, symbolName, assertionMessage("quick info symbol name"));
}
if (kind !== undefined) {
assert.notEqual(actualQuickInfoKind, kind, assertionMessage("quick info kind"));
if (expectedDocumentation != undefined) {
assert.notEqual(actualQuickInfoDocumentation, expectedDocumentation, assertionMessage("quick info doc comment"));
}
} else {
if (expectedTypeName !== undefined) {
assert.equal(actualQuickInfoMemberName, expectedTypeName, assertionMessage("quick info member"));
if (expectedText !== undefined) {
assert.equal(actualQuickInfoText, expectedText, assertionMessage("quick info text"));
}
if (docComment != undefined) {
assert.equal(actualQuickInfoDocComment, docComment, assertionMessage("quick info doc"));
}
if (symbolName !== undefined) {
assert.equal(actualQuickInfoSymbolName, symbolName, assertionMessage("quick info symbol name"));
}
if (kind !== undefined) {
assert.equal(actualQuickInfoKind, kind, assertionMessage("quick info kind"));
if (expectedDocumentation != undefined) {
assert.equal(actualQuickInfoDocumentation, expectedDocumentation, assertionMessage("quick info doc"));
}
}
}
@ -808,7 +790,7 @@ module FourSlash {
public verifyQuickInfoExists(negative: number) {
this.taoInvalidReason = 'verifyQuickInfoExists NYI';
var actualQuickInfo = this.languageService.getTypeAtPosition(this.activeFile.fileName, this.currentCaretPosition);
var actualQuickInfo = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, this.currentCaretPosition);
if (negative) {
if (actualQuickInfo) {
this.raiseError('verifyQuickInfoExists failed. Expected quick info NOT to exist');
@ -826,9 +808,9 @@ module FourSlash {
var help = this.getActiveSignatureHelpItem();
assert.equal(
ts.SymbolDisplayPart.toString(help.prefixDisplayParts) +
help.parameters.map(p => ts.SymbolDisplayPart.toString(p.displayParts)).join(ts.SymbolDisplayPart.toString(help.separatorDisplayParts)) +
ts.SymbolDisplayPart.toString(help.suffixDisplayParts), expected);
ts.displayPartsToString(help.prefixDisplayParts) +
help.parameters.map(p => ts.displayPartsToString(p.displayParts)).join(ts.displayPartsToString(help.separatorDisplayParts)) +
ts.displayPartsToString(help.suffixDisplayParts), expected);
}
public verifyCurrentParameterIsVariable(isVariable: boolean) {
@ -852,7 +834,7 @@ module FourSlash {
var activeSignature = this.getActiveSignatureHelpItem();
var activeParameter = this.getActiveParameter();
assert.equal(ts.SymbolDisplayPart.toString(activeParameter.displayParts), parameter);
assert.equal(ts.displayPartsToString(activeParameter.displayParts), parameter);
}
public verifyCurrentParameterHelpDocComment(docComment: string) {
@ -1054,7 +1036,7 @@ module FourSlash {
}
public printCurrentQuickInfo() {
var quickInfo = this.languageService.getTypeAtPosition(this.activeFile.fileName, this.currentCaretPosition);
var quickInfo = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, this.currentCaretPosition);
Harness.IO.log(JSON.stringify(quickInfo));
}
@ -1710,7 +1692,7 @@ module FourSlash {
}
for (i = 0; i < positions.length; i++) {
var nameOf = (type: ts.TypeInfo) => type ? type.fullSymbolName : '(none)';
var nameOf = (type: ts.QuickInfo) => type ? ts.displayPartsToString(type.displayParts) : '(none)';
var pullName: string, refName: string;
var anyFailed = false;
@ -1718,7 +1700,7 @@ module FourSlash {
var errMsg = '';
try {
var pullType = this.languageService.getTypeAtPosition(this.activeFile.fileName, positions[i]);
var pullType = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, positions[i]);
pullName = nameOf(pullType);
} catch (err1) {
errMsg = 'Failed to get pull type check. Exception: ' + err1 + '\r\n';
@ -1728,7 +1710,7 @@ module FourSlash {
}
try {
var referenceType = referenceLanguageService.getTypeAtPosition(this.activeFile.fileName, positions[i]);
var referenceType = referenceLanguageService.getQuickInfoAtPosition(this.activeFile.fileName, positions[i]);
refName = nameOf(referenceType);
} catch (err2) {
errMsg = 'Failed to get full type check. Exception: ' + err2 + '\r\n';
@ -1980,28 +1962,25 @@ module FourSlash {
return result;
}
private assertItemInCompletionList(items: ts.CompletionEntry[], name: string, type?: string, docComment?: string, fullSymbolName?: string, kind?: string) {
private assertItemInCompletionList(items: ts.CompletionEntry[], name: string, text?: string, documentation?: string, kind?: string) {
this.scenarioActions.push('<ShowCompletionList />');
this.scenarioActions.push('<VerifyCompletionContainsItem ItemName="' + name + '"/>');
if (type || docComment || fullSymbolName || kind) {
if (text || documentation || kind) {
this.taoInvalidReason = 'assertItemInCompletionList only supports the "name" parameter';
}
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (item.name == name) {
if (docComment != undefined || type !== undefined || fullSymbolName !== undefined) {
if (documentation != undefined || text !== undefined) {
var details = this.getCompletionEntryDetails(item.name);
if (docComment != undefined) {
assert.equal(details.docComment, docComment);
if (documentation != undefined) {
assert.equal(ts.displayPartsToString(details.documentation), documentation);
}
if (type !== undefined) {
assert.equal(details.type, type);
}
if (fullSymbolName !== undefined) {
assert.equal(details.fullSymbolName, fullSymbolName);
if (text !== undefined) {
assert.equal(ts.displayPartsToString(details.displayParts), text);
}
}
@ -2015,7 +1994,7 @@ module FourSlash {
var itemsString = items.map((item) => JSON.stringify({ name: item.name, kind: item.kind })).join(",\n");
this.raiseError('Expected "' + JSON.stringify({ name: name, type: type, docComment: docComment, fullSymbolName: fullSymbolName, kind: kind }) + '" to be in list [' + itemsString + ']');
this.raiseError('Expected "' + JSON.stringify({ name: name, text: text, documentation: documentation, kind: kind }) + '" to be in list [' + itemsString + ']');
}
private findFile(indexOrName: any) {

View File

@ -12,7 +12,6 @@
/////<reference path='base64.ts' />
/////<reference path='sourceMapping.ts' />
/////<reference path='emitter.ts' />
/////<reference path='types.ts' />
/////<reference path='pathUtils.ts' />
/////<reference path='referenceResolution.ts' />
/////<reference path='precompile.ts' />

View File

@ -1,102 +0,0 @@
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///<reference path='references.ts' />
module TypeScript {
export class MemberName {
public prefix: string = "";
public suffix: string = "";
public isString() { return false; }
public isArray() { return false; }
public isMarker() { return !this.isString() && !this.isArray(); }
public toString(): string {
return MemberName.memberNameToString(this);
}
static memberNameToString(memberName: MemberName, markerInfo?: number[], markerBaseLength: number = 0): string {
var result = memberName.prefix;
if (memberName.isString()) {
result += (<MemberNameString>memberName).text;
}
else if (memberName.isArray()) {
var ar = <MemberNameArray>memberName;
for (var index = 0; index < ar.entries.length; index++) {
if (ar.entries[index].isMarker()) {
if (markerInfo) {
markerInfo.push(markerBaseLength + result.length);
}
continue;
}
result += MemberName.memberNameToString(ar.entries[index], markerInfo, markerBaseLength + result.length);
result += ar.delim;
}
}
result += memberName.suffix;
return result;
}
static create(text: string): MemberName;
static create(entry: MemberName, prefix: string, suffix: string): MemberName;
static create(arg1: any, arg2?: any, arg3?: any): MemberName {
if (typeof arg1 === "string") {
return new MemberNameString(arg1);
}
else {
var result = new MemberNameArray();
if (arg2)
result.prefix = arg2;
if (arg3)
result.suffix = arg3;
result.entries.push(arg1);
return result;
}
}
}
export class MemberNameString extends MemberName {
constructor(public text: string) {
super();
}
public isString() { return true; }
}
export class MemberNameArray extends MemberName {
public delim: string = "";
public entries: MemberName[] = [];
public isArray() { return true; }
public add(entry: MemberName) {
this.entries.push(entry);
}
public addAll(entries: MemberName[]) {
for (var i = 0 ; i < entries.length; i++) {
this.entries.push(entries[i]);
}
}
constructor() {
super();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -85,9 +85,6 @@ module ts {
getQuickInfoAtPosition(fileName: string, position: number): string;
// Obsolete. Use getQuickInfoAtPosition instead.
getTypeAtPosition(fileName: string, position: number): string;
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string;
getBreakpointStatementAtPosition(fileName: string, position: number): string;
@ -577,15 +574,6 @@ module ts {
}
public getTypeAtPosition(fileName: string, position: number): string {
return this.forwardJSONCall(
"getTypeAtPosition('" + fileName + "', " + position + ")",
() => {
var typeInfo = this.languageService.getTypeAtPosition(fileName, position);
return typeInfo;
});
}
/// NAMEORDOTTEDNAMESPAN
/**

View File

@ -273,7 +273,7 @@ module ts.SignatureHelp {
return {
name: p.name,
documentation: getSymbolDocumentationDisplayParts(p),
documentation: p.getDocumentationComment(),
displayParts: displayParts,
isOptional: isOptional
};

View File

@ -203,298 +203,298 @@
////}
goTo.marker('1');
//verify.currentSignatureHelpDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("");
goTo.marker('1q');
verify.quickInfoIs("(): void", "", "simple", "function");
verify.quickInfoIs("(function) simple(): void", "");
goTo.marker('2');
//verify.currentSignatureHelpDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("");
goTo.marker('2q');
verify.quickInfoIs("(): void", "", "multiLine", "function");
verify.quickInfoIs("(function) multiLine(): void", "");
goTo.marker('3');
//verify.currentSignatureHelpDocCommentIs("this is eg of single line jsdoc style comment ");
verify.currentSignatureHelpDocCommentIs("this is eg of single line jsdoc style comment ");
goTo.marker('3q');
verify.quickInfoIs("(): void", "this is eg of single line jsdoc style comment ", "jsDocSingleLine", "function");
verify.quickInfoIs("(function) jsDocSingleLine(): void", "this is eg of single line jsdoc style comment ");
goTo.marker('4');
//verify.currentSignatureHelpDocCommentIs("this is multiple line jsdoc stule comment\nNew line1\nNew Line2");
verify.currentSignatureHelpDocCommentIs("this is multiple line jsdoc stule comment\nNew line1\nNew Line2");
goTo.marker('4q');
verify.quickInfoIs("(): void", "this is multiple line jsdoc stule comment\nNew line1\nNew Line2", "jsDocMultiLine", "function");
verify.quickInfoIs("(function) jsDocMultiLine(): void", "this is multiple line jsdoc stule comment\nNew line1\nNew Line2");
goTo.marker('5');
//verify.currentSignatureHelpDocCommentIs("this is multiple line jsdoc stule comment\nNew line1\nNew Line2\nShoul mege this line as well\nand this too\nAnother this one too");
verify.currentSignatureHelpDocCommentIs("this is multiple line jsdoc stule comment\nNew line1\nNew Line2\nShoul mege this line as well\nand this too\nAnother this one too");
goTo.marker('5q');
verify.quickInfoIs("(): void", "this is multiple line jsdoc stule comment\nNew line1\nNew Line2\nShoul mege this line as well\nand this too\nAnother this one too", "jsDocMultiLineMerge", "function");
verify.quickInfoIs("(function) jsDocMultiLineMerge(): void", "this is multiple line jsdoc stule comment\nNew line1\nNew Line2\nShoul mege this line as well\nand this too\nAnother this one too");
goTo.marker('6');
//verify.currentSignatureHelpDocCommentIs("jsdoc comment ");
verify.currentSignatureHelpDocCommentIs("jsdoc comment ");
goTo.marker('6q');
verify.quickInfoIs("(): void", "jsdoc comment ", "jsDocMixedComments1", "function");
verify.quickInfoIs("(function) jsDocMixedComments1(): void", "jsdoc comment ");
goTo.marker('7');
//verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
goTo.marker('7q');
verify.quickInfoIs("(): void", "jsdoc comment \nanother jsDocComment", "jsDocMixedComments2", "function");
verify.quickInfoIs("(function) jsDocMixedComments2(): void", "jsdoc comment \nanother jsDocComment");
goTo.marker('8');
//verify.currentSignatureHelpDocCommentIs("jsdoc comment \n* another jsDocComment");
verify.currentSignatureHelpDocCommentIs("jsdoc comment \n* another jsDocComment");
goTo.marker('8q');
verify.quickInfoIs("(): void", "jsdoc comment \n* another jsDocComment", "jsDocMixedComments3", "function");
verify.quickInfoIs("(function) jsDocMixedComments3(): void", "jsdoc comment \n* another jsDocComment");
goTo.marker('9');
//verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
goTo.marker('9q');
verify.quickInfoIs("(): void", "jsdoc comment \nanother jsDocComment", "jsDocMixedComments4", "function");
verify.quickInfoIs("(function) jsDocMixedComments4(): void", "jsdoc comment \nanother jsDocComment");
goTo.marker('10');
//verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
verify.currentSignatureHelpDocCommentIs("jsdoc comment \nanother jsDocComment");
goTo.marker('10q');
verify.quickInfoIs("(): void", "jsdoc comment \nanother jsDocComment", "jsDocMixedComments5", "function");
verify.quickInfoIs("(function) jsDocMixedComments5(): void", "jsdoc comment \nanother jsDocComment");
goTo.marker('11');
//verify.currentSignatureHelpDocCommentIs("another jsDocComment\njsdoc comment ");
verify.currentSignatureHelpDocCommentIs("another jsDocComment\njsdoc comment ");
goTo.marker('11q');
verify.quickInfoIs("(): void", "another jsDocComment\njsdoc comment ", "jsDocMixedComments6", "function");
verify.quickInfoIs("(function) jsDocMixedComments6(): void", "another jsDocComment\njsdoc comment ");
goTo.marker('12');
//verify.currentSignatureHelpDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("");
goTo.marker('12q');
verify.quickInfoIs("(): void", "", "noHelpComment1", "function");
verify.quickInfoIs("(function) noHelpComment1(): void", "");
goTo.marker('13');
//verify.currentSignatureHelpDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("");
goTo.marker('13q');
verify.quickInfoIs("(): void", "", "noHelpComment2", "function");
verify.quickInfoIs("(function) noHelpComment2(): void", "");
goTo.marker('14');
//verify.currentSignatureHelpDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("");
goTo.marker('14q');
verify.quickInfoIs("(): void", "", "noHelpComment3", "function");
verify.quickInfoIs("(function) noHelpComment3(): void", "");
goTo.marker('15');
verify.completionListContains("sum", "(a: number, b: number): number", "Adds two integers and returns the result", "sum", "function");
verify.completionListContains("sum", "(function) sum(a: number, b: number): number", "Adds two integers and returns the result");
goTo.marker('16');
//verify.currentSignatureHelpDocCommentIs("Adds two integers and returns the result");
//verify.currentParameterHelpArgumentDocCommentIs("first number");
verify.currentSignatureHelpDocCommentIs("Adds two integers and returns the result");
verify.currentParameterHelpArgumentDocCommentIs("first number");
goTo.marker('16q');
verify.quickInfoIs("(a: number, b: number): number", "Adds two integers and returns the result", "sum", "function");
verify.quickInfoIs("(function) sum(a: number, b: number): number", "Adds two integers and returns the result");
goTo.marker('16aq');
verify.quickInfoIs("number", "first number", "a", "parameter");
verify.quickInfoIs("(parameter) a: number", "first number");
goTo.marker('17');
//verify.currentSignatureHelpDocCommentIs("Adds two integers and returns the result");
//verify.currentParameterHelpArgumentDocCommentIs("second number");
verify.currentSignatureHelpDocCommentIs("Adds two integers and returns the result");
verify.currentParameterHelpArgumentDocCommentIs("second number");
goTo.marker('17aq');
verify.quickInfoIs("number", "second number", "b", "parameter");
verify.quickInfoIs("(parameter) b: number", "second number");
goTo.marker('18');
verify.quickInfoIs("number", "first number", "a", "parameter");
verify.completionListContains("a", "number", "first number", "a", "parameter");
verify.completionListContains("b", "number", "second number", "b", "parameter");
verify.quickInfoIs("(parameter) a: number", "first number");
verify.completionListContains("a", "(parameter) a: number", "first number");
verify.completionListContains("b", "(parameter) b: number", "second number");
goTo.marker('19');
//verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
//verify.currentParameterHelpArgumentDocCommentIs("first number");
verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
verify.currentParameterHelpArgumentDocCommentIs("first number");
goTo.marker('19q');
verify.quickInfoIs("(a: number, b: number, c?: number, d?: any, e?: any): void", "This is multiplication function\n@anotherTag\n@anotherTag", "multiply", "function");
verify.quickInfoIs("(function) multiply(a: number, b: number, c?: number, d?: any, e?: any): void", "This is multiplication function\n@anotherTag\n@anotherTag");
goTo.marker('19aq');
verify.quickInfoIs("number", "first number", "a", "parameter");
verify.quickInfoIs("(parameter) a: number", "first number");
goTo.marker('20');
//verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
//verify.currentParameterHelpArgumentDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('20aq');
verify.quickInfoIs("number", "", "b", "parameter");
verify.quickInfoIs("(parameter) b: number", "");
goTo.marker('21');
//verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
//verify.currentParameterHelpArgumentDocCommentIs("{");
verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
verify.currentParameterHelpArgumentDocCommentIs("{");
goTo.marker('21aq');
verify.quickInfoIs("number", "{", "c", "parameter");
verify.quickInfoIs("(parameter) c: number", "{");
goTo.marker('22');
//verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
//verify.currentParameterHelpArgumentDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('22aq');
verify.quickInfoIs("any", "", "d", "parameter");
verify.quickInfoIs("(parameter) d: any", "");
goTo.marker('23');
//verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
//verify.currentParameterHelpArgumentDocCommentIs("LastParam ");
verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag");
verify.currentParameterHelpArgumentDocCommentIs("LastParam ");
goTo.marker('23aq');
verify.quickInfoIs("any", "LastParam ", "e", "parameter");
verify.quickInfoIs("(parameter) e: any", "LastParam ");
goTo.marker('24');
verify.completionListContains("aOrb", "any", "", "aOrb", "parameter");
verify.completionListContains("opt", "any", "optional parameter", "opt", "parameter");
verify.completionListContains("aOrb", "(parameter) aOrb: any", "");
verify.completionListContains("opt", "(parameter) opt: any", "optional parameter");
goTo.marker('25');
//verify.currentSignatureHelpDocCommentIs("fn f1 with number");
//verify.currentParameterHelpArgumentDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("fn f1 with number");
verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('25q');
// TODO: type name format for the overload
//verify.quickInfoIs("(a: number): any (+ 1 overload(s))", "fn f1 with number", "f1", "function");
verify.quickInfoIs(undefined, "fn f1 with number", "f1", "function");
verify.quickInfoIs(undefined, "fn f1 with number");
goTo.marker('25aq');
verify.quickInfoIs("number", "", "a", "parameter");
verify.quickInfoIs("(parameter) a: number", "");
goTo.marker('26');
//verify.currentSignatureHelpDocCommentIs("");
//verify.currentParameterHelpArgumentDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("");
verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('26q');
// TODO: Selection of correct overload and doc comment only from that overload
//verify.quickInfoIs("(b: string): any (+ 1 overload(s))", "", "f1", "function");
goTo.marker('26aq');
verify.quickInfoIs("string", "", "b", "parameter");
verify.quickInfoIs("(parameter) b: string", "");
goTo.marker('27');
verify.completionListContains("multiply", "(a: number, b: number, c?: number, d?: any, e?: any): void", "This is multiplication function\n@anotherTag\n@anotherTag", "multiply", "function");
verify.completionListContains("multiply", "(function) multiply(a: number, b: number, c?: number, d?: any, e?: any): void", "This is multiplication function\n@anotherTag\n@anotherTag");
// TODO: overload formatting
//verify.completionListContains("f1", "(a: number): any (+ 1 overload(s))", "fn f1 with number", "f1", "function");
verify.completionListContains("f1", undefined, "fn f1 with number", "f1", "function");
verify.completionListContains("f1", undefined, "fn f1 with number");
goTo.marker('28');
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('28q');
verify.quickInfoIs("(a: number, b: number, c?: () => string, d?: () => string, e?: () => string, f?: () => string): void", "This is subtract function", "subtract", "function");
verify.quickInfoIs("(function) subtract(a: number, b: number, c?: () => string, d?: () => string, e?: () => string, f?: () => string): void", "This is subtract function");
goTo.marker('28aq');
verify.quickInfoIs("number", "", "a", "parameter");
verify.quickInfoIs("(parameter) a: number", "");
goTo.marker('29');
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("this is about b");
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("this is about b");
goTo.marker('29aq');
verify.quickInfoIs("number", "this is about b", "b", "parameter");
verify.quickInfoIs("(parameter) b: number", "this is about b");
goTo.marker('30');
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("this is optional param c");
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("this is optional param c");
goTo.marker('30aq');
verify.quickInfoIs("() => string", "this is optional param c", "c", "parameter");
verify.quickInfoIs("(parameter) c: () => string", "this is optional param c");
goTo.marker('31');
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('31aq');
verify.quickInfoIs("() => string", "", "d", "parameter");
verify.quickInfoIs("(parameter) d: () => string", "");
goTo.marker('32');
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("this is optional param e");
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("this is optional param e");
goTo.marker('32aq');
verify.quickInfoIs("() => string", "this is optional param e", "e", "parameter");
verify.quickInfoIs("(parameter) e: () => string", "this is optional param e");
goTo.marker('33');
//verify.currentSignatureHelpDocCommentIs("This is subtract function");
//verify.currentParameterHelpArgumentDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("This is subtract function");
verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('33aq');
verify.quickInfoIs("() => string", "", "f", "parameter");
verify.quickInfoIs("(parameter) f: () => string", "");
goTo.marker('34');
//verify.currentSignatureHelpDocCommentIs("this is square function\n@paramTag { number } a this is input number of paramTag\n@returnType { number } it is return type");
//verify.currentParameterHelpArgumentDocCommentIs("this is input number");
verify.currentSignatureHelpDocCommentIs("this is square function\n@paramTag { number } a this is input number of paramTag\n@returnType { number } it is return type");
verify.currentParameterHelpArgumentDocCommentIs("this is input number");
goTo.marker('34q');
verify.quickInfoIs("(a: number): number", "this is square function\n@paramTag { number } a this is input number of paramTag\n@returnType { number } it is return type", "square", "function");
verify.quickInfoIs("(function) square(a: number): number", "this is square function\n@paramTag { number } a this is input number of paramTag\n@returnType { number } it is return type");
goTo.marker('34aq');
verify.quickInfoIs("number", "this is input number", "a", "parameter");
verify.quickInfoIs("(parameter) a: number", "this is input number");
goTo.marker('35');
//verify.currentSignatureHelpDocCommentIs("this is divide function\n@paramTag { number } g this is optional param g");
//verify.currentParameterHelpArgumentDocCommentIs("this is a");
verify.currentSignatureHelpDocCommentIs("this is divide function\n@paramTag { number } g this is optional param g");
verify.currentParameterHelpArgumentDocCommentIs("this is a");
goTo.marker('35q');
verify.quickInfoIs("(a: number, b: number): void", "this is divide function\n@paramTag { number } g this is optional param g", "divide", "function");
verify.quickInfoIs("(function) divide(a: number, b: number): void", "this is divide function\n@paramTag { number } g this is optional param g");
goTo.marker('35aq');
verify.quickInfoIs("number", "this is a", "a", "parameter");
verify.quickInfoIs("(parameter) a: number", "this is a");
goTo.marker('36');
//verify.currentSignatureHelpDocCommentIs("this is divide function\n@paramTag { number } g this is optional param g");
//verify.currentParameterHelpArgumentDocCommentIs("this is b");
verify.currentSignatureHelpDocCommentIs("this is divide function\n@paramTag { number } g this is optional param g");
verify.currentParameterHelpArgumentDocCommentIs("this is b");
goTo.marker('36aq');
verify.quickInfoIs("number", "this is b", "b", "parameter");
verify.quickInfoIs("(parameter) b: number", "this is b");
goTo.marker('37');
//verify.currentSignatureHelpDocCommentIs("Function returns string concat of foo and bar");
//verify.currentParameterHelpArgumentDocCommentIs("is string");
verify.currentSignatureHelpDocCommentIs("Function returns string concat of foo and bar");
verify.currentParameterHelpArgumentDocCommentIs("is string");
goTo.marker('37q');
verify.quickInfoIs("(foo: string, bar: string): string", "Function returns string concat of foo and bar", "fooBar", "function");
verify.quickInfoIs("(function) fooBar(foo: string, bar: string): string", "Function returns string concat of foo and bar");
goTo.marker('37aq');
verify.quickInfoIs("string", "is string", "foo", "parameter");
verify.quickInfoIs("(parameter) foo: string", "is string");
goTo.marker('38');
//verify.currentSignatureHelpDocCommentIs("Function returns string concat of foo and bar");
//verify.currentParameterHelpArgumentDocCommentIs("is second string");
verify.currentSignatureHelpDocCommentIs("Function returns string concat of foo and bar");
verify.currentParameterHelpArgumentDocCommentIs("is second string");
goTo.marker('38aq');
verify.quickInfoIs("string", "is second string", "bar", "parameter");
verify.quickInfoIs("(parameter) bar: string", "is second string");
goTo.marker('39');
verify.completionListContains("a", "number", "it is first parameter\nthis is inline comment for a ", "a", "parameter");
verify.completionListContains("b", "number", "this is inline comment for b", "b", "parameter");
verify.completionListContains("c", "number", "it is third parameter", "c", "parameter");
verify.completionListContains("d", "number", "", "d", "parameter");
verify.completionListContains("a", "(parameter) a: number", "it is first parameter\nthis is inline comment for a ");
verify.completionListContains("b", "(parameter) b: number", "this is inline comment for b");
verify.completionListContains("c", "(parameter) c: number", "it is third parameter");
verify.completionListContains("d", "(parameter) d: number", "");
goTo.marker('40');
//verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
//verify.currentParameterHelpArgumentDocCommentIs("it is first parameter\nthis is inline comment for a ");
verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
verify.currentParameterHelpArgumentDocCommentIs("it is first parameter\nthis is inline comment for a ");
goTo.marker('40q');
verify.quickInfoIs("(a: number, b: number, c: number, d: number): number", "this is jsdoc style function with param tag as well as inline parameter help", "jsDocParamTest", "function");
verify.quickInfoIs("(function) jsDocParamTest(a: number, b: number, c: number, d: number): number", "this is jsdoc style function with param tag as well as inline parameter help");
goTo.marker('40aq');
verify.quickInfoIs("number", "it is first parameter\nthis is inline comment for a ", "a", "parameter");
verify.quickInfoIs("(parameter) a: number", "it is first parameter\nthis is inline comment for a ");
goTo.marker('41');
//verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
//verify.currentParameterHelpArgumentDocCommentIs("this is inline comment for b");
verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
verify.currentParameterHelpArgumentDocCommentIs("this is inline comment for b");
goTo.marker('41aq');
verify.quickInfoIs("number", "this is inline comment for b", "b", "parameter");
verify.quickInfoIs("(parameter) b: number", "this is inline comment for b");
goTo.marker('42');
//verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
//verify.currentParameterHelpArgumentDocCommentIs("it is third parameter");
verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
verify.currentParameterHelpArgumentDocCommentIs("it is third parameter");
goTo.marker('42aq');
verify.quickInfoIs("number", "it is third parameter", "c", "parameter");
verify.quickInfoIs("(parameter) c: number", "it is third parameter");
goTo.marker('43');
//verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
//verify.currentParameterHelpArgumentDocCommentIs("");
verify.currentSignatureHelpDocCommentIs("this is jsdoc style function with param tag as well as inline parameter help");
verify.currentParameterHelpArgumentDocCommentIs("");
goTo.marker('43aq');
verify.quickInfoIs("number", "", "d", "parameter");
verify.quickInfoIs("(parameter) d: number", "");
goTo.marker('44');
verify.completionListContains("jsDocParamTest", "(a: number, b: number, c: number, d: number): number", "this is jsdoc style function with param tag as well as inline parameter help", "jsDocParamTest", "function");
verify.completionListContains("x", "any", "This is a comment ", "x", "var");
verify.completionListContains("y", "any", "This is a comment ", "y", "var");
verify.completionListContains("jsDocParamTest", "(function) jsDocParamTest(a: number, b: number, c: number, d: number): number", "this is jsdoc style function with param tag as well as inline parameter help");
verify.completionListContains("x", "(var) x: any", "This is a comment ");
verify.completionListContains("y", "(var) y: any", "This is a comment ");
goTo.marker('45');
//verify.currentSignatureHelpDocCommentIs("This is function comment\nAnd properly aligned comment ");
verify.currentSignatureHelpDocCommentIs("This is function comment\nAnd properly aligned comment ");
goTo.marker('45q');
verify.quickInfoIs("(): void", "This is function comment\nAnd properly aligned comment ", "jsDocCommentAlignmentTest1", "function");
verify.quickInfoIs("(function) jsDocCommentAlignmentTest1(): void", "This is function comment\nAnd properly aligned comment ");
goTo.marker('46');
//verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
goTo.marker('46q');
verify.quickInfoIs("(): void", "This is function comment\n And aligned with 4 space char margin", "jsDocCommentAlignmentTest2", "function");
verify.quickInfoIs("(function) jsDocCommentAlignmentTest2(): void", "This is function comment\n And aligned with 4 space char margin");
goTo.marker('47');
//verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
//verify.currentParameterHelpArgumentDocCommentIs("this is info about a\nspanning on two lines and aligned perfectly");
verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
verify.currentParameterHelpArgumentDocCommentIs("this is info about a\nspanning on two lines and aligned perfectly");
goTo.marker('47q');
verify.quickInfoIs("(a: string, b: any, c: any): void", "This is function comment\n And aligned with 4 space char margin", "jsDocCommentAlignmentTest3", "function");
verify.quickInfoIs("(function) jsDocCommentAlignmentTest3(a: string, b: any, c: any): void", "This is function comment\n And aligned with 4 space char margin");
goTo.marker('47aq');
verify.quickInfoIs("string", "this is info about a\nspanning on two lines and aligned perfectly", "a", "parameter");
verify.quickInfoIs("(parameter) a: string", "this is info about a\nspanning on two lines and aligned perfectly");
goTo.marker('48');
//verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
//verify.currentParameterHelpArgumentDocCommentIs("this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin");
verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
verify.currentParameterHelpArgumentDocCommentIs("this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin");
goTo.marker('48aq');
verify.quickInfoIs("any", "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin", "b", "parameter");
verify.quickInfoIs("(parameter) b: any", "this is info about b\nspanning on two lines and aligned perfectly\nspanning one more line alined perfectly\n spanning another line with more margin");
goTo.marker('49');
//verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
//verify.currentParameterHelpArgumentDocCommentIs("this is info about b\nnot aligned text about parameter will eat only one space");
verify.currentSignatureHelpDocCommentIs("This is function comment\n And aligned with 4 space char margin");
verify.currentParameterHelpArgumentDocCommentIs("this is info about b\nnot aligned text about parameter will eat only one space");
goTo.marker('49aq');
verify.quickInfoIs("any", "this is info about b\nnot aligned text about parameter will eat only one space", "c", "parameter");
verify.quickInfoIs("(parameter) c: any", "this is info about b\nnot aligned text about parameter will eat only one space");
goTo.marker('50');
verify.quickInfoIs(undefined, "", "NoQuickInfoClass", "class");
verify.quickInfoIs("class NoQuickInfoClass", "");

View File

@ -153,11 +153,11 @@ module FourSlashInterface {
// Verifies the member list contains the specified symbol. The
// member list is brought up if necessary
public memberListContains(symbol: string, type?: string, docComment?: string, fullSymbolName?: string, kind?: string) {
public memberListContains(symbol: string, text?: string, documenation?: string, kind?: string) {
if (this.negative) {
FourSlash.currentTestState.verifyMemberListDoesNotContain(symbol);
} else {
FourSlash.currentTestState.verifyMemberListContains(symbol, type, docComment, fullSymbolName, kind);
FourSlash.currentTestState.verifyMemberListContains(symbol, text, documenation, kind);
}
}
@ -167,11 +167,11 @@ module FourSlashInterface {
// Verifies the completion list contains the specified symbol. The
// completion list is brought up if necessary
public completionListContains(symbol: string, type?: string, docComment?: string, fullSymbolName?: string, kind?: string) {
public completionListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
if (this.negative) {
FourSlash.currentTestState.verifyCompletionListDoesNotContain(symbol);
} else {
FourSlash.currentTestState.verifyCompletionListContains(symbol, type, docComment, fullSymbolName, kind);
FourSlash.currentTestState.verifyCompletionListContains(symbol, text, documentation, kind);
}
}
@ -222,12 +222,12 @@ module FourSlashInterface {
FourSlash.currentTestState.verifyErrorExistsAfterMarker(markerName, !this.negative, false);
}
public quickInfoIs(typeName?: string, docComment?: string, symbolName?: string, kind?: string) {
FourSlash.currentTestState.verifyQuickInfo(this.negative, typeName, docComment, symbolName, kind);
public quickInfoIs(expectedText?: string, expectedDocumentation?: string) {
FourSlash.currentTestState.verifyQuickInfo(this.negative, expectedText, expectedDocumentation);
}
public quickInfoSymbolNameIs(symbolName) {
FourSlash.currentTestState.verifyQuickInfo(this.negative, undefined, undefined, symbolName, undefined);
public quickInfoSymbolNameIs(expectedSymbolInfo: string) {
FourSlash.currentTestState.verifyQuickInfo(this.negative, expectedSymbolInfo);
}
public quickInfoExists() {
@ -394,8 +394,8 @@ module FourSlashInterface {
FourSlash.currentTestState.verifyOccurrencesAtPositionListCount(expectedCount);
}
public completionEntryDetailIs(entryName: string, type: string, docComment?: string, fullSymbolName?: string, kind?: string) {
FourSlash.currentTestState.verifyCompletionEntryDetails(entryName, type, docComment, fullSymbolName, kind);
public completionEntryDetailIs(entryName: string, text: string, documentation?: string, kind?: string) {
FourSlash.currentTestState.verifyCompletionEntryDetails(entryName, text, documentation, kind);
}
public syntacticClassificationsAre(...classifications: { classificationType: string; text: string }[]) {