Overload formatting in the symbol displaying
This commit is contained in:
parent
c450d8d392
commit
df423369f1
|
@ -99,7 +99,10 @@ module ts {
|
|||
getFullyQualifiedName: getFullyQualifiedName,
|
||||
getResolvedSignature: getResolvedSignature,
|
||||
getEnumMemberValue: getEnumMemberValue,
|
||||
isValidPropertyAccess: isValidPropertyAccess
|
||||
isValidPropertyAccess: isValidPropertyAccess,
|
||||
getSignatureFromDeclaration: getSignatureFromDeclaration,
|
||||
writeSignature: writeSignature,
|
||||
isImplementationOfOverload: isImplementationOfOverload
|
||||
};
|
||||
|
||||
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
|
||||
|
@ -1055,11 +1058,10 @@ module ts {
|
|||
return result;
|
||||
}
|
||||
|
||||
function writeType(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) {
|
||||
var typeStack: Type[];
|
||||
return writeType(type, /*allowFunctionOrConstructorTypeLiteral*/ true);
|
||||
function writeType(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) {
|
||||
return writeType(type, flags | TypeFormatFlags.WriteArrowStyleSignature);
|
||||
|
||||
function writeType(type: Type, allowFunctionOrConstructorTypeLiteral: boolean) {
|
||||
function writeType(type: Type, flags: TypeFormatFlags) {
|
||||
if (type.flags & TypeFlags.Intrinsic) {
|
||||
writer.writeKind((<IntrinsicType>type).intrinsicName, SymbolDisplayPartKind.keyword);
|
||||
}
|
||||
|
@ -1073,7 +1075,7 @@ module ts {
|
|||
writeTupleType(<TupleType>type);
|
||||
}
|
||||
else if (type.flags & TypeFlags.Anonymous) {
|
||||
writeAnonymousType(<ObjectType>type, allowFunctionOrConstructorTypeLiteral);
|
||||
writeAnonymousType(<ObjectType>type, flags);
|
||||
}
|
||||
else if (type.flags & TypeFlags.StringLiteral) {
|
||||
writer.writeKind((<StringLiteralType>type).text, SymbolDisplayPartKind.stringLiteral);
|
||||
|
@ -1095,7 +1097,7 @@ module ts {
|
|||
writePunctuation(writer, SyntaxKind.CommaToken);
|
||||
writeSpace(writer);
|
||||
}
|
||||
writeType(types[i], /*allowFunctionOrConstructorTypeLiteral*/ true);
|
||||
writeType(types[i], flags | TypeFormatFlags.WriteArrowStyleSignature);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1103,7 +1105,7 @@ module ts {
|
|||
if (type.target === globalArrayType && !(flags & TypeFormatFlags.WriteArrayAsGenericType)) {
|
||||
// If we are writing array element type the arrow style signatures are not allowed as
|
||||
// we need to surround it by curlies, e.g. { (): T; }[]; as () => T[] would mean something different
|
||||
writeType(type.typeArguments[0], /*allowFunctionOrConstructorTypeLiteral*/ false);
|
||||
writeType(type.typeArguments[0], flags & ~TypeFormatFlags.WriteArrowStyleSignature);
|
||||
writePunctuation(writer, SyntaxKind.OpenBracketToken);
|
||||
writePunctuation(writer, SyntaxKind.CloseBracketToken);
|
||||
}
|
||||
|
@ -1121,7 +1123,7 @@ module ts {
|
|||
writePunctuation(writer, SyntaxKind.CloseBracketToken);
|
||||
}
|
||||
|
||||
function writeAnonymousType(type: ObjectType, allowFunctionOrConstructorTypeLiteral: boolean) {
|
||||
function writeAnonymousType(type: ObjectType, flags: TypeFormatFlags) {
|
||||
// Always use 'typeof T' for type of class, enum, and module objects
|
||||
if (type.symbol && type.symbol.flags & (SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule)) {
|
||||
writeTypeofSymbol(type);
|
||||
|
@ -1139,7 +1141,7 @@ module ts {
|
|||
typeStack = [];
|
||||
}
|
||||
typeStack.push(type);
|
||||
writeLiteralType(type, allowFunctionOrConstructorTypeLiteral);
|
||||
writeLiteralType(type, flags);
|
||||
typeStack.pop();
|
||||
}
|
||||
|
||||
|
@ -1167,7 +1169,7 @@ module ts {
|
|||
writeSymbol(type.symbol, writer, enclosingDeclaration, SymbolFlags.Value);
|
||||
}
|
||||
|
||||
function writeLiteralType(type: ObjectType, allowFunctionOrConstructorTypeLiteral: boolean) {
|
||||
function writeLiteralType(type: ObjectType, flags: TypeFormatFlags) {
|
||||
var resolved = resolveObjectTypeMembers(type);
|
||||
if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) {
|
||||
if (!resolved.callSignatures.length && !resolved.constructSignatures.length) {
|
||||
|
@ -1176,15 +1178,15 @@ module ts {
|
|||
return;
|
||||
}
|
||||
|
||||
if (allowFunctionOrConstructorTypeLiteral) {
|
||||
if (flags & TypeFormatFlags.WriteArrowStyleSignature) {
|
||||
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
|
||||
writeSignature(resolved.callSignatures[0], shouldTypeBeAllowStyleTypeLiteral());
|
||||
writeSignature(resolved.callSignatures[0], writer, enclosingDeclaration, flags, typeStack);
|
||||
return;
|
||||
}
|
||||
if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
|
||||
writeKeyword(writer, SyntaxKind.NewKeyword);
|
||||
writeSpace(writer);
|
||||
writeSignature(resolved.constructSignatures[0], shouldTypeBeAllowStyleTypeLiteral());
|
||||
writeSignature(resolved.constructSignatures[0], writer, enclosingDeclaration, flags, typeStack);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1194,7 +1196,7 @@ module ts {
|
|||
writer.writeLine();
|
||||
writer.increaseIndent();
|
||||
for (var i = 0; i < resolved.callSignatures.length; i++) {
|
||||
writeSignature(resolved.callSignatures[i]);
|
||||
writeSignature(resolved.callSignatures[i], writer, enclosingDeclaration, flags & ~TypeFormatFlags.WriteArrowStyleSignature, typeStack);
|
||||
writePunctuation(writer, SyntaxKind.SemicolonToken);
|
||||
writer.writeLine();
|
||||
}
|
||||
|
@ -1202,7 +1204,7 @@ module ts {
|
|||
writeKeyword(writer, SyntaxKind.NewKeyword);
|
||||
writeSpace(writer);
|
||||
|
||||
writeSignature(resolved.constructSignatures[i]);
|
||||
writeSignature(resolved.constructSignatures[i], writer, enclosingDeclaration, flags & ~TypeFormatFlags.WriteArrowStyleSignature, typeStack);
|
||||
writePunctuation(writer, SyntaxKind.SemicolonToken);
|
||||
writer.writeLine();
|
||||
}
|
||||
|
@ -1216,7 +1218,7 @@ module ts {
|
|||
writePunctuation(writer, SyntaxKind.CloseBracketToken);
|
||||
writePunctuation(writer, SyntaxKind.ColonToken);
|
||||
writeSpace(writer);
|
||||
writeType(resolved.stringIndexType, /*allowFunctionOrConstructorTypeLiteral*/ true);
|
||||
writeType(resolved.stringIndexType, flags | TypeFormatFlags.WriteArrowStyleSignature);
|
||||
writePunctuation(writer, SyntaxKind.SemicolonToken);
|
||||
writer.writeLine();
|
||||
}
|
||||
|
@ -1230,7 +1232,7 @@ module ts {
|
|||
writePunctuation(writer, SyntaxKind.CloseBracketToken);
|
||||
writePunctuation(writer, SyntaxKind.ColonToken);
|
||||
writeSpace(writer);
|
||||
writeType(resolved.numberIndexType, /*allowFunctionOrConstructorTypeLiteral*/ true);
|
||||
writeType(resolved.numberIndexType, flags | TypeFormatFlags.WriteArrowStyleSignature);
|
||||
writePunctuation(writer, SyntaxKind.SemicolonToken);
|
||||
writer.writeLine();
|
||||
}
|
||||
|
@ -1244,7 +1246,7 @@ module ts {
|
|||
if (isOptionalProperty(p)) {
|
||||
writePunctuation(writer, SyntaxKind.QuestionToken);
|
||||
}
|
||||
writeSignature(signatures[j]);
|
||||
writeSignature(signatures[j], writer, enclosingDeclaration, flags & ~TypeFormatFlags.WriteArrowStyleSignature, typeStack);
|
||||
writePunctuation(writer, SyntaxKind.SemicolonToken);
|
||||
writer.writeLine();
|
||||
}
|
||||
|
@ -1256,72 +1258,67 @@ module ts {
|
|||
}
|
||||
writePunctuation(writer, SyntaxKind.ColonToken);
|
||||
writeSpace(writer);
|
||||
writeType(t, /*allowFunctionOrConstructorTypeLiteral*/ true);
|
||||
writeType(t, flags | TypeFormatFlags.WriteArrowStyleSignature);
|
||||
writePunctuation(writer, SyntaxKind.SemicolonToken);
|
||||
writer.writeLine();
|
||||
}
|
||||
}
|
||||
writer.decreaseIndent();
|
||||
writePunctuation(writer, SyntaxKind.CloseBraceToken);
|
||||
|
||||
function shouldTypeBeAllowStyleTypeLiteral() {
|
||||
return !typeStack || typeStack.length !== 1 || typeStack[0] !== type || // If this is not a top level type we are writing, arrowStyle is ok
|
||||
!(flags & TypeFormatFlags.NoArrowStyleTopLevelSignature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function writeSignature(signature: Signature, arrowStyle?: boolean) {
|
||||
if (signature.typeParameters) {
|
||||
writePunctuation(writer, SyntaxKind.LessThanToken);
|
||||
for (var i = 0; i < signature.typeParameters.length; i++) {
|
||||
if (i > 0) {
|
||||
writePunctuation(writer, SyntaxKind.CommaToken);
|
||||
writeSpace(writer);
|
||||
}
|
||||
var tp = signature.typeParameters[i];
|
||||
writeSymbol(tp.symbol, writer);
|
||||
var constraint = getConstraintOfTypeParameter(tp);
|
||||
if (constraint) {
|
||||
writeSpace(writer);
|
||||
writeKeyword(writer, SyntaxKind.ExtendsKeyword);
|
||||
writeSpace(writer);
|
||||
writeType(constraint, /*allowFunctionOrConstructorTypeLiteral*/ true);
|
||||
}
|
||||
}
|
||||
writePunctuation(writer, SyntaxKind.GreaterThanToken);
|
||||
}
|
||||
writePunctuation(writer, SyntaxKind.OpenParenToken);
|
||||
for (var i = 0; i < signature.parameters.length; i++) {
|
||||
function writeSignature(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) {
|
||||
if (signature.typeParameters) {
|
||||
writePunctuation(writer, SyntaxKind.LessThanToken);
|
||||
for (var i = 0; i < signature.typeParameters.length; i++) {
|
||||
if (i > 0) {
|
||||
writePunctuation(writer, SyntaxKind.CommaToken);
|
||||
writeSpace(writer);
|
||||
}
|
||||
var p = signature.parameters[i];
|
||||
if (getDeclarationFlagsFromSymbol(p) & NodeFlags.Rest) {
|
||||
writePunctuation(writer, SyntaxKind.DotDotDotToken);
|
||||
var tp = signature.typeParameters[i];
|
||||
writeSymbol(tp.symbol, writer);
|
||||
var constraint = getConstraintOfTypeParameter(tp);
|
||||
if (constraint) {
|
||||
writeSpace(writer);
|
||||
writeKeyword(writer, SyntaxKind.ExtendsKeyword);
|
||||
writeSpace(writer);
|
||||
writeType(constraint, writer, enclosingDeclaration, flags, typeStack);
|
||||
}
|
||||
writeSymbol(p, writer);
|
||||
if (p.valueDeclaration.flags & NodeFlags.QuestionMark || (<VariableDeclaration>p.valueDeclaration).initializer) {
|
||||
writePunctuation(writer, SyntaxKind.QuestionToken);
|
||||
}
|
||||
writePunctuation(writer, SyntaxKind.ColonToken);
|
||||
}
|
||||
writePunctuation(writer, SyntaxKind.GreaterThanToken);
|
||||
}
|
||||
writePunctuation(writer, SyntaxKind.OpenParenToken);
|
||||
for (var i = 0; i < signature.parameters.length; i++) {
|
||||
if (i > 0) {
|
||||
writePunctuation(writer, SyntaxKind.CommaToken);
|
||||
writeSpace(writer);
|
||||
|
||||
writeType(getTypeOfSymbol(p), /*allowFunctionOrConstructorTypeLiteral*/ true);
|
||||
}
|
||||
|
||||
writePunctuation(writer, SyntaxKind.CloseParenToken);
|
||||
if (arrowStyle) {
|
||||
writeSpace(writer);
|
||||
writePunctuation(writer, SyntaxKind.EqualsGreaterThanToken);
|
||||
var p = signature.parameters[i];
|
||||
if (getDeclarationFlagsFromSymbol(p) & NodeFlags.Rest) {
|
||||
writePunctuation(writer, SyntaxKind.DotDotDotToken);
|
||||
}
|
||||
else {
|
||||
writePunctuation(writer, SyntaxKind.ColonToken);
|
||||
writeSymbol(p, writer);
|
||||
if (p.valueDeclaration.flags & NodeFlags.QuestionMark || (<VariableDeclaration>p.valueDeclaration).initializer) {
|
||||
writePunctuation(writer, SyntaxKind.QuestionToken);
|
||||
}
|
||||
writePunctuation(writer, SyntaxKind.ColonToken);
|
||||
writeSpace(writer);
|
||||
|
||||
writeType(getReturnTypeOfSignature(signature), /*allowFunctionOrConstructorTypeLiteral*/ true);
|
||||
writeType(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, typeStack);
|
||||
}
|
||||
|
||||
writePunctuation(writer, SyntaxKind.CloseParenToken);
|
||||
if (flags & TypeFormatFlags.WriteArrowStyleSignature) {
|
||||
writeSpace(writer);
|
||||
writePunctuation(writer, SyntaxKind.EqualsGreaterThanToken);
|
||||
}
|
||||
else {
|
||||
writePunctuation(writer, SyntaxKind.ColonToken);
|
||||
}
|
||||
writeSpace(writer);
|
||||
|
||||
writeType(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags, typeStack);
|
||||
}
|
||||
|
||||
function isDeclarationVisible(node: Declaration): boolean {
|
||||
|
|
|
@ -651,6 +651,9 @@ module ts {
|
|||
getRootSymbol(symbol: Symbol): Symbol;
|
||||
getContextualType(node: Node): Type;
|
||||
getResolvedSignature(node: CallExpression, candidatesOutArray?: Signature[]): Signature;
|
||||
getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature;
|
||||
writeSignature(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
isImplementationOfOverload(node: FunctionDeclaration): boolean;
|
||||
|
||||
// Returns the constant value of this enum member, or 'undefined' if the enum member has a
|
||||
// computed value.
|
||||
|
@ -678,7 +681,7 @@ module ts {
|
|||
WriteArrayAsGenericType = 0x00000001, // Write Array<T> instead T[]
|
||||
UseTypeOfFunction = 0x00000002, // Write typeof instead of function type literal
|
||||
NoTruncation = 0x00000004, // Don't truncate typeToString result
|
||||
NoArrowStyleTopLevelSignature = 0x00000008, // Do not write type global top level function or constructor literal
|
||||
WriteArrowStyleSignature= 0x00000008, // Write arrow style signature
|
||||
}
|
||||
|
||||
export enum SymbolAccessibility {
|
||||
|
|
|
@ -1970,6 +1970,10 @@ module FourSlash {
|
|||
this.taoInvalidReason = 'assertItemInCompletionList only supports the "name" parameter';
|
||||
}
|
||||
|
||||
function assertionMessage(msg: string) {
|
||||
return "\nMarker: " + currentTestState.lastKnownMarker + "\nChecking: " + msg + "\n\n";
|
||||
}
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var item = items[i];
|
||||
if (item.name == name) {
|
||||
|
@ -1977,15 +1981,15 @@ module FourSlash {
|
|||
var details = this.getCompletionEntryDetails(item.name);
|
||||
|
||||
if (documentation != undefined) {
|
||||
assert.equal(ts.displayPartsToString(details.documentation), documentation);
|
||||
assert.equal(ts.displayPartsToString(details.documentation), documentation, assertionMessage("completion item documentation"));
|
||||
}
|
||||
if (text !== undefined) {
|
||||
assert.equal(ts.displayPartsToString(details.displayParts), text);
|
||||
assert.equal(ts.displayPartsToString(details.displayParts), text, assertionMessage("completion item detail text"));
|
||||
}
|
||||
}
|
||||
|
||||
if (kind !== undefined) {
|
||||
assert.equal(item.kind, kind);
|
||||
assert.equal(item.kind, kind, assertionMessage("completion item kind"));
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -66,6 +66,7 @@ module ts {
|
|||
getTypeParameters(): Type[];
|
||||
getParameters(): Symbol[];
|
||||
getReturnType(): Type;
|
||||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
}
|
||||
|
||||
export interface SourceFile {
|
||||
|
@ -248,287 +249,293 @@ module ts {
|
|||
|
||||
getDocumentationComment(): SymbolDisplayPart[] {
|
||||
if (this.documentationComment === undefined) {
|
||||
this.documentationComment = [];
|
||||
var docComments = getJsDocCommentsSeparatedByNewLines(this);
|
||||
ts.forEach(docComments, docComment => {
|
||||
if (this.documentationComment.length) {
|
||||
this.documentationComment.push(lineBreakPart());
|
||||
}
|
||||
this.documentationComment.push(docComment);
|
||||
});
|
||||
this.documentationComment = getJsDocCommentsFromDeclarations(this.declarations, this.name);
|
||||
}
|
||||
|
||||
return this.documentationComment;
|
||||
}
|
||||
}
|
||||
|
||||
function getJsDocCommentsSeparatedByNewLines(symbol: Symbol) {
|
||||
var paramTag = "@param";
|
||||
var jsDocCommentParts: SymbolDisplayPart[] = [];
|
||||
function getJsDocCommentsFromDeclarations(declarations: Declaration[], name: string) {
|
||||
var documentationComment = <SymbolDisplayPart[]>[];
|
||||
var docComments = getJsDocCommentsSeparatedByNewLines();
|
||||
ts.forEach(docComments, docComment => {
|
||||
if (documentationComment.length) {
|
||||
documentationComment.push(lineBreakPart());
|
||||
}
|
||||
documentationComment.push(docComment);
|
||||
});
|
||||
|
||||
ts.forEach(symbol.declarations, declaration => {
|
||||
var sourceFileOfDeclaration = getSourceFileOfNode(declaration);
|
||||
// If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments
|
||||
if (declaration.kind === SyntaxKind.Parameter) {
|
||||
ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), jsDocCommentTextRange => {
|
||||
var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration);
|
||||
if (cleanedParamJsDocComment) {
|
||||
jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment);
|
||||
}
|
||||
});
|
||||
}
|
||||
return documentationComment;
|
||||
|
||||
// Get the cleaned js doc comment text from the declaration
|
||||
ts.forEach(getJsDocCommentTextRange(
|
||||
declaration.kind === SyntaxKind.VariableDeclaration ? declaration.parent : declaration, sourceFileOfDeclaration), jsDocCommentTextRange => {
|
||||
var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration);
|
||||
if (cleanedJsDocComment) {
|
||||
jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment);
|
||||
}
|
||||
});
|
||||
});
|
||||
function getJsDocCommentsSeparatedByNewLines() {
|
||||
var paramTag = "@param";
|
||||
var jsDocCommentParts: SymbolDisplayPart[] = [];
|
||||
|
||||
return jsDocCommentParts;
|
||||
|
||||
function getJsDocCommentTextRange(node: Node, sourceFile: SourceFile): TextRange[] {
|
||||
return ts.map(getJsDocComments(node, sourceFile),
|
||||
jsDocComment => {
|
||||
return {
|
||||
pos: jsDocComment.pos + "/*".length, // Consume /* from the comment
|
||||
end: jsDocComment.end - "*/".length // Trim off comment end indicator
|
||||
};
|
||||
});
|
||||
ts.forEach(declarations, declaration => {
|
||||
var sourceFileOfDeclaration = getSourceFileOfNode(declaration);
|
||||
// If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments
|
||||
if (declaration.kind === SyntaxKind.Parameter) {
|
||||
ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), jsDocCommentTextRange => {
|
||||
var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration);
|
||||
if (cleanedParamJsDocComment) {
|
||||
jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function consumeWhiteSpacesOnTheLine(pos: number, end: number, sourceFile: SourceFile, maxSpacesToRemove?: number) {
|
||||
if (maxSpacesToRemove !== undefined) {
|
||||
end = Math.min(end, pos + maxSpacesToRemove);
|
||||
// Get the cleaned js doc comment text from the declaration
|
||||
ts.forEach(getJsDocCommentTextRange(
|
||||
declaration.kind === SyntaxKind.VariableDeclaration ? declaration.parent : declaration, sourceFileOfDeclaration), jsDocCommentTextRange => {
|
||||
var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration);
|
||||
if (cleanedJsDocComment) {
|
||||
jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return jsDocCommentParts;
|
||||
|
||||
function getJsDocCommentTextRange(node: Node, sourceFile: SourceFile): TextRange[] {
|
||||
return ts.map(getJsDocComments(node, sourceFile),
|
||||
jsDocComment => {
|
||||
return {
|
||||
pos: jsDocComment.pos + "/*".length, // Consume /* from the comment
|
||||
end: jsDocComment.end - "*/".length // Trim off comment end indicator
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function consumeWhiteSpacesOnTheLine(pos: number, end: number, sourceFile: SourceFile, maxSpacesToRemove?: number) {
|
||||
if (maxSpacesToRemove !== undefined) {
|
||||
end = Math.min(end, pos + maxSpacesToRemove);
|
||||
}
|
||||
|
||||
for (; pos < end; pos++) {
|
||||
var ch = sourceFile.text.charCodeAt(pos);
|
||||
if (!isWhiteSpace(ch) || isLineBreak(ch)) {
|
||||
// Either found lineBreak or non whiteSpace
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
||||
return end;
|
||||
}
|
||||
|
||||
function consumeLineBreaks(pos: number, end: number, sourceFile: SourceFile) {
|
||||
while (pos < end && isLineBreak(sourceFile.text.charCodeAt(pos))) {
|
||||
pos++;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
function isName(pos: number, end: number, sourceFile: SourceFile, name: string) {
|
||||
return pos + name.length < end &&
|
||||
sourceFile.text.substr(pos, name.length) === name &&
|
||||
isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length));
|
||||
}
|
||||
|
||||
function isParamTag(pos: number, end: number, sourceFile: SourceFile) {
|
||||
// If it is @param tag
|
||||
return isName(pos, end, sourceFile, paramTag);
|
||||
}
|
||||
|
||||
function getCleanedJsDocComment(pos: number, end: number, sourceFile: SourceFile) {
|
||||
var spacesToRemoveAfterAsterisk: number;
|
||||
var docComments: SymbolDisplayPart[] = [];
|
||||
var isInParamTag = false;
|
||||
|
||||
while (pos < end) {
|
||||
var docCommentTextOfLine = "";
|
||||
// First consume leading white space
|
||||
pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile);
|
||||
|
||||
// If the comment starts with '*' consume the spaces on this line
|
||||
if (pos < end && sourceFile.text.charCodeAt(pos) === CharacterCodes.asterisk) {
|
||||
var lineStartPos = pos + 1;
|
||||
pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, spacesToRemoveAfterAsterisk);
|
||||
|
||||
// Set the spaces to remove after asterisk as margin if not already set
|
||||
if (spacesToRemoveAfterAsterisk === undefined && pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) {
|
||||
spacesToRemoveAfterAsterisk = pos - lineStartPos;
|
||||
}
|
||||
}
|
||||
else if (spacesToRemoveAfterAsterisk === undefined) {
|
||||
spacesToRemoveAfterAsterisk = 0;
|
||||
}
|
||||
|
||||
for (; pos < end; pos++) {
|
||||
var ch = sourceFile.text.charCodeAt(pos);
|
||||
if (!isWhiteSpace(ch) || isLineBreak(ch)) {
|
||||
// Either found lineBreak or non whiteSpace
|
||||
return pos;
|
||||
// Analyse text on this line
|
||||
while (pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) {
|
||||
var ch = sourceFile.text.charAt(pos);
|
||||
if (ch === "@") {
|
||||
// If it is @param tag
|
||||
if (isParamTag(pos, end, sourceFile)) {
|
||||
isInParamTag = true;
|
||||
pos += paramTag.length;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
isInParamTag = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the ch to doc text if we arent in param tag
|
||||
if (!isInParamTag) {
|
||||
docCommentTextOfLine += ch;
|
||||
}
|
||||
|
||||
// Scan next character
|
||||
pos++;
|
||||
}
|
||||
|
||||
// Continue with next line
|
||||
pos = consumeLineBreaks(pos, end, sourceFile);
|
||||
if (docCommentTextOfLine) {
|
||||
docComments.push(textPart(docCommentTextOfLine));
|
||||
}
|
||||
}
|
||||
|
||||
return docComments;
|
||||
}
|
||||
|
||||
function getCleanedParamJsDocComment(pos: number, end: number, sourceFile: SourceFile) {
|
||||
var paramHelpStringMargin: number;
|
||||
var paramDocComments: SymbolDisplayPart[] = [];
|
||||
while (pos < end) {
|
||||
if (isParamTag(pos, end, sourceFile)) {
|
||||
// Consume leading spaces
|
||||
pos = consumeWhiteSpaces(pos + paramTag.length);
|
||||
if (pos >= end) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Ignore type expression
|
||||
if (sourceFile.text.charCodeAt(pos) === CharacterCodes.openBrace) {
|
||||
pos++;
|
||||
for (var curlies = 1; pos < end; pos++) {
|
||||
var charCode = sourceFile.text.charCodeAt(pos);
|
||||
|
||||
// { character means we need to find another } to match the found one
|
||||
if (charCode === CharacterCodes.openBrace) {
|
||||
curlies++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// } char
|
||||
if (charCode === CharacterCodes.closeBrace) {
|
||||
curlies--;
|
||||
if (curlies === 0) {
|
||||
// We do not have any more } to match the type expression is ignored completely
|
||||
pos++;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// there are more { to be matched with }
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Found start of another tag
|
||||
if (charCode === CharacterCodes.at) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Consume white spaces
|
||||
pos = consumeWhiteSpaces(pos);
|
||||
if (pos >= end) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Parameter name
|
||||
if (isName(pos, end, sourceFile, name)) {
|
||||
// Found the parameter we are looking for consume white spaces
|
||||
pos = consumeWhiteSpaces(pos + name.length);
|
||||
if (pos >= end) {
|
||||
break;
|
||||
}
|
||||
|
||||
var paramHelpString = "";
|
||||
var firstLineParamHelpStringPos = pos;
|
||||
while (pos < end) {
|
||||
var ch = sourceFile.text.charCodeAt(pos);
|
||||
|
||||
// at line break, set this comment line text and go to next line
|
||||
if (isLineBreak(ch)) {
|
||||
if (paramHelpString) {
|
||||
paramDocComments.push(textPart(paramHelpString));
|
||||
paramHelpString = "";
|
||||
}
|
||||
|
||||
// Get the pos after cleaning start of the line
|
||||
setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Done scanning param help string - next tag found
|
||||
if (ch === CharacterCodes.at) {
|
||||
break;
|
||||
}
|
||||
|
||||
paramHelpString += sourceFile.text.charAt(pos);
|
||||
|
||||
// Go to next character
|
||||
pos++;
|
||||
}
|
||||
|
||||
// If there is param help text, add it top the doc comments
|
||||
if (paramHelpString) {
|
||||
paramDocComments.push(textPart(paramHelpString));
|
||||
}
|
||||
paramHelpStringMargin = undefined;
|
||||
}
|
||||
|
||||
// If this is the start of another tag, continue with the loop in seach of param tag with symbol name
|
||||
if (sourceFile.text.charCodeAt(pos) === CharacterCodes.at) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return end;
|
||||
// Next character
|
||||
pos++;
|
||||
}
|
||||
|
||||
function consumeLineBreaks(pos: number, end: number, sourceFile: SourceFile) {
|
||||
while (pos < end && isLineBreak(sourceFile.text.charCodeAt(pos))) {
|
||||
return paramDocComments;
|
||||
|
||||
function consumeWhiteSpaces(pos: number) {
|
||||
while (pos < end && isWhiteSpace(sourceFile.text.charCodeAt(pos))) {
|
||||
pos++;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
function isName(pos: number, end: number, sourceFile: SourceFile, name: string) {
|
||||
return pos + name.length < end &&
|
||||
sourceFile.text.substr(pos, name.length) === name &&
|
||||
isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length));
|
||||
}
|
||||
|
||||
function isParamTag(pos: number, end: number, sourceFile: SourceFile) {
|
||||
// If it is @param tag
|
||||
return isName(pos, end, sourceFile, paramTag);
|
||||
}
|
||||
|
||||
function getCleanedJsDocComment(pos: number, end: number, sourceFile: SourceFile) {
|
||||
var spacesToRemoveAfterAsterisk: number;
|
||||
var docComments: SymbolDisplayPart[] = [];
|
||||
var isInParamTag = false;
|
||||
|
||||
while (pos < end) {
|
||||
var docCommentTextOfLine = "";
|
||||
// First consume leading white space
|
||||
pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile);
|
||||
|
||||
// If the comment starts with '*' consume the spaces on this line
|
||||
if (pos < end && sourceFile.text.charCodeAt(pos) === CharacterCodes.asterisk) {
|
||||
var lineStartPos = pos + 1;
|
||||
pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, spacesToRemoveAfterAsterisk);
|
||||
|
||||
// Set the spaces to remove after asterisk as margin if not already set
|
||||
if (spacesToRemoveAfterAsterisk === undefined && pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) {
|
||||
spacesToRemoveAfterAsterisk = pos - lineStartPos;
|
||||
}
|
||||
}
|
||||
else if (spacesToRemoveAfterAsterisk === undefined) {
|
||||
spacesToRemoveAfterAsterisk = 0;
|
||||
}
|
||||
|
||||
// Analyse text on this line
|
||||
while (pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) {
|
||||
var ch = sourceFile.text.charAt(pos);
|
||||
if (ch === "@") {
|
||||
// If it is @param tag
|
||||
if (isParamTag(pos, end, sourceFile)) {
|
||||
isInParamTag = true;
|
||||
pos += paramTag.length;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
isInParamTag = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the ch to doc text if we arent in param tag
|
||||
if (!isInParamTag) {
|
||||
docCommentTextOfLine += ch;
|
||||
}
|
||||
|
||||
// Scan next character
|
||||
pos++;
|
||||
}
|
||||
|
||||
// Continue with next line
|
||||
pos = consumeLineBreaks(pos, end, sourceFile);
|
||||
if (docCommentTextOfLine) {
|
||||
docComments.push(textPart(docCommentTextOfLine));
|
||||
}
|
||||
function setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos: number) {
|
||||
// Get the pos after consuming line breaks
|
||||
pos = consumeLineBreaks(pos, end, sourceFile);
|
||||
if (pos >= end) {
|
||||
return;
|
||||
}
|
||||
|
||||
return docComments;
|
||||
}
|
||||
|
||||
function getCleanedParamJsDocComment(pos: number, end: number, sourceFile: SourceFile) {
|
||||
var paramHelpStringMargin: number;
|
||||
var paramDocComments: SymbolDisplayPart[] = [];
|
||||
while (pos < end) {
|
||||
if (isParamTag(pos, end, sourceFile)) {
|
||||
// Consume leading spaces
|
||||
pos = consumeWhiteSpaces(pos + paramTag.length);
|
||||
if (pos >= end) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Ignore type expression
|
||||
if (sourceFile.text.charCodeAt(pos) === CharacterCodes.openBrace) {
|
||||
pos++;
|
||||
for (var curlies = 1; pos < end; pos++) {
|
||||
var charCode = sourceFile.text.charCodeAt(pos);
|
||||
|
||||
// { character means we need to find another } to match the found one
|
||||
if (charCode === CharacterCodes.openBrace) {
|
||||
curlies++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// } char
|
||||
if (charCode === CharacterCodes.closeBrace) {
|
||||
curlies--;
|
||||
if (curlies === 0) {
|
||||
// We do not have any more } to match the type expression is ignored completely
|
||||
pos++;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// there are more { to be matched with }
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Found start of another tag
|
||||
if (charCode === CharacterCodes.at) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Consume white spaces
|
||||
pos = consumeWhiteSpaces(pos);
|
||||
if (pos >= end) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Parameter name
|
||||
if (isName(pos, end, sourceFile, symbol.name)) {
|
||||
// Found the parameter we are looking for consume white spaces
|
||||
pos = consumeWhiteSpaces(pos + symbol.name.length);
|
||||
if (pos >= end) {
|
||||
break;
|
||||
}
|
||||
|
||||
var paramHelpString = "";
|
||||
var firstLineParamHelpStringPos = pos;
|
||||
while (pos < end) {
|
||||
var ch = sourceFile.text.charCodeAt(pos);
|
||||
|
||||
// at line break, set this comment line text and go to next line
|
||||
if (isLineBreak(ch)) {
|
||||
if (paramHelpString) {
|
||||
paramDocComments.push(textPart(paramHelpString));
|
||||
paramHelpString = "";
|
||||
}
|
||||
|
||||
// Get the pos after cleaning start of the line
|
||||
setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Done scanning param help string - next tag found
|
||||
if (ch === CharacterCodes.at) {
|
||||
break;
|
||||
}
|
||||
|
||||
paramHelpString += sourceFile.text.charAt(pos);
|
||||
|
||||
// Go to next character
|
||||
pos++;
|
||||
}
|
||||
|
||||
// If there is param help text, add it top the doc comments
|
||||
if (paramHelpString) {
|
||||
paramDocComments.push(textPart(paramHelpString));
|
||||
}
|
||||
paramHelpStringMargin = undefined;
|
||||
}
|
||||
|
||||
// If this is the start of another tag, continue with the loop in seach of param tag with symbol name
|
||||
if (sourceFile.text.charCodeAt(pos) === CharacterCodes.at) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Next character
|
||||
pos++;
|
||||
if (paramHelpStringMargin === undefined) {
|
||||
paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1;
|
||||
}
|
||||
|
||||
return paramDocComments;
|
||||
|
||||
function consumeWhiteSpaces(pos: number) {
|
||||
while (pos < end && isWhiteSpace(sourceFile.text.charCodeAt(pos))) {
|
||||
pos++;
|
||||
}
|
||||
|
||||
return pos;
|
||||
// Now consume white spaces max
|
||||
var startOfLinePos = pos;
|
||||
pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin);
|
||||
if (pos >= end) {
|
||||
return;
|
||||
}
|
||||
|
||||
function setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos: number) {
|
||||
// Get the pos after consuming line breaks
|
||||
pos = consumeLineBreaks(pos, end, sourceFile);
|
||||
if (pos >= end) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (paramHelpStringMargin === undefined) {
|
||||
paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1;
|
||||
}
|
||||
|
||||
// Now consume white spaces max
|
||||
var startOfLinePos = pos;
|
||||
pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin);
|
||||
if (pos >= end) {
|
||||
return;
|
||||
}
|
||||
|
||||
var consumedSpaces = pos - startOfLinePos;
|
||||
if (consumedSpaces < paramHelpStringMargin) {
|
||||
var ch = sourceFile.text.charCodeAt(pos);
|
||||
if (ch === CharacterCodes.asterisk) {
|
||||
// Consume more spaces after asterisk
|
||||
pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1);
|
||||
}
|
||||
var consumedSpaces = pos - startOfLinePos;
|
||||
if (consumedSpaces < paramHelpStringMargin) {
|
||||
var ch = sourceFile.text.charCodeAt(pos);
|
||||
if (ch === CharacterCodes.asterisk) {
|
||||
// Consume more spaces after asterisk
|
||||
pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -583,6 +590,11 @@ module ts {
|
|||
minArgumentCount: number;
|
||||
hasRestParameter: boolean;
|
||||
hasStringLiterals: boolean;
|
||||
|
||||
// Undefined is used to indicate the value has not been computed. If, after computing, the
|
||||
// symbol has no doc comment, then the empty string will be returned.
|
||||
documentationComment: SymbolDisplayPart[];
|
||||
|
||||
constructor(checker: TypeChecker) {
|
||||
this.checker = checker;
|
||||
}
|
||||
|
@ -598,6 +610,14 @@ module ts {
|
|||
getReturnType(): Type {
|
||||
return this.checker.getReturnTypeOfSignature(this);
|
||||
}
|
||||
|
||||
getDocumentationComment(): SymbolDisplayPart[] {
|
||||
if (this.documentationComment === undefined) {
|
||||
this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], this.declaration.name ? this.declaration.name.text : "") : [];
|
||||
}
|
||||
|
||||
return this.documentationComment;
|
||||
}
|
||||
}
|
||||
|
||||
var incrementalParse: IncrementalParse = TypeScript.IncrementalParser.parse;
|
||||
|
@ -1389,6 +1409,14 @@ module ts {
|
|||
return result;
|
||||
}
|
||||
|
||||
function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[] {
|
||||
var displayPartWriter = getDisplayPartWriter();
|
||||
typechecker.writeSignature(signature, displayPartWriter, enclosingDeclaration, flags);
|
||||
var result = displayPartWriter.displayParts();
|
||||
releaseDisplayPartWriter(displayPartWriter);
|
||||
return result;
|
||||
}
|
||||
|
||||
export function getDefaultCompilerOptions(): CompilerOptions {
|
||||
// Set "ES5" target by default for language service
|
||||
return {
|
||||
|
@ -2515,12 +2543,13 @@ module ts {
|
|||
var type = session.typeChecker.getTypeOfSymbol(symbol);
|
||||
Debug.assert(type, "Could not find type for symbol");
|
||||
var completionEntry = createCompletionEntry(symbol);
|
||||
var displayPartsAndDocumentations = getSymbolDisplayPartsAndDocumentationOfSymbol(symbol, getSourceFile(filename), session.location, session.typeChecker, session.location);
|
||||
return {
|
||||
name: entryName,
|
||||
kind: completionEntry.kind,
|
||||
kindModifiers: completionEntry.kindModifiers,
|
||||
displayParts: getSymbolDisplayPartsofSymbol(symbol, getSourceFile(filename), session.location, session.typeChecker),
|
||||
documentation: symbol.getDocumentationComment()
|
||||
displayParts: displayPartsAndDocumentations.displayParts,
|
||||
documentation: displayPartsAndDocumentations.documentation
|
||||
};
|
||||
}
|
||||
else {
|
||||
|
@ -2649,10 +2678,107 @@ module ts {
|
|||
return result.length > 0 ? result.join(',') : ScriptElementKindModifier.none;
|
||||
}
|
||||
|
||||
function getSymbolDisplayPartsofSymbol(symbol: Symbol, sourceFile: SourceFile, enclosingDeclaration: Node, typeResolver: TypeChecker): SymbolDisplayPart[] {
|
||||
function getSymbolDisplayPartsAndDocumentationOfSymbol(symbol: Symbol, sourceFile: SourceFile, enclosingDeclaration: Node, typeResolver: TypeChecker, location: Node) {
|
||||
var displayParts: SymbolDisplayPart[] = [];
|
||||
var documentation: SymbolDisplayPart[];
|
||||
var symbolFlags = typeResolver.getRootSymbol(symbol).flags;
|
||||
if (symbolFlags & SymbolFlags.Class) {
|
||||
|
||||
var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags);
|
||||
var hasAddedSymbolInfo: boolean;
|
||||
// Class at constructor site need to be shown as constructor apart from property,method, vars
|
||||
if (symbolKind !== ScriptElementKind.unknown || symbolFlags & SymbolFlags.Signature || symbolFlags & SymbolFlags.Class) {
|
||||
// If it is accessor they are allowed only if location is at name of the accessor
|
||||
if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) {
|
||||
if (!isNameOfFunctionDeclaration(location) || ts.contains(symbol.getDeclarations(), location.parent)) {
|
||||
symbolKind = ScriptElementKind.memberVariableElement;
|
||||
}
|
||||
}
|
||||
|
||||
var type = typeResolver.getTypeOfSymbol(symbol);
|
||||
if (type) {
|
||||
if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) {
|
||||
// try get the call/construct signature from the type if it matches
|
||||
var callExpression: CallExpression;
|
||||
if (location.parent.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>location.parent).right === location) {
|
||||
location = location.parent;
|
||||
}
|
||||
callExpression = <CallExpression>location.parent;
|
||||
|
||||
var candidateSignatures = <Signature[]>[];
|
||||
signature = typeResolver.getResolvedSignature(callExpression, candidateSignatures);
|
||||
if (!signature && candidateSignatures.length) {
|
||||
// Use the first candidate:
|
||||
signature = candidateSignatures[0];
|
||||
}
|
||||
|
||||
var useConstructSignatures = callExpression.kind === SyntaxKind.NewExpression || callExpression.func.kind === SyntaxKind.SuperKeyword;
|
||||
var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
|
||||
|
||||
if (contains(allSignatures, signature)) {
|
||||
// Write it as method/function/constructor as: (constructor) a(....)
|
||||
if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & SymbolFlags.Variable || symbolFlags & SymbolFlags.Class) {
|
||||
if (useConstructSignatures) {
|
||||
symbolKind = ScriptElementKind.constructorImplementationElement;
|
||||
}
|
||||
else {
|
||||
switch (symbolKind) {
|
||||
case ScriptElementKind.memberVariableElement:
|
||||
symbolKind = ScriptElementKind.memberFunctionElement;
|
||||
break;
|
||||
case ScriptElementKind.variableElement:
|
||||
symbolKind = ScriptElementKind.functionElement;
|
||||
break;
|
||||
case ScriptElementKind.parameterElement:
|
||||
case ScriptElementKind.localVariableElement:
|
||||
symbolKind = ScriptElementKind.localFunctionElement;
|
||||
break;
|
||||
default:
|
||||
Debug.fail("symbolKind: " + symbolKind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Constructor or call signatures use the type name
|
||||
if (useConstructSignatures || (signature.declaration.kind === SyntaxKind.CallSignature &&
|
||||
!(type.symbol.flags & SymbolFlags.TypeLiteral || type.symbol.flags & SymbolFlags.ObjectLiteral))) {
|
||||
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
|
||||
}
|
||||
else {
|
||||
addPrefixForAnyFunctionOrVar(symbol, symbolKind);
|
||||
}
|
||||
addSignatureDisplayParts(signature, allSignatures);
|
||||
hasAddedSymbolInfo = true;
|
||||
}
|
||||
}
|
||||
else if (isNameOfFunctionDeclaration(location) || // name of function declaration
|
||||
(location.kind === SyntaxKind.ConstructorKeyword && location.parent.kind === SyntaxKind.Constructor)) { // At constructor keyword of constructor declaration
|
||||
// get the signature from the declaration and write it
|
||||
var signature: Signature;
|
||||
var functionDeclaration = <FunctionDeclaration>location.parent;
|
||||
var allSignatures = functionDeclaration.kind === SyntaxKind.Constructor ? type.getConstructSignatures() : type.getCallSignatures();
|
||||
if (!typeResolver.isImplementationOfOverload(functionDeclaration)) {
|
||||
signature = typeResolver.getSignatureFromDeclaration(functionDeclaration);
|
||||
}
|
||||
else {
|
||||
signature = allSignatures[0];
|
||||
}
|
||||
|
||||
if (functionDeclaration.kind === SyntaxKind.Constructor) {
|
||||
// show (constructor) Type(...) signature
|
||||
addPrefixForAnyFunctionOrVar(type.symbol, ScriptElementKind.constructorImplementationElement);
|
||||
}
|
||||
else {
|
||||
// (function/method) symbol(..signature)
|
||||
addPrefixForAnyFunctionOrVar(functionDeclaration.kind === SyntaxKind.CallSignature &&
|
||||
!(type.symbol.flags & SymbolFlags.TypeLiteral || type.symbol.flags & SymbolFlags.ObjectLiteral) ? type.symbol : symbol, symbolKind);
|
||||
}
|
||||
|
||||
addSignatureDisplayParts(signature, allSignatures);
|
||||
hasAddedSymbolInfo = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (symbolFlags & SymbolFlags.Class && !hasAddedSymbolInfo) {
|
||||
displayParts.push(keywordPart(SyntaxKind.ClassKeyword));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, sourceFile));
|
||||
|
@ -2683,69 +2809,81 @@ module ts {
|
|||
displayParts.push(spacePart());
|
||||
displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, enclosingDeclaration));
|
||||
}
|
||||
else {
|
||||
//public static string FormatSymbolName(string name, string fullSymbolName, string kind, out bool useTypeName)
|
||||
var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags);
|
||||
var text: string;
|
||||
if (symbolKind === ScriptElementKind.unknown) {
|
||||
if (symbolFlags & SymbolFlags.EnumMember) {
|
||||
text = "enum member";
|
||||
if (symbolFlags & SymbolFlags.EnumMember) {
|
||||
addPrefixForAnyFunctionOrVar(symbol, "enum member");
|
||||
var declaration = symbol.declarations[0];
|
||||
if (declaration.kind === SyntaxKind.EnumMember) {
|
||||
var constantValue = typeResolver.getEnumMemberValue(<EnumMember>declaration);
|
||||
if (constantValue !== undefined) {
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
text = symbolKind;
|
||||
}
|
||||
|
||||
if (text || symbolFlags & SymbolFlags.Signature) {
|
||||
addNewLineIfDisplayPartsExist();
|
||||
if (text) {
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
displayParts.push(textPart(text));
|
||||
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
|
||||
displayParts.push(spacePart());
|
||||
|
||||
displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, sourceFile));
|
||||
}
|
||||
|
||||
var type = typeResolver.getTypeOfSymbol(symbol);
|
||||
if (symbolFlags & SymbolFlags.Property ||
|
||||
else if (!hasAddedSymbolInfo && symbolKind !== ScriptElementKind.unknown) {
|
||||
if (type) {
|
||||
addPrefixForAnyFunctionOrVar(symbol, symbolKind);
|
||||
if (symbolKind === ScriptElementKind.memberVariableElement ||
|
||||
symbolFlags & SymbolFlags.Variable) {
|
||||
if (type) {
|
||||
displayParts.push(punctuationPart(SyntaxKind.ColonToken));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, type, enclosingDeclaration, TypeFormatFlags.NoTruncation));
|
||||
}
|
||||
displayParts.push(punctuationPart(SyntaxKind.ColonToken));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, type, enclosingDeclaration, TypeFormatFlags.NoTruncation));
|
||||
}
|
||||
else if (symbolFlags & SymbolFlags.Function ||
|
||||
symbolFlags & SymbolFlags.Method ||
|
||||
symbolFlags & SymbolFlags.Constructor ||
|
||||
symbolFlags & SymbolFlags.Signature ||
|
||||
symbolFlags & SymbolFlags.Accessor) {
|
||||
if (type) {
|
||||
displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, type, enclosingDeclaration, TypeFormatFlags.NoTruncation | TypeFormatFlags.NoArrowStyleTopLevelSignature));
|
||||
}
|
||||
}
|
||||
else if (symbolFlags & SymbolFlags.EnumMember) {
|
||||
var declaration = symbol.declarations[0];
|
||||
if (declaration.kind === SyntaxKind.EnumMember) {
|
||||
var constantValue = typeResolver.getEnumMemberValue(<EnumMember>declaration);
|
||||
if (constantValue !== undefined) {
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral));
|
||||
}
|
||||
}
|
||||
var allSignatures = type.getCallSignatures();
|
||||
addSignatureDisplayParts(allSignatures[0], allSignatures);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!documentation) {
|
||||
documentation = symbol.getDocumentationComment();
|
||||
}
|
||||
|
||||
return displayParts;
|
||||
return { displayParts: displayParts, documentation: documentation };
|
||||
|
||||
function addNewLineIfDisplayPartsExist() {
|
||||
if (displayParts.length) {
|
||||
displayParts.push(lineBreakPart());
|
||||
}
|
||||
}
|
||||
|
||||
function addPrefixForAnyFunctionOrVar(symbol: Symbol, symbolKind: string) {
|
||||
addNewLineIfDisplayPartsExist();
|
||||
if (symbolKind) {
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
displayParts.push(textPart(symbolKind));
|
||||
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
|
||||
displayParts.push(spacePart());
|
||||
//if (symbol.declarations && symbol.declarations.length) {
|
||||
displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, sourceFile));
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
function addSignatureDisplayParts(signature: Signature, allSignatures: Signature[]) {
|
||||
displayParts.push.apply(displayParts, signatureToDisplayParts(typeResolver, signature, enclosingDeclaration, TypeFormatFlags.NoTruncation));
|
||||
if (allSignatures.length > 1) {
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
displayParts.push(operatorPart(SyntaxKind.PlusToken));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(displayPart((allSignatures.length - 1).toString(), SymbolDisplayPartKind.numericLiteral));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(textPart("overload"));
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
displayParts.push(textPart("s"));
|
||||
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
|
||||
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
|
||||
}
|
||||
documentation = signature.getDocumentationComment();
|
||||
}
|
||||
}
|
||||
|
||||
function getQuickInfoAtPosition(fileName: string, position: number): QuickInfo {
|
||||
|
@ -2763,12 +2901,13 @@ module ts {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
var displayPartsAndDocumentations = getSymbolDisplayPartsAndDocumentationOfSymbol(symbol, sourceFile, getContainerNode(node), typeInfoResolver, node);
|
||||
return {
|
||||
kind: getSymbolKind(symbol),
|
||||
kindModifiers: getSymbolModifiers(symbol),
|
||||
textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()),
|
||||
displayParts: getSymbolDisplayPartsofSymbol(symbol, sourceFile, getContainerNode(node), typeInfoResolver),
|
||||
documentation: symbol.getDocumentationComment()
|
||||
displayParts: displayPartsAndDocumentations.displayParts,
|
||||
documentation: displayPartsAndDocumentations.documentation
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -334,9 +334,7 @@ goTo.marker('25');
|
|||
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");
|
||||
verify.quickInfoIs("(function) f1(a: number): any (+ 1 overload(s))", "fn f1 with number");
|
||||
goTo.marker('25aq');
|
||||
verify.quickInfoIs("(parameter) a: number", "");
|
||||
|
||||
|
@ -344,16 +342,13 @@ goTo.marker('26');
|
|||
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");
|
||||
verify.quickInfoIs("(function) f1(b: string): any (+ 1 overload(s))", "");
|
||||
goTo.marker('26aq');
|
||||
verify.quickInfoIs("(parameter) b: string", "");
|
||||
|
||||
goTo.marker('27');
|
||||
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");
|
||||
verify.completionListContains("f1", "(function) f1(a: number): any (+ 1 overload(s))", "fn f1 with number");
|
||||
|
||||
goTo.marker('28');
|
||||
verify.currentSignatureHelpDocCommentIs("This is subtract function");
|
||||
|
|
|
@ -226,15 +226,15 @@
|
|||
////foo(null);
|
||||
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "this is signature 1", "f1", "function");
|
||||
verify.quickInfoIs("(function) f1(a: number): number (+ 1 overload(s))", "this is signature 1");
|
||||
goTo.marker('2');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "f1", "function");
|
||||
verify.quickInfoIs("(function) f1(b: string): number (+ 1 overload(s))", "");
|
||||
goTo.marker('3');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "this is signature 1", "f1", "function");
|
||||
verify.quickInfoIs("(function) f1(a: number): number (+ 1 overload(s))", "this is signature 1");
|
||||
goTo.marker('4q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "f1", "function");
|
||||
verify.quickInfoIs("(function) f1(b: string): number (+ 1 overload(s))", "");
|
||||
goTo.marker('o4q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "this is signature 1", "f1", "function");
|
||||
verify.quickInfoIs("(function) f1(a: number): number (+ 1 overload(s))", "this is signature 1");
|
||||
|
||||
goTo.marker('4');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
|
@ -244,15 +244,15 @@ verify.currentSignatureHelpDocCommentIs("this is signature 1");
|
|||
verify.currentParameterHelpArgumentDocCommentIs("param a");
|
||||
|
||||
goTo.marker('5');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "f2", "function");
|
||||
verify.quickInfoIs("(function) f2(a: number): number (+ 1 overload(s))", "");
|
||||
goTo.marker('6');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "this is signature 2", "f2", "function");
|
||||
verify.quickInfoIs("(function) f2(b: string): number (+ 1 overload(s))", "this is signature 2");
|
||||
goTo.marker('7');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "f2", "function");
|
||||
verify.quickInfoIs("(function) f2(a: number): number (+ 1 overload(s))", "");
|
||||
goTo.marker('8q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "this is signature 2", "f2", "function");
|
||||
verify.quickInfoIs("(function) f2(b: string): number (+ 1 overload(s))", "this is signature 2");
|
||||
goTo.marker('o8q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "f2", "function");
|
||||
verify.quickInfoIs("(function) f2(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('8');
|
||||
verify.currentSignatureHelpDocCommentIs("this is signature 2");
|
||||
|
@ -263,15 +263,15 @@ verify.currentSignatureHelpDocCommentIs("");
|
|||
verify.currentParameterHelpArgumentDocCommentIs("param a");
|
||||
|
||||
goTo.marker('9');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "f3", "function");
|
||||
verify.quickInfoIs("(function) f3(a: number): number (+ 1 overload(s))", "");
|
||||
goTo.marker('10');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "f3", "function");
|
||||
verify.quickInfoIs("(function) f3(b: string): number (+ 1 overload(s))", "");
|
||||
goTo.marker('11');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "f3", "function");
|
||||
verify.quickInfoIs("(function) f3(a: number): number (+ 1 overload(s))", "");
|
||||
goTo.marker('12q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "f3", "function");
|
||||
verify.quickInfoIs("(function) f3(b: string): number (+ 1 overload(s))", "");
|
||||
goTo.marker('o12q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "f3", "function");
|
||||
verify.quickInfoIs("(function) f3(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('12');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
|
@ -282,15 +282,15 @@ verify.currentSignatureHelpDocCommentIs("");
|
|||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
|
||||
goTo.marker('13');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "this is signature 4 - with number parameter", "f4", "function");
|
||||
verify.quickInfoIs("(function) f4(a: number): number (+ 1 overload(s))", "this is signature 4 - with number parameter");
|
||||
goTo.marker('14');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "this is signature 4 - with string parameter", "f4", "function");
|
||||
verify.quickInfoIs("(function) f4(b: string): number (+ 1 overload(s))", "this is signature 4 - with string parameter");
|
||||
goTo.marker('15');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "this is signature 4 - with number parameter", "f4", "function");
|
||||
verify.quickInfoIs("(function) f4(a: number): number (+ 1 overload(s))", "this is signature 4 - with number parameter");
|
||||
goTo.marker('16q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "this is signature 4 - with string parameter", "f4", "function");
|
||||
verify.quickInfoIs("(function) f4(b: string): number (+ 1 overload(s))", "this is signature 4 - with string parameter");
|
||||
goTo.marker('o16q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "this is signature 4 - with number parameter", "f4", "function");
|
||||
verify.quickInfoIs("(function) f4(a: number): number (+ 1 overload(s))", "this is signature 4 - with number parameter");
|
||||
|
||||
goTo.marker('16');
|
||||
verify.currentSignatureHelpDocCommentIs("this is signature 4 - with string parameter");
|
||||
|
@ -301,433 +301,437 @@ verify.currentSignatureHelpDocCommentIs("this is signature 4 - with number param
|
|||
verify.currentParameterHelpArgumentDocCommentIs("param a");
|
||||
|
||||
goTo.marker('17');
|
||||
verify.completionListContains('f1', '(a: number): number (+ 1 overload(s))', 'this is signature 1', "f1", "function");
|
||||
verify.completionListContains('f2', '(a: number): number (+ 1 overload(s))', '', "f2", "function");
|
||||
verify.completionListContains('f3', '(a: number): number (+ 1 overload(s))', '', "f3", "function");
|
||||
verify.completionListContains('f4', '(a: number): number (+ 1 overload(s))', 'this is signature 4 - with number parameter', "f4", "function");
|
||||
verify.completionListContains('f1', '(function) f1(a: number): number (+ 1 overload(s))', 'this is signature 1');
|
||||
verify.completionListContains('f2', '(function) f2(a: number): number (+ 1 overload(s))', '');
|
||||
verify.completionListContains('f3', '(function) f3(a: number): number (+ 1 overload(s))', '');
|
||||
verify.completionListContains('f4', '(function) f4(a: number): number (+ 1 overload(s))', 'this is signature 4 - with number parameter');
|
||||
|
||||
goTo.marker('18');
|
||||
verify.completionListContains('i1', 'i1', '', "i1", "interface");
|
||||
verify.completionListContains('i1_i', 'i1', '', "i1_i", "var");
|
||||
verify.completionListContains('i2', 'i2', '', "i2", "interface");
|
||||
verify.completionListContains('i2_i', 'i2', '', "i2_i", "var");
|
||||
verify.completionListContains('i3', 'i3', '', "i3", "interface");
|
||||
verify.completionListContains('i3_i', 'i3', '', "i3_i","var");
|
||||
verify.completionListContains('i4', 'i4', '', "i4", "interface");
|
||||
verify.completionListContains('i4_i', 'i4', '', "i4_i", "var");
|
||||
verify.completionListContains('i1', 'interface i1', '');
|
||||
verify.completionListContains('i1_i', '(constructor) i1(b: number): any (+ 1 overload(s))', '');
|
||||
verify.completionListContains('i2', 'interface i2', '');
|
||||
verify.completionListContains('i2_i', '(var) i2_i: i2', '');
|
||||
verify.completionListContains('i3', 'interface i3', '');
|
||||
verify.completionListContains('i3_i', '(var) i3_i: i3', '');
|
||||
verify.completionListContains('i4', 'interface i4', '');
|
||||
verify.completionListContains('i4_i', '(var) i4_i: i4', '');
|
||||
|
||||
goTo.marker('19');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('19q');
|
||||
verify.quickInfoIs("(b: number): any (+ 1 overload(s))", "", "i1", "constructor");
|
||||
verify.quickInfoIs("(constructor) i1(b: number): any (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('20');
|
||||
verify.currentSignatureHelpDocCommentIs("new 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('20q');
|
||||
verify.quickInfoIs("(a: string): any (+ 1 overload(s))", "new 1", "i1", "constructor");
|
||||
verify.quickInfoIs("(constructor) i1(a: string): any (+ 1 overload(s))", "new 1");
|
||||
|
||||
goTo.marker('21');
|
||||
verify.currentSignatureHelpDocCommentIs("this signature 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("param a");
|
||||
goTo.marker('21q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "this signature 1", "i1", "function");
|
||||
verify.quickInfoIs("(function) i1(a: number): number (+ 1 overload(s))", "this signature 1");
|
||||
|
||||
goTo.marker('22');
|
||||
verify.currentSignatureHelpDocCommentIs("this is signature 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('22q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "this is signature 2", "i1", "function");
|
||||
verify.quickInfoIs("(function) i1(b: string): number (+ 1 overload(s))", "this is signature 2");
|
||||
|
||||
goTo.marker('23');
|
||||
verify.memberListContains('foo', '(a: number): number (+ 1 overload(s))', 'foo 1', "i1.foo", "method");
|
||||
verify.memberListContains('foo2', '(a: number): number (+ 1 overload(s))', '', "i1.foo2", "method");
|
||||
verify.memberListContains('foo3', '(a: number): number (+ 1 overload(s))', '', "i1.foo3", "method");
|
||||
verify.memberListContains('foo4', '(a: number): number (+ 1 overload(s))', 'foo4 1', "i1.foo4", "method");
|
||||
verify.memberListContains('foo', '(method) i1.foo(a: number): number (+ 1 overload(s))', 'foo 1');
|
||||
verify.memberListContains('foo2', '(method) i1.foo2(a: number): number (+ 1 overload(s))', '');
|
||||
verify.memberListContains('foo3', '(method) i1.foo3(a: number): number (+ 1 overload(s))', '');
|
||||
verify.memberListContains('foo4', '(method) i1.foo4(a: number): number (+ 1 overload(s))', 'foo4 1');
|
||||
|
||||
goTo.marker('24');
|
||||
verify.currentSignatureHelpDocCommentIs("foo 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('24q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "foo 1", "i1.foo", "method");
|
||||
verify.quickInfoIs("(method) i1.foo(a: number): number (+ 1 overload(s))", "foo 1");
|
||||
|
||||
goTo.marker('25');
|
||||
verify.currentSignatureHelpDocCommentIs("foo 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('25q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "foo 2", "i1.foo", "method");
|
||||
verify.quickInfoIs("(method) i1.foo(b: string): number (+ 1 overload(s))", "foo 2");
|
||||
|
||||
goTo.marker('26');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('26q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "i1.foo2", "method");
|
||||
verify.quickInfoIs("(method) i1.foo2(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('27');
|
||||
verify.currentSignatureHelpDocCommentIs("foo2 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('27q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "foo2 2", "i1.foo2", "method");
|
||||
verify.quickInfoIs("(method) i1.foo2(b: string): number (+ 1 overload(s))", "foo2 2");
|
||||
|
||||
goTo.marker('28');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('28q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "i1.foo3", "method");
|
||||
verify.quickInfoIs("(method) i1.foo3(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('29');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('29q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "i1.foo3", "method");
|
||||
verify.quickInfoIs("(method) i1.foo3(b: string): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('30');
|
||||
verify.currentSignatureHelpDocCommentIs("foo4 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('30q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "foo4 1", "i1.foo4", "method");
|
||||
verify.quickInfoIs("(method) i1.foo4(a: number): number (+ 1 overload(s))", "foo4 1");
|
||||
|
||||
goTo.marker('31');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('31q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "i1.foo4", "method");
|
||||
verify.quickInfoIs("(method) i1.foo4(b: string): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('32');
|
||||
verify.currentSignatureHelpDocCommentIs("new 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('32q');
|
||||
verify.quickInfoIs("(b: number): any (+ 1 overload(s))", "new 2", "i2", "constructor");
|
||||
verify.quickInfoIs("(constructor) i2(b: number): any (+ 1 overload(s))", "new 2");
|
||||
|
||||
goTo.marker('33');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('33q');
|
||||
verify.quickInfoIs("(a: string): any (+ 1 overload(s))", "", "i2", "constructor");
|
||||
verify.quickInfoIs("(constructor) i2(a: string): any (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('34');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('34q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "i2", "function");
|
||||
verify.quickInfoIs("(function) i2(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('35');
|
||||
verify.currentSignatureHelpDocCommentIs("this is signature 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('35q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "this is signature 2", "i2", "function");
|
||||
verify.quickInfoIs("(function) i2(b: string): number (+ 1 overload(s))", "this is signature 2");
|
||||
|
||||
goTo.marker('36');
|
||||
verify.currentSignatureHelpDocCommentIs("new 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('36q');
|
||||
verify.quickInfoIs("(b: number): any (+ 1 overload(s))", "new 2", "i3", "constructor");
|
||||
verify.quickInfoIs("(constructor) i3(b: number): any (+ 1 overload(s))", "new 2");
|
||||
|
||||
goTo.marker('37');
|
||||
verify.currentSignatureHelpDocCommentIs("new 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('37q');
|
||||
verify.quickInfoIs("(a: string): any (+ 1 overload(s))", "new 1", "i3", "constructor");
|
||||
verify.quickInfoIs("(constructor) i3(a: string): any (+ 1 overload(s))", "new 1");
|
||||
|
||||
goTo.marker('38');
|
||||
verify.currentSignatureHelpDocCommentIs("this is signature 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('38q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "this is signature 1", "i3", "function");
|
||||
verify.quickInfoIs("(function) i3(a: number): number (+ 1 overload(s))", "this is signature 1");
|
||||
|
||||
goTo.marker('39');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('39q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "i3", "function");
|
||||
verify.quickInfoIs("(function) i3(b: string): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('40');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('40q');
|
||||
verify.quickInfoIs("(b: number): any (+ 1 overload(s))", "", "i4", "constructor");
|
||||
verify.quickInfoIs("(constructor) i4(b: number): any (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('41');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('41q');
|
||||
verify.quickInfoIs("(a: string): any (+ 1 overload(s))", "", "i4", "constructor");
|
||||
verify.quickInfoIs("(constructor) i4(a: string): any (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('42');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('42q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "i4", "function");
|
||||
verify.quickInfoIs("(function) i4(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('43');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('43q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "i4", "function");
|
||||
verify.quickInfoIs("(function) i4(b: string): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('44');
|
||||
verify.memberListContains('prop1', '(a: number): number (+ 1 overload(s))', '', "c.prop1", "method");
|
||||
verify.memberListContains('prop2', '(a: number): number (+ 1 overload(s))', 'prop2 1', "c.prop2", "method");
|
||||
verify.memberListContains('prop3', '(a: number): number (+ 1 overload(s))', '', "c.prop3", "method");
|
||||
verify.memberListContains('prop4', '(a: number): number (+ 1 overload(s))', 'prop4 1', "c.prop4", "method");
|
||||
verify.memberListContains('prop5', '(a: number): number (+ 1 overload(s))', 'prop5 1', "c.prop5", "method");
|
||||
verify.memberListContains('prop1', '(method) c.prop1(a: number): number (+ 1 overload(s))', '');
|
||||
verify.memberListContains('prop2', '(method) c.prop2(a: number): number (+ 1 overload(s))', 'prop2 1');
|
||||
verify.memberListContains('prop3', '(method) c.prop3(a: number): number (+ 1 overload(s))', '');
|
||||
verify.memberListContains('prop4', '(method) c.prop4(a: number): number (+ 1 overload(s))', 'prop4 1');
|
||||
verify.memberListContains('prop5', '(method) c.prop5(a: number): number (+ 1 overload(s))', 'prop5 1');
|
||||
|
||||
goTo.marker('45');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('45q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "c.prop1", "method");
|
||||
verify.quickInfoIs("(method) c.prop1(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('46');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('46q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "c.prop1", "method");
|
||||
verify.quickInfoIs("(method) c.prop1(b: string): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('47');
|
||||
verify.currentSignatureHelpDocCommentIs("prop2 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('47q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "prop2 1", "c.prop2", "method");
|
||||
verify.quickInfoIs("(method) c.prop2(a: number): number (+ 1 overload(s))", "prop2 1");
|
||||
|
||||
goTo.marker('48');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('48q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "c.prop2", "method");
|
||||
verify.quickInfoIs("(method) c.prop2(b: string): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('49');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('49q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "c.prop3", "method");
|
||||
verify.quickInfoIs("(method) c.prop3(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('50');
|
||||
verify.currentSignatureHelpDocCommentIs("prop3 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('50q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "prop3 2", "c.prop3", "method");
|
||||
verify.quickInfoIs("(method) c.prop3(b: string): number (+ 1 overload(s))", "prop3 2");
|
||||
|
||||
goTo.marker('51');
|
||||
verify.currentSignatureHelpDocCommentIs("prop4 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('51q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "prop4 1", "c.prop4", "method");
|
||||
verify.quickInfoIs("(method) c.prop4(a: number): number (+ 1 overload(s))", "prop4 1");
|
||||
|
||||
goTo.marker('52');
|
||||
verify.currentSignatureHelpDocCommentIs("prop4 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('52q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "prop4 2", "c.prop4", "method");
|
||||
verify.quickInfoIs("(method) c.prop4(b: string): number (+ 1 overload(s))", "prop4 2");
|
||||
|
||||
goTo.marker('53');
|
||||
verify.currentSignatureHelpDocCommentIs("prop5 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('53q');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "prop5 1", "c.prop5", "method");
|
||||
verify.quickInfoIs("(method) c.prop5(a: number): number (+ 1 overload(s))", "prop5 1");
|
||||
|
||||
goTo.marker('54');
|
||||
verify.currentSignatureHelpDocCommentIs("prop5 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('54q');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "prop5 2", "c.prop5", "method");
|
||||
verify.quickInfoIs("(method) c.prop5(b: string): number (+ 1 overload(s))", "prop5 2");
|
||||
|
||||
goTo.marker('55');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('55q');
|
||||
verify.quickInfoIs("(a: number): c1 (+ 1 overload(s))", "", "c1", "constructor");
|
||||
verify.quickInfoIs("(constructor) c1(a: number): c1 (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('56');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('56q');
|
||||
verify.quickInfoIs("(b: string): c1 (+ 1 overload(s))", "", "c1", "constructor");
|
||||
verify.quickInfoIs("(constructor) c1(b: string): c1 (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('57');
|
||||
verify.currentSignatureHelpDocCommentIs("c2 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('57q');
|
||||
verify.quickInfoIs("(a: number): c2 (+ 1 overload(s))", "c2 1", "c2", "constructor");
|
||||
verify.quickInfoIs("(constructor) c2(a: number): c2 (+ 1 overload(s))", "c2 1");
|
||||
|
||||
goTo.marker('58');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('58q');
|
||||
verify.quickInfoIs("(b: string): c2 (+ 1 overload(s))", "", "c2", "constructor");
|
||||
verify.quickInfoIs("(constructor) c2(b: string): c2 (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('59');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('59q');
|
||||
verify.quickInfoIs("(a: number): c3 (+ 1 overload(s))", "", "c3", "constructor");
|
||||
verify.quickInfoIs("(constructor) c3(a: number): c3 (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('60');
|
||||
verify.currentSignatureHelpDocCommentIs("c3 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('60q');
|
||||
verify.quickInfoIs("(b: string): c3 (+ 1 overload(s))", "c3 2", "c3", "constructor");
|
||||
verify.quickInfoIs("(constructor) c3(b: string): c3 (+ 1 overload(s))", "c3 2");
|
||||
|
||||
goTo.marker('61');
|
||||
verify.currentSignatureHelpDocCommentIs("c4 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('61q');
|
||||
verify.quickInfoIs("(a: number): c4 (+ 1 overload(s))", "c4 1", "c4", "constructor");
|
||||
verify.quickInfoIs("(constructor) c4(a: number): c4 (+ 1 overload(s))", "c4 1");
|
||||
|
||||
goTo.marker('62');
|
||||
verify.currentSignatureHelpDocCommentIs("c4 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('62q');
|
||||
verify.quickInfoIs("(b: string): c4 (+ 1 overload(s))", "c4 2", "c4", "constructor");
|
||||
verify.quickInfoIs("(constructor) c4(b: string): c4 (+ 1 overload(s))", "c4 2");
|
||||
|
||||
goTo.marker('63');
|
||||
verify.currentSignatureHelpDocCommentIs("c5 1");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('63q');
|
||||
verify.quickInfoIs("(a: number): c5 (+ 1 overload(s))", "c5 1", "c5", "constructor");
|
||||
verify.quickInfoIs("(constructor) c5(a: number): c5 (+ 1 overload(s))", "c5 1");
|
||||
|
||||
goTo.marker('64');
|
||||
verify.currentSignatureHelpDocCommentIs("c5 2");
|
||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||
goTo.marker('64q');
|
||||
verify.quickInfoIs("(b: string): c5 (+ 1 overload(s))", "c5 2", "c5", "constructor");
|
||||
verify.quickInfoIs("(constructor) c5(b: string): c5 (+ 1 overload(s))", "c5 2");
|
||||
|
||||
goTo.marker('65');
|
||||
verify.completionListContains("c", undefined, "", "c", "class");
|
||||
verify.completionListContains("c1", undefined, "", "c1", "class");
|
||||
verify.completionListContains("c2", undefined, "", "c2", "class");
|
||||
verify.completionListContains("c3", undefined, "", "c3", "class");
|
||||
verify.completionListContains("c4", undefined, "", "c4", "class");
|
||||
verify.completionListContains("c5", undefined, "", "c5", "class");
|
||||
verify.completionListContains("c_i", "c", "", "c_i", "var");
|
||||
verify.completionListContains("c1_i_1", "c1", "", "c1_i_1", "var");
|
||||
verify.completionListContains("c2_i_1", "c2", "", "c2_i_1", "var");
|
||||
verify.completionListContains("c3_i_1", "c3", "", "c3_i_1", "var");
|
||||
verify.completionListContains("c4_i_1", "c4", "", "c4_i_1", "var");
|
||||
verify.completionListContains("c5_i_1", "c5", "", "c5_i_1", "var");
|
||||
verify.completionListContains("c1_i_2", "c1", "", "c1_i_2", "var");
|
||||
verify.completionListContains("c2_i_2", "c2", "", "c2_i_2", "var");
|
||||
verify.completionListContains("c3_i_2", "c3", "", "c3_i_2", "var");
|
||||
verify.completionListContains("c4_i_2", "c4", "", "c4_i_2", "var");
|
||||
verify.completionListContains("c5_i_2", "c5", "", "c5_i_2", "var");
|
||||
verify.completionListContains('multiOverload', '(a: number): string (+ 2 overload(s))', 'This is multiOverload F1 1', "multiOverload", "function");
|
||||
verify.completionListContains('ambientF1', '(a: number): string (+ 2 overload(s))', 'This is ambient F1 1', "ambientF1", "function");
|
||||
//verify.completionListContains("c", "class c", "");
|
||||
// the below check is wrong and it should show it as class but currently we have a bug for adding the parameters of ambient function in the symbol list
|
||||
// eg declare function foo2(x: number);
|
||||
// completion list here
|
||||
verify.completionListContains("c", "(parameter) c: boolean", "");
|
||||
verify.completionListContains("c1", "class c1", "");
|
||||
verify.completionListContains("c2", "class c2", "");
|
||||
verify.completionListContains("c3", "class c3", "");
|
||||
verify.completionListContains("c4", "class c4", "");
|
||||
verify.completionListContains("c5", "class c5", "");
|
||||
verify.completionListContains("c_i", "(var) c_i: c", "");
|
||||
verify.completionListContains("c1_i_1", "(var) c1_i_1: c1", "");
|
||||
verify.completionListContains("c2_i_1", "(var) c2_i_1: c2", "");
|
||||
verify.completionListContains("c3_i_1", "(var) c3_i_1: c3", "");
|
||||
verify.completionListContains("c4_i_1", "(var) c4_i_1: c4", "");
|
||||
verify.completionListContains("c5_i_1", "(var) c5_i_1: c5", "");
|
||||
verify.completionListContains("c1_i_2", "(var) c1_i_2: c1", "");
|
||||
verify.completionListContains("c2_i_2", "(var) c2_i_2: c2", "");
|
||||
verify.completionListContains("c3_i_2", "(var) c3_i_2: c3", "");
|
||||
verify.completionListContains("c4_i_2", "(var) c4_i_2: c4", "");
|
||||
verify.completionListContains("c5_i_2", "(var) c5_i_2: c5", "");
|
||||
verify.completionListContains('multiOverload', '(function) multiOverload(a: number): string (+ 2 overload(s))', 'This is multiOverload F1 1');
|
||||
verify.completionListContains('ambientF1', '(function) ambientF1(a: number): string (+ 2 overload(s))', 'This is ambient F1 1');
|
||||
|
||||
goTo.marker('66');
|
||||
verify.quickInfoIs("c1", "", "c1_i_1", "var");
|
||||
verify.quickInfoIs("(var) c1_i_1: c1", "");
|
||||
goTo.marker('67');
|
||||
verify.quickInfoIs("c2", "", "c2_i_2", "var");
|
||||
verify.quickInfoIs("(var) c2_i_2: c2", "");
|
||||
goTo.marker('68');
|
||||
verify.quickInfoIs("c3", "", "c3_i_2", "var");
|
||||
verify.quickInfoIs("(var) c3_i_2: c3", "");
|
||||
goTo.marker('69');
|
||||
verify.quickInfoIs("c4", "", "c4_i_1", "var");
|
||||
verify.quickInfoIs("(var) c4_i_1: c4", "");
|
||||
goTo.marker('70');
|
||||
verify.quickInfoIs("c5", "", "c5_i_1", "var");
|
||||
verify.quickInfoIs("(var) c5_i_1: c5", "");
|
||||
|
||||
goTo.marker('71');
|
||||
verify.quickInfoIs("(a: number): string (+ 2 overload(s))", "This is multiOverload F1 1", "multiOverload", "function");
|
||||
verify.quickInfoIs("(function) multiOverload(a: number): string (+ 2 overload(s))", "This is multiOverload F1 1");
|
||||
goTo.marker('72');
|
||||
verify.quickInfoIs("(b: string): string (+ 2 overload(s))", "This is multiOverload F1 2", "multiOverload", "function");
|
||||
verify.quickInfoIs("(function) multiOverload(b: string): string (+ 2 overload(s))", "This is multiOverload F1 2");
|
||||
goTo.marker('73');
|
||||
verify.quickInfoIs("(c: boolean): string (+ 2 overload(s))", "This is multiOverload F1 3", "multiOverload", "function");
|
||||
verify.quickInfoIs("(function) multiOverload(c: boolean): string (+ 2 overload(s))", "This is multiOverload F1 3");
|
||||
|
||||
goTo.marker('74');
|
||||
verify.quickInfoIs("(a: number): string (+ 2 overload(s))", "This is ambient F1 1", "ambientF1", "function");
|
||||
verify.quickInfoIs("(function) ambientF1(a: number): string (+ 2 overload(s))", "This is ambient F1 1");
|
||||
goTo.marker('75');
|
||||
verify.quickInfoIs("(b: string): string (+ 2 overload(s))", "This is ambient F1 2", "ambientF1", "function");
|
||||
verify.quickInfoIs("(function) ambientF1(b: string): string (+ 2 overload(s))", "This is ambient F1 2");
|
||||
goTo.marker('76');
|
||||
verify.quickInfoIs("(c: boolean): boolean (+ 2 overload(s))", "This is ambient F1 3", "ambientF1", "function");
|
||||
verify.quickInfoIs("(function) ambientF1(c: boolean): boolean (+ 2 overload(s))", "This is ambient F1 3");
|
||||
|
||||
goTo.marker('77');
|
||||
verify.quickInfoIs("i3", "", "aa", "parameter");
|
||||
verify.quickInfoIs("(parameter) aa: i3", "");
|
||||
|
||||
goTo.marker('78');
|
||||
verify.quickInfoIs("(a: number): c1 (+ 1 overload(s))", "", "c1", "constructor");
|
||||
verify.quickInfoIs("(constructor) c1(a: number): c1 (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('79');
|
||||
verify.quickInfoIs("(b: string): c1 (+ 1 overload(s))", "", "c1", "constructor");
|
||||
verify.quickInfoIs("(constructor) c1(b: string): c1 (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('80');
|
||||
verify.quickInfoIs("(a: number): c1 (+ 1 overload(s))", "", "c1", "constructor");
|
||||
verify.quickInfoIs("(constructor) c1(a: number): c1 (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('81');
|
||||
verify.quickInfoIs("(a: number): c2 (+ 1 overload(s))", "c2 1", "c2", "constructor");
|
||||
verify.quickInfoIs("(constructor) c2(a: number): c2 (+ 1 overload(s))", "c2 1");
|
||||
|
||||
goTo.marker('82');
|
||||
verify.quickInfoIs("(b: string): c2 (+ 1 overload(s))", "", "c2", "constructor");
|
||||
verify.quickInfoIs("(constructor) c2(b: string): c2 (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('83');
|
||||
verify.quickInfoIs("(a: number): c2 (+ 1 overload(s))", "c2 1", "c2", "constructor");
|
||||
verify.quickInfoIs("(constructor) c2(a: number): c2 (+ 1 overload(s))", "c2 1");
|
||||
|
||||
goTo.marker('84');
|
||||
verify.quickInfoIs("(a: number): c3 (+ 1 overload(s))", "", "c3", "constructor");
|
||||
verify.quickInfoIs("(constructor) c3(a: number): c3 (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('85');
|
||||
verify.quickInfoIs("(b: string): c3 (+ 1 overload(s))", "c3 2", "c3", "constructor");
|
||||
verify.quickInfoIs("(constructor) c3(b: string): c3 (+ 1 overload(s))", "c3 2");
|
||||
|
||||
goTo.marker('86');
|
||||
verify.quickInfoIs("(a: number): c3 (+ 1 overload(s))", "", "c3", "constructor");
|
||||
verify.quickInfoIs("(constructor) c3(a: number): c3 (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('87');
|
||||
verify.quickInfoIs("(a: number): c4 (+ 1 overload(s))", "c4 1", "c4", "constructor");
|
||||
verify.quickInfoIs("(constructor) c4(a: number): c4 (+ 1 overload(s))", "c4 1");
|
||||
|
||||
goTo.marker('88');
|
||||
verify.quickInfoIs("(b: string): c4 (+ 1 overload(s))", "c4 2", "c4", "constructor");
|
||||
verify.quickInfoIs("(constructor) c4(b: string): c4 (+ 1 overload(s))", "c4 2");
|
||||
|
||||
goTo.marker('89');
|
||||
verify.quickInfoIs("(a: number): c4 (+ 1 overload(s))", "c4 1", "c4", "constructor");
|
||||
verify.quickInfoIs("(constructor) c4(a: number): c4 (+ 1 overload(s))", "c4 1");
|
||||
|
||||
goTo.marker('90');
|
||||
verify.quickInfoIs("(a: number): c5 (+ 1 overload(s))", "c5 1", "c5", "constructor");
|
||||
verify.quickInfoIs("(constructor) c5(a: number): c5 (+ 1 overload(s))", "c5 1");
|
||||
|
||||
goTo.marker('91');
|
||||
verify.quickInfoIs("(b: string): c5 (+ 1 overload(s))", "c5 2", "c5", "constructor");
|
||||
verify.quickInfoIs("(constructor) c5(b: string): c5 (+ 1 overload(s))", "c5 2");
|
||||
|
||||
goTo.marker('92');
|
||||
verify.quickInfoIs("(a: number): c5 (+ 1 overload(s))", "c5 1", "c5", "constructor");
|
||||
verify.quickInfoIs("(constructor) c5(a: number): c5 (+ 1 overload(s))", "c5 1");
|
||||
|
||||
goTo.marker('93');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "c.prop1", "method");
|
||||
verify.quickInfoIs("(method) c.prop1(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('94');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "c.prop1", "method");
|
||||
verify.quickInfoIs("(method) c.prop1(b: string): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('95');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "c.prop1", "method");
|
||||
verify.quickInfoIs("(method) c.prop1(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('96');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "prop2 1", "c.prop2", "method");
|
||||
verify.quickInfoIs("(method) c.prop2(a: number): number (+ 1 overload(s))", "prop2 1");
|
||||
|
||||
goTo.marker('97');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "c.prop2", "method");
|
||||
verify.quickInfoIs("(method) c.prop2(b: string): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('98');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "prop2 1", "c.prop2", "method");
|
||||
verify.quickInfoIs("(method) c.prop2(a: number): number (+ 1 overload(s))", "prop2 1");
|
||||
|
||||
goTo.marker('99');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "c.prop3", "method");
|
||||
verify.quickInfoIs("(method) c.prop3(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('100');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "prop3 2", "c.prop3", "method");
|
||||
verify.quickInfoIs("(method) c.prop3(b: string): number (+ 1 overload(s))", "prop3 2");
|
||||
|
||||
goTo.marker('101');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "c.prop3", "method");
|
||||
verify.quickInfoIs("(method) c.prop3(a: number): number (+ 1 overload(s))", "");
|
||||
|
||||
goTo.marker('102');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "prop4 1", "c.prop4", "method");
|
||||
verify.quickInfoIs("(method) c.prop4(a: number): number (+ 1 overload(s))", "prop4 1");
|
||||
|
||||
goTo.marker('103');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "prop4 2", "c.prop4", "method");
|
||||
verify.quickInfoIs("(method) c.prop4(b: string): number (+ 1 overload(s))", "prop4 2");
|
||||
|
||||
goTo.marker('104');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "prop4 1", "c.prop4", "method");
|
||||
verify.quickInfoIs("(method) c.prop4(a: number): number (+ 1 overload(s))", "prop4 1");
|
||||
|
||||
goTo.marker('105');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "prop5 1", "c.prop5", "method");
|
||||
verify.quickInfoIs("(method) c.prop5(a: number): number (+ 1 overload(s))", "prop5 1");
|
||||
|
||||
goTo.marker('106');
|
||||
verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "prop5 2", "c.prop5", "method");
|
||||
verify.quickInfoIs("(method) c.prop5(b: string): number (+ 1 overload(s))", "prop5 2");
|
||||
|
||||
goTo.marker('107');
|
||||
verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "prop5 1", "c.prop5", "method");
|
||||
verify.quickInfoIs("(method) c.prop5(a: number): number (+ 1 overload(s))", "prop5 1");
|
|
@ -6,7 +6,12 @@
|
|||
//// /*3*/f(3);
|
||||
////}
|
||||
|
||||
[1, 2, 3].forEach((val) => {
|
||||
// Declaration is shown as type information
|
||||
goTo.marker("1");
|
||||
verify.quickInfoIs("(var) f: (x: number) => number", "");
|
||||
|
||||
// But the call sites show the signatures selected
|
||||
[2, 3].forEach((val) => {
|
||||
goTo.marker("" + val);
|
||||
verify.quickInfoIs("(var) f: (x: number) => number", "");
|
||||
verify.quickInfoIs("(function) f(x: number): number", "");
|
||||
} );
|
Loading…
Reference in a new issue