diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a3d90017272..7bf925bd8f2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -23,28 +23,34 @@ module ts { return undefined; } - interface SymbolWriter { - writeKind(text: string, kind: SymbolDisplayPartKind): void; - writeSymbol(text: string, symbol: Symbol): void; - writeLine(): void; - increaseIndent(): void; - decreaseIndent(): void; - clear(): void; - - // Called when the symbol writer encounters a symbol to write. Currently only used by the - // declaration emitter to help determine if it should patch up the final declaration file - // with import statements it previously saw (but chose not to emit). - trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; - } - - interface DisplayPartsSymbolWriter extends SymbolWriter { - displayParts(): SymbolDisplayPart[]; - } - - interface StringSymbolWriter extends SymbolWriter { + export interface StringSymbolWriter extends SymbolWriter { string(): string; } + // Pool writers to avoid needing to allocate them for every symbol we write. + var stringWriters: StringSymbolWriter[] = []; + export function getSingleLineStringWriter(): StringSymbolWriter { + if (stringWriters.length == 0) { + var str = ""; + + return { + string: () => str, + writeKind: text => str += text, + writeSymbol: text => str += text, + + // Completely ignore indentation for string writers. And map newlines to + // a single space. + writeLine: () => str += " ", + increaseIndent: () => { }, + decreaseIndent: () => { }, + clear: () => str = "", + trackSymbol: () => { } + }; + } + + return stringWriters.pop(); + } + /// 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. @@ -84,9 +90,9 @@ module ts { getTypeOfNode: getTypeOfNode, getApparentType: getApparentType, typeToString: typeToString, - typeToDisplayParts: typeToDisplayParts, + writeType: writeType, symbolToString: symbolToString, - symbolToDisplayParts: symbolToDisplayParts, + writeSymbol: writeSymbol, getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType, getRootSymbol: getRootSymbol, getContextualType: getContextualType, @@ -94,10 +100,15 @@ module ts { getResolvedSignature: getResolvedSignature, getEnumMemberValue: getEnumMemberValue, isValidPropertyAccess: isValidPropertyAccess, + getSignatureFromDeclaration: getSignatureFromDeclaration, + writeSignature: writeSignature, + writeTypeParameter: writeTypeParameter, + writeTypeParametersOfSymbol: writeTypeParametersOfSymbol, + isImplementationOfOverload: isImplementationOfOverload, getAliasedSymbol: resolveImport }; - var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); + var undefinedSymbol = createSymbol(SymbolFlags.Undefined | SymbolFlags.Property | SymbolFlags.Transient, "undefined"); var argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments"); var unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown"); var resolvingSymbol = createSymbol(SymbolFlags.Transient, "__resolving__"); @@ -923,58 +934,6 @@ module ts { { accessibility: SymbolAccessibility.NotAccessible, errorSymbolName: firstIdentifierName }; } - // Pool writers to avoid needing to allocate them for every symbol we write. - var displayPartWriters: DisplayPartsSymbolWriter[] = []; - var stringWriters: StringSymbolWriter[] = []; - - function getDisplayPartWriter(): DisplayPartsSymbolWriter { - if (displayPartWriters.length == 0) { - var displayParts: SymbolDisplayPart[] = []; - return { - displayParts: () => displayParts, - writeKind: (text, kind) => displayParts.push(new SymbolDisplayPart(text, kind, undefined)), - writeSymbol: (text, symbol) => displayParts.push(symbolPart(text, symbol)), - - // Completely ignore indentation for display part writers. And map newlines to - // a single space. - writeLine: () => displayParts.push(spacePart()), - increaseIndent: () => { }, - decreaseIndent: () => { }, - clear: () => displayParts = [], - trackSymbol: () => { } - }; - } - - return displayPartWriters.pop(); - } - - function getStringWriter(): StringSymbolWriter { - if (stringWriters.length == 0) { - var str = ""; - - return { - string: () => str, - writeKind: text => str += text, - writeSymbol: text => str += text, - - // Completely ignore indentation for string writers. And map newlines to - // a single space. - writeLine: () => str += " ", - increaseIndent: () => { }, - decreaseIndent: () => { }, - clear: () => str = "", - trackSymbol: () => { } - }; - } - - return stringWriters.pop(); - } - - function releaseDisplayPartWriter(writer: DisplayPartsSymbolWriter) { - writer.clear(); - displayPartWriters.push(writer); - } - function releaseStringWriter(writer: StringSymbolWriter) { writer.clear() stringWriters.push(writer); @@ -997,7 +956,7 @@ module ts { } function symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string { - var writer = getStringWriter(); + var writer = getSingleLineStringWriter(); writeSymbol(symbol, writer, enclosingDeclaration, meaning); var result = writer.string(); @@ -1006,20 +965,25 @@ module ts { return result; } - function symbolToDisplayParts(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): SymbolDisplayPart[] { - var writer = getDisplayPartWriter(); - writeSymbol(symbol, writer, enclosingDeclaration, meaning); - - var result = writer.displayParts(); - releaseDisplayPartWriter(writer); - - return result; - } - // Enclosing declaration is optional when we don't want to get qualified name in the enclosing declaration scope // Meaning needs to be specified if the enclosing declaration is given - function writeSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags): void { + function writeSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void { + var parentSymbol: Symbol; function writeSymbolName(symbol: Symbol): void { + if (parentSymbol) { + // Write type arguments of instantiated class/interface here + if (flags & SymbolFormatFlags.WriteTypeParametersOrArguments) { + if (symbol.flags & SymbolFlags.Instantiated) { + writeTypeArguments(getTypeParametersOfClassOrInterface(parentSymbol), + (symbol).mapper, writer, enclosingDeclaration); + } + else { + writeTypeParametersOfSymbol(parentSymbol, writer, enclosingDeclaration); + } + } + writePunctuation(writer, SyntaxKind.DotToken); + } + parentSymbol = symbol; if (symbol.declarations && symbol.declarations.length > 0) { var declaration = symbol.declarations[0]; if (declaration.name) { @@ -1031,16 +995,14 @@ module ts { writer.writeSymbol(symbol.name, symbol); } - // Let the writer know we just wrote out a symbol. The declarationemitter writer uses - // this to determine if an import it has previously seen (and not writter out) needs + // Let the writer know we just wrote out a symbol. The declaration emitter writer uses + // this to determine if an import it has previously seen (and not written out) needs // to be written to the file once the walk of the tree is complete. // // NOTE(cyrusn): This approach feels somewhat unfortunate. A simple pass over the tree - // up front (for example, during checking) could determien if we need to emit the imports + // up front (for example, during checking) could determine if we need to emit the imports // and we could then access that data during declaration emit. writer.trackSymbol(symbol, enclosingDeclaration, meaning); - - var needsDot = false; function walkSymbol(symbol: Symbol, meaning: SymbolFlags): void { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning); @@ -1056,26 +1018,21 @@ module ts { if (accessibleSymbolChain) { for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { - if (needsDot) { - writePunctuation(writer, SyntaxKind.DotToken); - } - writeSymbolName(accessibleSymbolChain[i]); - needsDot = true; } } else { // If we didn't find accessible symbol chain for this symbol, break if this is external module - if (!needsDot && ts.forEach(symbol.declarations, declaration => hasExternalModuleSymbol(declaration))) { + if (!parentSymbol && ts.forEach(symbol.declarations, declaration => hasExternalModuleSymbol(declaration))) { return; } - if (needsDot) { - writePunctuation(writer, SyntaxKind.DotToken); + // if this is anonymous type break + if (symbol.flags & SymbolFlags.TypeLiteral || symbol.flags & SymbolFlags.ObjectLiteral) { + return; } writeSymbolName(symbol); - needsDot = true; } } } @@ -1092,12 +1049,8 @@ module ts { return writeSymbolName(symbol); } - function writeSymbolToTextWriter(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, writer: TextWriter) { - writer.write(symbolToString(symbol, enclosingDeclaration, meaning)); - } - function typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string { - var writer = getStringWriter(); + var writer = getSingleLineStringWriter(); writeType(type, writer, enclosingDeclaration, flags); var result = writer.string(); @@ -1111,23 +1064,15 @@ module ts { return result; } - function typeToDisplayParts(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[] { - var writer = getDisplayPartWriter(); - writeType(type, writer, enclosingDeclaration, flags); + function writeType(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { + return writeType(type, flags | TypeFormatFlags.WriteArrowStyleSignature); - var result = writer.displayParts(); - releaseDisplayPartWriter(writer); - - return result; - } - - function writeType(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) { - var typeStack: Type[]; - return writeType(type, /*allowFunctionOrConstructorTypeLiteral*/ true); - - function writeType(type: Type, allowFunctionOrConstructorTypeLiteral: boolean) { + function writeType(type: Type, flags: TypeFormatFlags) { + // Write undefined/null type as any if (type.flags & TypeFlags.Intrinsic) { - writer.writeKind((type).intrinsicName, SymbolDisplayPartKind.keyword); + // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving + writer.writeKind(!(flags & TypeFormatFlags.WriteOwnNameForAnyLike) && + (type.flags & TypeFlags.Any) ? "any" : (type).intrinsicName, SymbolDisplayPartKind.keyword); } else if (type.flags & TypeFlags.Reference) { writeTypeReference(type); @@ -1139,7 +1084,7 @@ module ts { writeTupleType(type); } else if (type.flags & TypeFlags.Anonymous) { - writeAnonymousType(type, allowFunctionOrConstructorTypeLiteral); + writeAnonymousType(type, flags); } else if (type.flags & TypeFlags.StringLiteral) { writer.writeKind((type).text, SymbolDisplayPartKind.stringLiteral); @@ -1161,7 +1106,7 @@ module ts { writePunctuation(writer, SyntaxKind.CommaToken); writeSpace(writer); } - writeType(types[i], /*allowFunctionOrConstructorTypeLiteral*/ true); + writeType(types[i], flags | TypeFormatFlags.WriteArrowStyleSignature); } } @@ -1169,7 +1114,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); } @@ -1187,7 +1132,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); @@ -1205,7 +1150,7 @@ module ts { typeStack = []; } typeStack.push(type); - writeLiteralType(type, allowFunctionOrConstructorTypeLiteral); + writeLiteralType(type, flags); typeStack.pop(); } @@ -1233,7 +1178,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) { @@ -1242,15 +1187,15 @@ module ts { return; } - if (allowFunctionOrConstructorTypeLiteral) { + if (flags & TypeFormatFlags.WriteArrowStyleSignature) { if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { - writeSignature(resolved.callSignatures[0], /*arrowStyle*/ true); + 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], /*arrowStyle*/ true); + writeSignature(resolved.constructSignatures[0], writer, enclosingDeclaration, flags, typeStack); return; } } @@ -1260,7 +1205,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(); } @@ -1268,7 +1213,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(); } @@ -1282,7 +1227,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(); } @@ -1296,7 +1241,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(); } @@ -1310,7 +1255,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(); } @@ -1322,7 +1267,7 @@ module ts { } writePunctuation(writer, SyntaxKind.ColonToken); writeSpace(writer); - writeType(t, /*allowFunctionOrConstructorTypeLiteral*/ true); + writeType(t, flags | TypeFormatFlags.WriteArrowStyleSignature); writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } @@ -1330,59 +1275,93 @@ module ts { writer.decreaseIndent(); writePunctuation(writer, SyntaxKind.CloseBraceToken); } + } - 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 writeTypeParameter(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { + writeSymbol(tp.symbol, writer); + var constraint = getConstraintOfTypeParameter(tp); + if (constraint) { + writeSpace(writer); + writeKeyword(writer, SyntaxKind.ExtendsKeyword); + writeSpace(writer); + writeType(constraint, writer, enclosingDeclaration, flags, typeStack); + } + } + + function writeTypeParameters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, SyntaxKind.LessThanToken); + for (var i = 0; i < 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); - } - writeSymbol(p, writer); - if (p.valueDeclaration.flags & NodeFlags.QuestionMark || (p.valueDeclaration).initializer) { - writePunctuation(writer, SyntaxKind.QuestionToken); - } - writePunctuation(writer, SyntaxKind.ColonToken); - writeSpace(writer); + writeTypeParameter(typeParameters[i], writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, SyntaxKind.GreaterThanToken); + } + } - writeType(getTypeOfSymbol(p), /*allowFunctionOrConstructorTypeLiteral*/ true); + function writeTypeArguments(typeParameters: TypeParameter[], mapper: TypeMapper, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, SyntaxKind.LessThanToken); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, SyntaxKind.CommaToken); + writeSpace(writer); + } + writeType(mapper(typeParameters[i]), writer, enclosingDeclaration, TypeFormatFlags.WriteArrowStyleSignature); } + writePunctuation(writer, SyntaxKind.GreaterThanToken); + } + } - writePunctuation(writer, SyntaxKind.CloseParenToken); - if (arrowStyle) { + function writeTypeParametersOfSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) { + var rootSymbol = getRootSymbol(symbol); + if (rootSymbol.flags & SymbolFlags.Class || rootSymbol.flags & SymbolFlags.Interface) { + writeTypeParameters(getTypeParametersOfClassOrInterface(symbol), writer, enclosingDeclaraiton, flags); + } + } + + function writeSignature(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { + if (signature.target && (flags & TypeFormatFlags.WriteTypeArgumentsOfSignature)) { + // Instantiated signature, write type arguments instead + writeTypeArguments(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration); + } + else { + writeTypeParameters(signature.typeParameters, writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, SyntaxKind.OpenParenToken); + for (var i = 0; i < signature.parameters.length; i++) { + if (i > 0) { + writePunctuation(writer, SyntaxKind.CommaToken); writeSpace(writer); - writePunctuation(writer, SyntaxKind.EqualsGreaterThanToken); } - else { - writePunctuation(writer, SyntaxKind.ColonToken); + var p = signature.parameters[i]; + if (getDeclarationFlagsFromSymbol(p) & NodeFlags.Rest) { + writePunctuation(writer, SyntaxKind.DotDotDotToken); } + writeSymbol(p, writer); + if (p.valueDeclaration.flags & NodeFlags.QuestionMark || (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 { @@ -3894,9 +3873,21 @@ module ts { var func = parameter.parent; if (func.kind === SyntaxKind.FunctionExpression || func.kind === SyntaxKind.ArrowFunction) { if (isContextSensitiveExpression(func)) { - var signature = getContextualSignature(func); - if (signature) { - return getTypeAtPosition(signature, indexOf(func.parameters, parameter)); + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + + var funcHasRestParameters = hasRestParameters(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + + // If last parameter is contextually rest parameter get its type + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); + } } } } @@ -4529,8 +4520,21 @@ module ts { } else { error(node, Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); - return resolveErrorCall(node); } + + // No signature was applicable. We have already reported the errors for the invalid signature. + // If this is a type resolution session, e.g. Language Service, try to get better information that anySignature. + // Pick the first candidate that matches the arity. This way we can get a contextual type for cases like: + // declare function f(a: { xa: number; xb: number; }); + // f({ | + if (!fullTypeCheck) { + for (var i = 0, n = candidates.length; i < n; i++) { + if (signatureHasCorrectArity(node, candidates[i])) { + return candidates[i]; + } + } + } + return resolveErrorCall(node); // The candidate list orders groups in reverse, but within a group signatures are kept in declaration order @@ -7151,6 +7155,22 @@ module ts { return mapToArray(symbols); } + function isTypeDeclarationName(name: Node): boolean { + return name.kind == SyntaxKind.Identifier && + isTypeDeclaration(name.parent) && + (name.parent).name === name; + } + + function isTypeDeclaration(node: Node): boolean { + switch (node.kind) { + case SyntaxKind.TypeParameter: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.EnumDeclaration: + return true; + } + } + // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName: EntityName): boolean { var node: Node = entityName; @@ -7229,6 +7249,78 @@ module ts { return false; } + function isTypeNode(node: Node): boolean { + if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) { + return true; + } + + switch (node.kind) { + case SyntaxKind.AnyKeyword: + case SyntaxKind.NumberKeyword: + case SyntaxKind.StringKeyword: + case SyntaxKind.BooleanKeyword: + return true; + case SyntaxKind.VoidKeyword: + return node.parent.kind !== SyntaxKind.PrefixOperator; + case SyntaxKind.StringLiteral: + // Specialized signatures can have string literals as their parameters' type names + return node.parent.kind === SyntaxKind.Parameter; + + // Identifiers and qualified names may be type nodes, depending on their context. Climb + // above them to find the lowest container + case SyntaxKind.Identifier: + // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. + if (node.parent.kind === SyntaxKind.QualifiedName) { + node = node.parent; + } + // fall through + case SyntaxKind.QualifiedName: + // At this point, node is either a qualified name or an identifier + Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + + var parent = node.parent; + if (parent.kind === SyntaxKind.TypeQuery) { + return false; + } + // Do not recursively call isTypeNode on the parent. In the example: + // + // var a: A.B.C; + // + // Calling isTypeNode would consider the qualified name A.B a type node. Only C or + // A.B.C is a type node. + if (SyntaxKind.FirstTypeNode <= parent.kind && parent.kind <= SyntaxKind.LastTypeNode) { + return true; + } + switch (parent.kind) { + case SyntaxKind.TypeParameter: + return node === (parent).constraint; + case SyntaxKind.Property: + case SyntaxKind.Parameter: + case SyntaxKind.VariableDeclaration: + return node === (parent).type; + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.ArrowFunction: + case SyntaxKind.Constructor: + case SyntaxKind.Method: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return node === (parent).type; + case SyntaxKind.CallSignature: + case SyntaxKind.ConstructSignature: + case SyntaxKind.IndexSignature: + return node === (parent).type; + case SyntaxKind.TypeAssertion: + return node === (parent).type; + case SyntaxKind.CallExpression: + case SyntaxKind.NewExpression: + return (parent).typeArguments && (parent).typeArguments.indexOf(node) >= 0; + } + } + + return false; + } + function isInRightSideOfImportOrExportAssignment(node: EntityName) { while (node.parent.kind === SyntaxKind.QualifiedName) { node = node.parent; @@ -7595,34 +7687,17 @@ module ts { return undefined; } - // Create a single instance that we can wrap the underlying emitter TextWriter with. That - // way we don't have to allocate a new wrapper every time writeTypeAtLocation and - // writeReturnTypeOfSignatureDeclaration are called. - var emitSymbolWriter = { - writer: undefined, - - writeKind: function (text: string) { this.writer.write(text) }, - writeSymbol: function (text: string) { this.writer.write(text) }, - writeLine: function () { this.writer.writeLine() }, - increaseIndent: function () { this.writer.increaseIndent() }, - decreaseIndent: function () { this.writer.decreaseIndent() }, - clear: function () { }, - trackSymbol: function (symbol: Symbol, declaration: Node, meaning: SymbolFlags) { this.writer.trackSymbol(symbol, declaration, meaning) } - }; - - function writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter) { + function writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(location); var type = symbol && !(symbol.flags & SymbolFlags.TypeLiteral) ? getTypeOfSymbol(symbol) : getTypeFromTypeNode(location); - emitSymbolWriter.writer = writer; - writeType(type, emitSymbolWriter, enclosingDeclaration, flags); + writeType(type, writer, enclosingDeclaration, flags); } - function writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter) { + function writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { var signature = getSignatureFromDeclaration(signatureDeclaration); - emitSymbolWriter.writer = writer; - writeType(getReturnTypeOfSignature(signature), emitSymbolWriter, enclosingDeclaration, flags); + writeType(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function invokeEmitter(targetSourceFile?: SourceFile) { @@ -7680,49 +7755,4 @@ module ts { return checker; } - - export function spacePart() { - return new SymbolDisplayPart(" ", SymbolDisplayPartKind.space, undefined); - } - - export function keywordPart(kind: SyntaxKind) { - return new SymbolDisplayPart(tokenToString(kind), SymbolDisplayPartKind.keyword, undefined); - } - - export function punctuationPart(kind: SyntaxKind) { - return new SymbolDisplayPart(tokenToString(kind), SymbolDisplayPartKind.punctuation, undefined); - } - - export function operatorPart(kind: SyntaxKind) { - return new SymbolDisplayPart(tokenToString(kind), SymbolDisplayPartKind.operator, undefined); - } - - export function textPart(text: string) { - return new SymbolDisplayPart(text, SymbolDisplayPartKind.text, undefined); - } - - export function symbolPart(text: string, symbol: Symbol) { - return new SymbolDisplayPart(text, displayPartKind(symbol), symbol) - } - - function displayPartKind(symbol: Symbol): SymbolDisplayPartKind { - var flags = symbol.flags; - - if (flags & SymbolFlags.Variable) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === SyntaxKind.Parameter - ? SymbolDisplayPartKind.parameterName - : SymbolDisplayPartKind.localName; - } - else if (flags & SymbolFlags.Property) { return SymbolDisplayPartKind.propertyName; } - else if (flags & SymbolFlags.EnumMember) { return SymbolDisplayPartKind.enumMemberName; } - else if (flags & SymbolFlags.Function) { return SymbolDisplayPartKind.functionName; } - else if (flags & SymbolFlags.Class) { return SymbolDisplayPartKind.className; } - else if (flags & SymbolFlags.Interface) { return SymbolDisplayPartKind.interfaceName; } - else if (flags & SymbolFlags.Enum) { return SymbolDisplayPartKind.enumName; } - else if (flags & SymbolFlags.Module) { return SymbolDisplayPartKind.moduleName; } - else if (flags & SymbolFlags.Method) { return SymbolDisplayPartKind.methodName; } - else if (flags & SymbolFlags.TypeParameter) { return SymbolDisplayPartKind.typeParameterName; } - - return SymbolDisplayPartKind.text; - } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 1e1c57f5700..2b03636febb 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4,7 +4,9 @@ /// module ts { - interface EmitTextWriter extends TextWriter { + interface EmitTextWriter extends SymbolWriter { + write(s: string): void; + getText(): string; rawWrite(s: string): void; writeLiteral(s: string): void; getTextPos(): number; @@ -14,7 +16,7 @@ module ts { } var indentStrings: string[] = ["", " "]; - function getIndentString(level: number) { + export function getIndentString(level: number) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; } @@ -147,9 +149,17 @@ module ts { } } + function writeKind(text: string, kind: SymbolDisplayPartKind) { + write(text); + } + function writeSymbol(text: string, symbol: Symbol) { + write(text); + } return { write: write, trackSymbol: trackSymbol, + writeKind: writeKind, + writeSymbol: writeSymbol, rawWrite: rawWrite, writeLiteral: writeLiteral, writeLine: writeLine, @@ -160,6 +170,7 @@ module ts { getLine: () => lineCount + 1, getColumn: () => lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1, getText: () => output, + clear: () => { } }; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index a43f31e583a..392a13c26d9 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -391,100 +391,6 @@ module ts { return false; } - /** - * Note: this function only works when given a node with valid parent pointers. - */ - export function isTypeNode(node: Node): boolean { - if (node.kind >= SyntaxKind.FirstTypeNode && node.kind <= SyntaxKind.LastTypeNode) { - return true; - } - - switch (node.kind) { - case SyntaxKind.AnyKeyword: - case SyntaxKind.NumberKeyword: - case SyntaxKind.StringKeyword: - case SyntaxKind.BooleanKeyword: - return true; - case SyntaxKind.VoidKeyword: - return node.parent.kind !== SyntaxKind.PrefixOperator; - case SyntaxKind.StringLiteral: - // Specialized signatures can have string literals as their parameters' type names - return node.parent.kind === SyntaxKind.Parameter; - // Identifiers and qualified names may be type nodes, depending on their context. Climb - // above them to find the lowest container - case SyntaxKind.Identifier: - // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === SyntaxKind.QualifiedName) { - node = node.parent; - } - // Fall through - case SyntaxKind.QualifiedName: - // At this point, node is either a qualified name or an identifier - var parent = node.parent; - if (parent.kind === SyntaxKind.TypeQuery) { - return false; - } - // Do not recursively call isTypeNode on the parent. In the example: - // - // var a: A.B.C; - // - // Calling isTypeNode would consider the qualified name A.B a type node. Only C or - // A.B.C is a type node. - if (parent.kind >= SyntaxKind.FirstTypeNode && parent.kind <= SyntaxKind.LastTypeNode) { - return true; - } - switch (parent.kind) { - case SyntaxKind.TypeParameter: - return node === (parent).constraint; - case SyntaxKind.Property: - case SyntaxKind.Parameter: - case SyntaxKind.VariableDeclaration: - return node === (parent).type; - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.ArrowFunction: - case SyntaxKind.Constructor: - case SyntaxKind.Method: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - return node === (parent).type; - case SyntaxKind.CallSignature: - case SyntaxKind.ConstructSignature: - case SyntaxKind.IndexSignature: - return node === (parent).type; - case SyntaxKind.TypeAssertion: - return node === (parent).type; - case SyntaxKind.CallExpression: - case SyntaxKind.NewExpression: - return (parent).typeArguments && (parent).typeArguments.indexOf(node) >= 0; - } - } - - return false; - } - - /** - * Note: this function only works when given a node with valid parent pointers. - * - * returns true if the given identifier is the name of a type declaration node (class, interface, enum, type parameter, etc) - */ - export function isTypeDeclarationName(name: Node): boolean { - return name.kind == SyntaxKind.Identifier && - isTypeDeclaration(name.parent) && - (name.parent).name === name; - } - - - export function isTypeDeclaration(node: Node): boolean { - switch (node.kind) { - case SyntaxKind.TypeParameter: - case SyntaxKind.ClassDeclaration: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.EnumDeclaration: - return true; - } - } - export function getContainingFunction(node: Node): SignatureDeclaration { while (true) { node = node.parent; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index da2cb9099c2..2a291c828cd 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -643,14 +643,19 @@ module ts { getTypeOfNode(node: Node): Type; getApparentType(type: Type): ApparentType; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; + writeType(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; - typeToDisplayParts(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; - symbolToDisplayParts(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): SymbolDisplayPart[]; + writeSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; getFullyQualifiedName(symbol: Symbol): string; getAugmentedPropertiesOfApparentType(type: Type): Symbol[]; 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; + writeTypeParameter(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + writeTypeParametersOfSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: 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. @@ -660,20 +665,36 @@ module ts { getAliasedSymbol(symbol: Symbol): Symbol; } - export interface TextWriter { - write(s: string): void; - trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; + export interface SymbolWriter { + writeKind(text: string, kind: SymbolDisplayPartKind): void; + writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; decreaseIndent(): void; - getText(): string; + clear(): void; + + // Called when the symbol writer encounters a symbol to write. Currently only used by the + // declaration emitter to help determine if it should patch up the final declaration file + // with import statements it previously saw (but chose not to emit). + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; } export enum TypeFormatFlags { - None = 0x00000000, - WriteArrayAsGenericType = 0x00000001, // Write Array instead T[] - UseTypeOfFunction = 0x00000002, // Write typeof instead of function type literal - NoTruncation = 0x00000004, // Don't truncate typeToString result + None = 0x00000000, + WriteArrayAsGenericType = 0x00000001, // Write Array instead T[] + UseTypeOfFunction = 0x00000002, // Write typeof instead of function type literal + NoTruncation = 0x00000004, // Don't truncate typeToString result + WriteArrowStyleSignature = 0x00000008, // Write arrow style signature + WriteOwnNameForAnyLike = 0x00000010, // Write symbol's own name instead of 'any' for any like types (eg. unknown, __resolving__ etc) + WriteTypeArgumentsOfSignature = 0x00000020, // Write the type arguments instead of type parameters of the signature + } + + export enum SymbolFormatFlags { + None = 0x00000000, + WriteTypeParametersOrArguments = 0x00000001, // Write symbols's type argument if it is instantiated symbol + // eg. class C { p: T } <-- Show p as C.p here + // var a: C; + // var p = a.p; <--- Here p is property of C so show it as C.p instead of just C.p } export enum SymbolAccessibility { @@ -701,8 +722,8 @@ module ts { hasSemanticErrors(): boolean; isDeclarationVisible(node: Declaration): boolean; isImplementationOfOverload(node: FunctionDeclaration): boolean; - writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter): void; - writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter): void; + writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isImportDeclarationEntityNameReferenceDeclarationVisibile(entityName: EntityName): SymbolAccessiblityResult; @@ -743,6 +764,8 @@ module ts { Transient = 0x02000000, // Transient symbol (created during type check) Prototype = 0x04000000, // Symbol for the prototype property (without source code representation) + Undefined = 0x08000000, // Symbol for the undefined + Value = Variable | Property | EnumMember | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor, Type = Class | Interface | Enum | TypeLiteral | ObjectLiteral | TypeParameter, Namespace = ValueModule | NamespaceModule, @@ -1190,24 +1213,6 @@ 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 enum SymbolDisplayPartKind { aliasName, className, @@ -1215,20 +1220,17 @@ module ts { fieldName, interfaceName, keyword, - labelName, lineBreak, numericLiteral, stringLiteral, localName, methodName, moduleName, - namespaceName, operator, parameterName, propertyName, punctuation, space, - anonymousTypeIndicator, text, typeParameterName, enumMemberName, diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 84177cf6698..6a4e13b22e3 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -189,6 +189,9 @@ module FourSlash { } export var currentTestState: TestState = null; + function assertionMessage(msg: string) { + return "\nMarker: " + currentTestState.lastKnownMarker + "\nChecking: " + msg + "\n\n"; + } export class TestCancellationToken implements ts.CancellationToken { // 0 - cancelled @@ -527,17 +530,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(''); this.scenarioActions.push(''); - 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"); @@ -636,9 +639,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) { @@ -651,23 +654,19 @@ 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, assertionMessage("completion entry details text")); - 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, assertionMessage("completion entry documentation")); } if (kind !== undefined) { - assert.equal(details.kind, kind); + assert.equal(details.kind, kind, assertionMessage("completion entry kind")); } } @@ -766,45 +765,31 @@ module FourSlash { return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue; } - 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(''); this.scenarioActions.push(''); } }); - 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) : ""; if (negative) { - if (expectedTypeName !== undefined) { - assert.notEqual(actualQuickInfoMemberName, expectedTypeName, this.messageAtLastKnownMarker("quick info member name")); + if (expectedText !== undefined) { + assert.notEqual(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text")); } - if (docComment != undefined) { - assert.notEqual(actualQuickInfoDocComment, docComment, this.messageAtLastKnownMarker("quick info doc comment")); - } - if (symbolName !== undefined) { - assert.notEqual(actualQuickInfoSymbolName, symbolName, this.messageAtLastKnownMarker("quick info symbol name")); - } - if (kind !== undefined) { - assert.notEqual(actualQuickInfoKind, kind, this.messageAtLastKnownMarker("quick info kind")); + if (expectedDocumentation != undefined) { + assert.notEqual(actualQuickInfoDocumentation, expectedDocumentation, this.messageAtLastKnownMarker("quick info doc comment")); } } else { - if (expectedTypeName !== undefined) { - assert.equal(actualQuickInfoMemberName, expectedTypeName, this.messageAtLastKnownMarker("quick info member")); + if (expectedText !== undefined) { + assert.equal(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text")); } - if (docComment != undefined) { - assert.equal(actualQuickInfoDocComment, docComment, this.messageAtLastKnownMarker("quick info doc")); - } - if (symbolName !== undefined) { - assert.equal(actualQuickInfoSymbolName, symbolName, this.messageAtLastKnownMarker("quick info symbol name")); - } - if (kind !== undefined) { - assert.equal(actualQuickInfoKind, kind, this.messageAtLastKnownMarker("quick info kind")); + if (expectedDocumentation != undefined) { + assert.equal(actualQuickInfoDocumentation, expectedDocumentation, assertionMessage("quick info doc")); } } } @@ -844,7 +829,7 @@ module FourSlash { public verifyQuickInfoExists(negative: boolean) { 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'); @@ -862,9 +847,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) { @@ -888,7 +873,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) { @@ -896,7 +881,7 @@ module FourSlash { var activeParameter = this.getActiveParameter(); var activeParameterDocComment = activeParameter.documentation; - assert.equal(activeParameterDocComment, docComment); + assert.equal(ts.displayPartsToString(activeParameterDocComment), docComment, assertionMessage("current parameter Help DocComment")); } public verifyCurrentSignatureHelpParameterCount(expectedCount: number) { @@ -915,7 +900,7 @@ module FourSlash { this.taoInvalidReason = 'verifyCurrentSignatureHelpDocComment NYI'; var actualDocComment = this.getActiveSignatureHelpItem().documentation; - assert.equal(actualDocComment, docComment); + assert.equal(ts.displayPartsToString(actualDocComment), docComment, assertionMessage("current signature help doc comment")); } public verifySignatureHelpCount(expected: number) { @@ -1084,7 +1069,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)); } @@ -1755,7 +1740,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; @@ -1763,7 +1748,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'; @@ -1773,7 +1758,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'; @@ -2025,33 +2010,30 @@ 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(''); this.scenarioActions.push(''); - 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 (item.name === name) { + 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, assertionMessage("completion item 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, assertionMessage("completion item detail text")); } } if (kind !== undefined) { - assert.equal(item.kind, kind); + assert.equal(item.kind, kind, assertionMessage("completion item kind")); } return; @@ -2060,7 +2042,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) { diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 8169531c27e..5dfc75b29a5 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -86,7 +86,7 @@ class TypeWriterWalker { column: lineAndCharacter.character, syntaxKind: ts.SyntaxKind[node.kind], sourceText: sourceText, - type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation) + type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.WriteOwnNameForAnyLike) }); } diff --git a/src/services/compiler/references.ts b/src/services/compiler/references.ts index 07ec0fa6043..b2d605d595f 100644 --- a/src/services/compiler/references.ts +++ b/src/services/compiler/references.ts @@ -12,7 +12,6 @@ ///// ///// ///// -///// ///// ///// ///// diff --git a/src/services/compiler/types.ts b/src/services/compiler/types.ts deleted file mode 100644 index 28bef81629b..00000000000 --- a/src/services/compiler/types.ts +++ /dev/null @@ -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. -// - -/// - -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 += (memberName).text; - } - else if (memberName.isArray()) { - var ar = 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(); - } - } -} \ No newline at end of file diff --git a/src/services/services.ts b/src/services/services.ts index 703a05c62cb..b0c69aa99fe 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -23,7 +23,6 @@ /// /// /// -/// /// module ts { @@ -47,7 +46,7 @@ module ts { getFlags(): SymbolFlags; getName(): string; getDeclarations(): Declaration[]; - getDocumentationComment(): string; + getDocumentationComment(): SymbolDisplayPart[]; } export interface Type { @@ -67,6 +66,7 @@ module ts { getTypeParameters(): Type[]; getParameters(): Symbol[]; getReturnType(): Type; + getDocumentationComment(): SymbolDisplayPart[]; } export interface SourceFile { @@ -228,7 +228,7 @@ module ts { // 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: string; + documentationComment: SymbolDisplayPart[]; constructor(flags: SymbolFlags, name: string) { this.flags = flags; @@ -247,153 +247,309 @@ module ts { return this.declarations; } - getDocumentationComment(): string { + getDocumentationComment(): SymbolDisplayPart[] { if (this.documentationComment === undefined) { - var lines: string[] = []; - - // Get the doc comments from all the declarations of this symbol, and merge them - // into one single doc comment. - var declarations = this.getDeclarations(); - if (declarations) { - for (var i = 0, n = declarations.length; i < n; i++) { - this.processDocumentationCommentDeclaration(lines, declarations[i]); - } - } - - // TODO: get the newline info from the host. - this.documentationComment = lines.join("\r\n"); + this.documentationComment = getJsDocCommentsFromDeclarations(this.declarations, this.name, !(this.flags & SymbolFlags.Property)); } return this.documentationComment; } + } - private processDocumentationCommentDeclaration(lines: string[], declaration: Node) { - var commentRanges = getLeadingCommentRangesOfNode(declaration); - if (commentRanges) { - var sourceFile = declaration.getSourceFile(); - - for (var i = 0, n = commentRanges.length; i < n; i++) { - this.processDocumentationCommentRange( - lines, sourceFile, commentRanges[i]); - } + function getJsDocCommentsFromDeclarations(declarations: Declaration[], name: string, canUseParsedParamTagComments: boolean) { + var documentationComment = []; + var docComments = getJsDocCommentsSeparatedByNewLines(); + ts.forEach(docComments, docComment => { + if (documentationComment.length) { + documentationComment.push(lineBreakPart()); } - } + documentationComment.push(docComment); + }); - private processDocumentationCommentRange(lines: string[], sourceFile: SourceFile, commentRange: CommentRange) { - // We only care about well-formed /** */ comments - if (commentRange.end - commentRange.pos > "/**/".length && - sourceFile.text.substr(commentRange.pos, "/**".length) === "/**" && - sourceFile.text.substr(commentRange.end - "*/".length, "*/".length) === "*/") { + return documentationComment; - // Put a newline between each converted comment we join together. - if (lines.length) { - lines.push(""); + function getJsDocCommentsSeparatedByNewLines() { + var paramTag = "@param"; + var jsDocCommentParts: SymbolDisplayPart[] = []; + + 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 (canUseParsedParamTagComments && 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); + } + }); } - var startLineAndChar = sourceFile.getLineAndCharacterFromPosition(commentRange.pos); - var endLineAndChar = sourceFile.getLineAndCharacterFromPosition(commentRange.end); - - if (startLineAndChar.line === endLineAndChar.line) { - // A single line doc comment. Just extract the text between the - // comment markers and add that to the doc comment we're building - // up. - lines.push(sourceFile.text.substring(commentRange.pos + "/**".length, commentRange.end - "*/".length).trim()); + // If this is left side of dotted module declaration, there is no doc comments associated with this node + if (declaration.kind === SyntaxKind.ModuleDeclaration && (declaration).body.kind === SyntaxKind.ModuleDeclaration) { + return; } - else { - this.processMultiLineDocumentationCommentRange(sourceFile, commentRange, startLineAndChar, endLineAndChar, lines); - } - } - } - private processMultiLineDocumentationCommentRange( - sourceFile: SourceFile, commentRange: CommentRange, - startLineAndChar: { line: number; character: number }, - endLineAndChar: { line: number; character: number }, - lines: string[]) { + // If this is dotted module name, get the doc comments from the parent + while (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.parent.kind === SyntaxKind.ModuleDeclaration) { + declaration = declaration.parent; + } - // Comment spanned multiple lines. Find the leftmost character - // position in each line, and use that to determine what we should - // trim off, and what part of the line to keep. - // i.e. if the comment looks like: - // - // /** Foo - // * Bar - // * Baz - // */ - // - // Then we'll want to add: - // Foo - // Bar - // Baz - var trimLength: number = undefined; - for (var iLine = startLineAndChar.line + 1; iLine <= endLineAndChar.line; iLine++) { - var lineStart = sourceFile.getPositionFromLineAndCharacter(iLine, /*character:*/ 1); - var lineEnd = iLine === endLineAndChar.line - ? commentRange.end - "*/".length - : sourceFile.getPositionFromLineAndCharacter(iLine + 1, 1); - var docCommentTriviaLength = this.skipDocumentationCommentTrivia(sourceFile.text, lineStart, lineEnd); + // 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); + } + }); + }); - if (trimLength === undefined || (docCommentTriviaLength && docCommentTriviaLength < trimLength)) { - trimLength = docCommentTriviaLength; - } + 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 + }; + }); } - // Add the first line in. - var firstLine = sourceFile.text.substring( - commentRange.pos + "/**".length, - sourceFile.getPositionFromLineAndCharacter(startLineAndChar.line + 1, /*character:*/ 1)).trim(); - if (firstLine !== "") { - lines.push(firstLine); - } - - // For all the lines up to the last (but not including the last), add the contents - // of the line (with the length up to the - for (var iLine = startLineAndChar.line + 1; iLine < endLineAndChar.line; iLine++) { - var line = this.trimRight(sourceFile.text.substring( - sourceFile.getPositionFromLineAndCharacter(iLine, /*character*/ 1), - sourceFile.getPositionFromLineAndCharacter(iLine + 1, /*character*/ 1))).substr(trimLength); - - lines.push(line); - } - - // Add the last line if there is any actual text before the */ - var lastLine = this.trimRight(sourceFile.text.substring( - sourceFile.getPositionFromLineAndCharacter(endLineAndChar.line, /*character:*/ 1), - commentRange.end - "*/".length)).substr(trimLength); - - if (lastLine !== "") { - lines.push(lastLine); - } - } - - private trimRight(val: string) { - return val.replace(/(\n|\r|\s)+$/, ''); - } - - private skipDocumentationCommentTrivia(text: string, lineStart: number, lineEnd: number): number { - var seenAsterisk = false; - var lineLength = lineEnd - lineStart; - for (var i = 0; i < lineLength; i++) { - var char = text.charCodeAt(i + lineStart); - if (char === CharacterCodes.asterisk && !seenAsterisk) { - // Ignore the first asterisk we see. We want to trim out the line of *'s - // commonly seen at the start of a doc comment. - seenAsterisk = true; - continue; + function consumeWhiteSpacesOnTheLine(pos: number, end: number, sourceFile: SourceFile, maxSpacesToRemove?: number) { + if (maxSpacesToRemove !== undefined) { + end = Math.min(end, pos + maxSpacesToRemove); } - else if (isLineBreak(char)) { - // This was a blank line. Just ignore it wrt computing the leading whitespace to - // trim. - break; + + for (; pos < end; pos++) { + var ch = sourceFile.text.charCodeAt(pos); + if (!isWhiteSpace(ch) || isLineBreak(ch)) { + // Either found lineBreak or non whiteSpace + return pos; + } } - else if (!isWhiteSpace(char)) { - // Found a real doc comment character. Keep track of it so we can determine how - // much of the doc comment leading trivia to trim off. - return i; + + 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; + } + + // 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; + } + } + + // Next character + pos++; + } + + return paramDocComments; + + function consumeWhiteSpaces(pos: number) { + while (pos < end && isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos++; + } + + return pos; + } + + 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); + } + } } } - - return undefined; } } @@ -444,6 +600,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; } @@ -459,6 +620,17 @@ 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 : "", + /*canUseParsedParamTagComments*/ false) : []; + } + + return this.documentationComment; + } } var incrementalParse: IncrementalParse = TypeScript.IncrementalParser.parse; @@ -671,9 +843,6 @@ module ts { getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; - // Obsolete. Use getQuickInfoAtPosition instead. - getTypeAtPosition(fileName: string, position: number): TypeInfo; - getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TypeScript.TextSpan; getBreakpointStatementAtPosition(fileName: string, position: number): TypeScript.TextSpan; @@ -825,11 +994,10 @@ module ts { containerKind: string; containerName: string; } - - export interface MemberName { - prefix: string; - suffix: string; + + export interface SymbolDisplayPart { text: string; + kind: string; } export interface QuickInfo { @@ -840,14 +1008,6 @@ module ts { documentation: SymbolDisplayPart[]; } - export interface TypeInfo { - memberName: TypeScript.MemberName; - docComment: string; - fullSymbolName: string; - kind: string; - textSpan: TypeScript.TextSpan; - } - export interface RenameInfo { canRename: boolean; localizedErrorMessage: string; @@ -907,9 +1067,8 @@ module ts { name: string; kind: string; // see ScriptElementKind kindModifiers: string; // see ScriptElementKindModifier, comma separated - type: string; - fullSymbolName: string; - docComment: string; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; } export interface EmitOutput { @@ -1100,9 +1259,9 @@ module ts { filename: string; // the file where the completion was requested position: number; // position in the file where the completion was requested entries: CompletionEntry[]; // entries for this completion - symbols: Map; // symbols by entry name map - location: Node; // the node where the completion was requested - typeChecker: TypeChecker;// the typeChecker used to generate this completion + symbols: Map; // symbols by entry name map + location: Node; // the node where the completion was requested + typeChecker: TypeChecker; // the typeChecker used to generate this completion } interface FormattingOptions { @@ -1126,6 +1285,176 @@ module ts { owners: string[]; } + export function displayPartsToString(displayParts: SymbolDisplayPart[]) { + if (displayParts) { + return map(displayParts, displayPart => displayPart.text).join(""); + } + + return ""; + } + + interface DisplayPartsSymbolWriter extends SymbolWriter { + displayParts(): SymbolDisplayPart[]; + } + + var displayPartWriter = getDisplayPartWriter(); + function getDisplayPartWriter(): DisplayPartsSymbolWriter { + var displayParts: SymbolDisplayPart[]; + var lineStart: boolean; + var indent: number; + + resetWriter(); + return { + displayParts: () => displayParts, + writeKind: writeKind, + writeSymbol: writeSymbol, + writeLine: writeLine, + increaseIndent: () => { indent++; }, + decreaseIndent: () => { indent--; }, + clear: resetWriter, + trackSymbol: () => { } + }; + + function writeIndent() { + if (lineStart) { + displayParts.push(displayPart(getIndentString(indent), SymbolDisplayPartKind.space)); + lineStart = false; + } + } + + function writeKind(text: string, kind: SymbolDisplayPartKind) { + writeIndent(); + displayParts.push(displayPart(text, kind)); + } + + function writeSymbol(text: string, symbol: Symbol) { + writeIndent(); + displayParts.push(symbolPart(text, symbol)); + } + + function writeLine() { + displayParts.push(lineBreakPart()); + lineStart = true; + } + + function resetWriter() { + displayParts = [] + lineStart = true; + indent = 0; + } + } + + function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart { + return { + text: text, + kind: SymbolDisplayPartKind[kind] + }; + } + + export function spacePart() { + return displayPart(" ", SymbolDisplayPartKind.space); + } + + export function keywordPart(kind: SyntaxKind) { + return displayPart(tokenToString(kind), SymbolDisplayPartKind.keyword); + } + + export function punctuationPart(kind: SyntaxKind) { + return displayPart(tokenToString(kind), SymbolDisplayPartKind.punctuation); + } + + export function operatorPart(kind: SyntaxKind) { + return displayPart(tokenToString(kind), SymbolDisplayPartKind.operator); + } + + export function textPart(text: string) { + return displayPart(text, SymbolDisplayPartKind.text); + } + + export function lineBreakPart() { + return displayPart("\n", SymbolDisplayPartKind.lineBreak); + } + + function isFirstDeclarationOfSymbolParameter(symbol: Symbol) { + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === SyntaxKind.Parameter; + } + + function isLocalVariableOrFunction(symbol: Symbol) { + if (symbol.parent) { + return false; // This is exported symbol + } + + return ts.forEach(symbol.declarations, declaration => { + // Function expressions are local + if (declaration.kind === SyntaxKind.FunctionExpression) { + return true; + } + + if (declaration.kind !== SyntaxKind.VariableDeclaration && declaration.kind !== SyntaxKind.FunctionDeclaration) { + return false; + } + + // If the parent is not sourceFile or module block it is local variable + for (var parent = declaration.parent; parent.kind !== SyntaxKind.FunctionBlock; parent = parent.parent) { + // Reached source file or module block + if (parent.kind === SyntaxKind.SourceFile || parent.kind === SyntaxKind.ModuleBlock) { + return false; + } + } + + // parent is in function block + return true; + }); + } + + export function symbolPart(text: string, symbol: Symbol) { + return displayPart(text, displayPartKind(symbol), symbol); + + function displayPartKind(symbol: Symbol): SymbolDisplayPartKind { + var flags = symbol.flags; + + if (flags & SymbolFlags.Variable) { + return isFirstDeclarationOfSymbolParameter(symbol) ? SymbolDisplayPartKind.parameterName : SymbolDisplayPartKind.localName; + } + else if (flags & SymbolFlags.Property) { return SymbolDisplayPartKind.propertyName; } + else if (flags & SymbolFlags.EnumMember) { return SymbolDisplayPartKind.enumMemberName; } + else if (flags & SymbolFlags.Function) { return SymbolDisplayPartKind.functionName; } + else if (flags & SymbolFlags.Class) { return SymbolDisplayPartKind.className; } + else if (flags & SymbolFlags.Interface) { return SymbolDisplayPartKind.interfaceName; } + else if (flags & SymbolFlags.Enum) { return SymbolDisplayPartKind.enumName; } + else if (flags & SymbolFlags.Module) { return SymbolDisplayPartKind.moduleName; } + else if (flags & SymbolFlags.Method) { return SymbolDisplayPartKind.methodName; } + else if (flags & SymbolFlags.TypeParameter) { return SymbolDisplayPartKind.typeParameterName; } + + return SymbolDisplayPartKind.text; + } + } + + function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[] { + writeDisplayParts(displayPartWriter); + var result = displayPartWriter.displayParts(); + displayPartWriter.clear(); + return result; + } + + export function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[] { + return mapToDisplayParts(writer => { + typechecker.writeType(type, writer, enclosingDeclaration, flags); + }); + } + + export function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[] { + return mapToDisplayParts(writer => { + typeChecker.writeSymbol(symbol, writer, enclosingDeclaration, meaning, flags); + }); + } + + function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]{ + return mapToDisplayParts(writer => { + typechecker.writeSignature(signature, writer, enclosingDeclaration, flags); + }); + } + export function getDefaultCompilerOptions(): CompilerOptions { // Set "ES5" target by default for language service return { @@ -1639,11 +1968,12 @@ module ts { (node.parent.kind === SyntaxKind.ImportDeclaration && (node.parent).externalModuleName === node)); } - enum SearchMeaning { + enum SemanticMeaning { None = 0x0, Value = 0x1, Type = 0x2, - Namespace = 0x4 + Namespace = 0x4, + All = Value | Type | Namespace } enum BreakContinueSearchType { @@ -1663,11 +1993,6 @@ module ts { }); } - export function getSymbolDocumentationDisplayParts(symbol: Symbol): SymbolDisplayPart[] { - var documentation = symbol.getDocumentationComment(); - return documentation === "" ? [] : [new SymbolDisplayPart(documentation, SymbolDisplayPartKind.text, /*symbol:*/ null)]; - } - export function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry): LanguageService { var syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host); var formattingRulesProvider: TypeScript.Services.Formatting.RulesProvider; @@ -1934,16 +2259,20 @@ module ts { return undefined; } + // TODO(drosen): Right now we just permit *all* semantic meanings when calling 'getSymbolKind' + // which is permissible given that it is backwards compatible; but really we should consider + // passing the meaning for the node so that we don't report that a suggestion for a value is an interface. + // We COULD also just do what 'getSymbolModifiers' does, which is to use the first declaration. return { name: displayName, - kind: getSymbolKind(symbol), + kind: getSymbolKind(symbol, SemanticMeaning.All), kindModifiers: getSymbolModifiers(symbol) }; } function getCompletionsAtPosition(filename: string, position: number, isMemberCompletion: boolean) { function getCompletionEntriesFromSymbols(symbols: Symbol[], session: CompletionSession): void { - forEach(symbols, (symbol) => { + forEach(symbols, symbol => { var entry = createCompletionEntry(symbol); if (entry && !lookUp(session.symbols, entry.name)) { session.entries.push(entry); @@ -2162,9 +2491,16 @@ module ts { } // TODO: this is a hack for now, we need a proper walking mechanism to verify that we have the correct node - var mappedNode = getTouchingToken(sourceFile, TypeScript.end(node) - 1); - if (isPunctuation(mappedNode.kind)) { - mappedNode = mappedNode.parent; + var precedingToken = findTokenOnLeftOfPosition(sourceFile, TypeScript.end(node)); + var mappedNode: Node; + if (!precedingToken) { + mappedNode = sourceFile; + } + else if (isPunctuation(precedingToken.kind)) { + mappedNode = precedingToken.parent; + } + else { + mappedNode = precedingToken; } Debug.assert(mappedNode, "Could not map a Fidelity node to an AST node"); @@ -2260,7 +2596,7 @@ module ts { }; } - function getCompletionEntryDetails(filename: string, position: number, entryName: string) { + function getCompletionEntryDetails(filename: string, position: number, entryName: string): CompletionEntryDetails { // Note: No need to call synchronizeHostData, as we have captured all the data we need // in the getCompletionsAtPosition earlier filename = TypeScript.switchToForwardSlashes(filename); @@ -2277,13 +2613,17 @@ module ts { var type = session.typeChecker.getTypeOfSymbol(symbol); Debug.assert(type, "Could not find type for symbol"); var completionEntry = createCompletionEntry(symbol); + // TODO(drosen): Right now we just permit *all* semantic meanings when calling 'getSymbolKind' + // which is permissible given that it is backwards compatible; but really we should consider + // passing the meaning for the node so that we don't report that a suggestion for a value is an interface. + // We COULD also just do what 'getSymbolModifiers' does, which is to use the first declaration. + var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getSourceFile(filename), session.location, session.typeChecker, session.location, SemanticMeaning.All); return { name: entryName, - kind: completionEntry.kind, + kind: displayPartsDocumentationsAndSymbolKind.symbolKind, kindModifiers: completionEntry.kindModifiers, - type: session.typeChecker.typeToString(type, session.location), - fullSymbolName: typeInfoResolver.symbolToString(symbol, session.location), - docComment: "" + displayParts: displayPartsDocumentationsAndSymbolKind.displayParts, + documentation: displayPartsDocumentationsAndSymbolKind.documentation }; } else { @@ -2292,9 +2632,8 @@ module ts { name: entryName, kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none, - type: undefined, - fullSymbolName: entryName, - docComment: undefined + displayParts: [displayPart(entryName, SymbolDisplayPartKind.keyword)], + documentation: undefined }; } } @@ -2321,30 +2660,49 @@ module ts { } } - function getSymbolKind(symbol: Symbol): string { + function getSymbolKind(symbol: Symbol, meaningAtLocation: SemanticMeaning): string { var flags = typeInfoResolver.getRootSymbol(symbol).getFlags(); - if (flags & SymbolFlags.Module) return ScriptElementKind.moduleElement; if (flags & SymbolFlags.Class) return ScriptElementKind.classElement; - if (flags & SymbolFlags.Interface) return ScriptElementKind.interfaceElement; if (flags & SymbolFlags.Enum) return ScriptElementKind.enumElement; - if (flags & SymbolFlags.Variable) return ScriptElementKind.variableElement; - if (flags & SymbolFlags.Function) return ScriptElementKind.functionElement; + + // The following should only apply if encountered at a type position, + // and need to have precedence over other meanings if this is the case. + if (meaningAtLocation & SemanticMeaning.Type) { + if (flags & SymbolFlags.Interface) return ScriptElementKind.interfaceElement; + if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement; + } + + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags); + if (result === ScriptElementKind.unknown) { + if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement; + if (flags & SymbolFlags.EnumMember) return ScriptElementKind.variableElement; + if (flags & SymbolFlags.Import) return ScriptElementKind.alias; + } + + return result; + } + + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol: Symbol, flags: SymbolFlags) { + if (flags & SymbolFlags.Variable) { + if (isFirstDeclarationOfSymbolParameter(symbol)) { + return ScriptElementKind.parameterElement; + } + return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localVariableElement : ScriptElementKind.variableElement; + } + if (flags & SymbolFlags.Undefined) { + return ScriptElementKind.variableElement; + } + if (flags & SymbolFlags.Function) return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localFunctionElement : ScriptElementKind.functionElement; if (flags & SymbolFlags.GetAccessor) return ScriptElementKind.memberGetAccessorElement; if (flags & SymbolFlags.SetAccessor) return ScriptElementKind.memberSetAccessorElement; if (flags & SymbolFlags.Method) return ScriptElementKind.memberFunctionElement; if (flags & SymbolFlags.Property) return ScriptElementKind.memberVariableElement; - if (flags & SymbolFlags.IndexSignature) return ScriptElementKind.indexSignatureElement; - if (flags & SymbolFlags.ConstructSignature) return ScriptElementKind.constructSignatureElement; - if (flags & SymbolFlags.CallSignature) return ScriptElementKind.callSignatureElement; if (flags & SymbolFlags.Constructor) return ScriptElementKind.constructorImplementationElement; - if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement; - if (flags & SymbolFlags.EnumMember) return ScriptElementKind.variableElement; - if (flags & SymbolFlags.Import) return ScriptElementKind.alias; return ScriptElementKind.unknown; } - + function getTypeKind(type: Type): string { var flags = type.getFlags(); @@ -2387,9 +2745,272 @@ module ts { : ScriptElementKindModifier.none; } + function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol: Symbol, sourceFile: SourceFile, enclosingDeclaration: Node, + typeResolver: TypeChecker, location: Node, + // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location + semanticMeaning = getMeaningFromLocation(location)) { + var displayParts: SymbolDisplayPart[] = []; + var documentation: SymbolDisplayPart[]; + var symbolFlags = typeResolver.getRootSymbol(symbol).flags; + 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) { + symbolKind = ScriptElementKind.memberVariableElement; + } + else if (symbol.name === "undefined") { + // undefined is symbol and not property + symbolKind = ScriptElementKind.variableElement; + } + + 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 && (location.parent).right === location) { + location = location.parent; + } + 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.target || signature)) { + // Get the first signature if there + signature = allSignatures.length ? allSignatures[0] : undefined; + } + + if (signature) { + if (useConstructSignatures && (symbolFlags & SymbolFlags.Class)) { + // Constructor + symbolKind = ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + + switch (symbolKind) { + case ScriptElementKind.memberVariableElement: + case ScriptElementKind.variableElement: + case ScriptElementKind.parameterElement: + case ScriptElementKind.localVariableElement: + // If it is call or construct signature of lambda's write type name + displayParts.push(punctuationPart(SyntaxKind.ColonToken)); + displayParts.push(spacePart()); + if (useConstructSignatures) { + displayParts.push(keywordPart(SyntaxKind.NewKeyword)); + displayParts.push(spacePart()); + } + if (!(type.flags & TypeFlags.Anonymous)) { + displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments)); + } + addSignatureDisplayParts(signature, allSignatures, TypeFormatFlags.WriteArrowStyleSignature); + break; + + default: + // Just signature + addSignatureDisplayParts(signature, allSignatures); + } + hasAddedSymbolInfo = true; + } + } + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & SymbolFlags.Accessor)) || // 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 = 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, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments)); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if ((symbolFlags & SymbolFlags.Interface) && (semanticMeaning & SemanticMeaning.Type)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(keywordPart(SyntaxKind.InterfaceKeyword)); + displayParts.push(spacePart()); + displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, sourceFile, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments)); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if (symbolFlags & SymbolFlags.Enum) { + addNewLineIfDisplayPartsExist(); + displayParts.push(keywordPart(SyntaxKind.EnumKeyword)); + displayParts.push(spacePart()); + displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, sourceFile)); + } + if (symbolFlags & SymbolFlags.Module) { + addNewLineIfDisplayPartsExist(); + displayParts.push(keywordPart(SyntaxKind.ModuleKeyword)); + displayParts.push(spacePart()); + displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, sourceFile)); + } + if ((symbolFlags & SymbolFlags.TypeParameter) && (semanticMeaning & SemanticMeaning.Type)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + displayParts.push(textPart("type parameter")); + displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + displayParts.push(spacePart()); + displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, enclosingDeclaration)); + displayParts.push(spacePart()); + displayParts.push(keywordPart(SyntaxKind.InKeyword)); + displayParts.push(spacePart()); + if (symbol.parent) { + // Class/Interface type parameter + displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol.parent, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments)) + writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); + } + else { + // Method/function type parameter + var signatureDeclaration = getDeclarationOfKind(symbol, SyntaxKind.TypeParameter).parent; + var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); + if (signatureDeclaration.kind === SyntaxKind.ConstructSignature) { + displayParts.push(keywordPart(SyntaxKind.NewKeyword)); + displayParts.push(spacePart()); + } + else if (signatureDeclaration.kind !== SyntaxKind.CallSignature && signatureDeclaration.name) { + displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, signatureDeclaration.symbol, sourceFile, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments)) + } + displayParts.push.apply(displayParts, signatureToDisplayParts(typeResolver, signature, sourceFile, TypeFormatFlags.WriteTypeArgumentsOfSignature)); + } + } + if (symbolFlags & SymbolFlags.EnumMember) { + addPrefixForAnyFunctionOrVar(symbol, "enum member"); + var declaration = symbol.declarations[0]; + if (declaration.kind === SyntaxKind.EnumMember) { + var constantValue = typeResolver.getEnumMemberValue(declaration); + if (constantValue !== undefined) { + displayParts.push(spacePart()); + displayParts.push(operatorPart(SyntaxKind.EqualsToken)); + displayParts.push(spacePart()); + displayParts.push(displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); + } + } + } + if (symbolFlags & SymbolFlags.Import) { + addNewLineIfDisplayPartsExist(); + displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + displayParts.push(textPart("alias")); + displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + displayParts.push(spacePart()); + displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, sourceFile)); + } + if (!hasAddedSymbolInfo) { + if (symbolKind !== ScriptElementKind.unknown) { + if (type) { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + if (symbolKind === ScriptElementKind.memberVariableElement || + symbolFlags & SymbolFlags.Variable) { + displayParts.push(punctuationPart(SyntaxKind.ColonToken)); + displayParts.push(spacePart()); + // If the type is type parameter, format it specially + if (type.symbol && type.symbol.flags & SymbolFlags.TypeParameter) { + var typeParameterParts = mapToDisplayParts(writer => { + typeResolver.writeTypeParameter(type, writer, enclosingDeclaration); + }); + displayParts.push.apply(displayParts, typeParameterParts); + } + else { + displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, type, enclosingDeclaration)); + } + } + else if (symbolFlags & SymbolFlags.Function || + symbolFlags & SymbolFlags.Method || + symbolFlags & SymbolFlags.Constructor || + symbolFlags & SymbolFlags.Signature || + symbolFlags & SymbolFlags.Accessor) { + var allSignatures = type.getCallSignatures(); + addSignatureDisplayParts(allSignatures[0], allSignatures); + } + } + } + else { + symbolKind = getSymbolKind(symbol, semanticMeaning); + } + } + + if (!documentation) { + documentation = symbol.getDocumentationComment(); + } + + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + + 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()); + // Write type parameters of class/Interface if it is property/method of the generic class/interface + displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, sourceFile, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments)); + } + } + + function addSignatureDisplayParts(signature: Signature, allSignatures: Signature[], flags?: TypeFormatFlags) { + displayParts.push.apply(displayParts, signatureToDisplayParts(typeResolver, signature, enclosingDeclaration, flags | TypeFormatFlags.WriteTypeArgumentsOfSignature)); + if (allSignatures.length > 1) { + displayParts.push(spacePart()); + displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); + displayParts.push(operatorPart(SyntaxKind.PlusToken)); + displayParts.push(displayPart((allSignatures.length - 1).toString(), SymbolDisplayPartKind.numericLiteral)); + displayParts.push(spacePart()); + displayParts.push(textPart(allSignatures.length === 2 ? "overload" : "overloads")); + displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); + } + documentation = signature.getDocumentationComment(); + } + + function writeTypeParametersOfSymbol(symbol: Symbol, enclosingDeclaration: Node) { + var typeParameterParts = mapToDisplayParts(writer => { + typeResolver.writeTypeParametersOfSymbol(symbol, writer, enclosingDeclaration); + }); + displayParts.push.apply(displayParts, typeParameterParts); + } + } + function getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { synchronizeHostData(); - + fileName = TypeScript.switchToForwardSlashes(fileName); var sourceFile = getSourceFile(fileName); var node = getTouchingPropertyName(sourceFile, position); @@ -2402,122 +3023,40 @@ module ts { return undefined; } - var documentationParts = getSymbolDocumentationDisplayParts(symbol); - - // Having all this logic here is pretty unclean. Consider moving to the roslyn model - // where all symbol display logic is encapsulated into visitors and options. - var totalParts: SymbolDisplayPart[] = []; - - if (symbol.flags & SymbolFlags.Class) { - totalParts.push(keywordPart(SyntaxKind.ClassKeyword)); - totalParts.push(spacePart()); - totalParts.push.apply(totalParts, typeInfoResolver.symbolToDisplayParts(symbol, sourceFile)); - } - else if (symbol.flags & SymbolFlags.Interface) { - totalParts.push(keywordPart(SyntaxKind.InterfaceKeyword)); - totalParts.push(spacePart()); - totalParts.push.apply(totalParts, typeInfoResolver.symbolToDisplayParts(symbol, sourceFile)); - } - else if (symbol.flags & SymbolFlags.Enum) { - totalParts.push(keywordPart(SyntaxKind.EnumKeyword)); - totalParts.push(spacePart()); - totalParts.push.apply(totalParts, typeInfoResolver.symbolToDisplayParts(symbol, sourceFile)); - } - else if (symbol.flags & SymbolFlags.Module) { - totalParts.push(keywordPart(SyntaxKind.ModuleKeyword)); - totalParts.push(spacePart()); - totalParts.push.apply(totalParts, typeInfoResolver.symbolToDisplayParts(symbol, sourceFile)); - } - else if (symbol.flags & SymbolFlags.TypeParameter) { - totalParts.push(punctuationPart(SyntaxKind.OpenParenToken)); - totalParts.push(new SymbolDisplayPart("type parameter", SymbolDisplayPartKind.text, undefined)); - totalParts.push(punctuationPart(SyntaxKind.CloseParenToken)); - totalParts.push(spacePart()); - totalParts.push.apply(totalParts, typeInfoResolver.symbolToDisplayParts(symbol)); - } - else { - totalParts.push(punctuationPart(SyntaxKind.OpenParenToken)); - var text: string; - - if (symbol.flags & SymbolFlags.Property) { text = "property" } - else if (symbol.flags & SymbolFlags.EnumMember) { text = "enum member" } - else if (symbol.flags & SymbolFlags.Function) { text = "function" } - else if (symbol.flags & SymbolFlags.Variable) { text = "variable" } - else if (symbol.flags & SymbolFlags.Method) { text = "method" } - - if (!text) { - return undefined; - } - - totalParts.push(new SymbolDisplayPart(text, SymbolDisplayPartKind.text, undefined)); - totalParts.push(punctuationPart(SyntaxKind.CloseParenToken)); - totalParts.push(spacePart()); - - totalParts.push.apply(totalParts, typeInfoResolver.symbolToDisplayParts(symbol, getContainerNode(node))); - - var type = typeInfoResolver.getTypeOfSymbol(symbol); - - if (symbol.flags & SymbolFlags.Property || - symbol.flags & SymbolFlags.Variable) { - - if (type) { - totalParts.push(punctuationPart(SyntaxKind.ColonToken)); - totalParts.push(spacePart()); - totalParts.push.apply(totalParts, typeInfoResolver.typeToDisplayParts(type, getContainerNode(node))); - } - } - else if (symbol.flags & SymbolFlags.Function || - symbol.flags & SymbolFlags.Method) { - if (type) { - totalParts.push.apply(totalParts, typeInfoResolver.typeToDisplayParts(type, getContainerNode(node))); - } - } - else if (symbol.flags & SymbolFlags.EnumMember) { - var declaration = symbol.declarations[0]; - if (declaration.kind === SyntaxKind.EnumMember) { - var constantValue = typeInfoResolver.getEnumMemberValue(declaration); - if (constantValue !== undefined) { - totalParts.push(spacePart()); - totalParts.push(operatorPart(SyntaxKind.EqualsToken)); - totalParts.push(spacePart()); - totalParts.push(new SymbolDisplayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral, undefined)); + var symbol = typeInfoResolver.getSymbolInfo(node); + if (!symbol) { + + // Try getting just type at this position and show + switch (node.kind) { + case SyntaxKind.Identifier: + case SyntaxKind.PropertyAccess: + case SyntaxKind.QualifiedName: + case SyntaxKind.ThisKeyword: + case SyntaxKind.SuperKeyword: + // For the identifiers/this/usper etc get the type at position + var type = typeInfoResolver.getTypeOfNode(node); + if (type) { + return { + kind: ScriptElementKind.unknown, + kindModifiers: ScriptElementKindModifier.none, + textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()), + displayParts: typeToDisplayParts(typeInfoResolver, type, getContainerNode(node)), + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + }; } - } } - } - return { - kind: getSymbolKind(symbol), - kindModifiers: getSymbolModifiers(symbol), - textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()), - displayParts: totalParts, - documentation: documentationParts - }; - } - - function getTypeAtPosition(fileName: string, position: number): TypeInfo { - synchronizeHostData(); - - fileName = TypeScript.switchToForwardSlashes(fileName); - var sourceFile = getSourceFile(fileName); - var node = getTouchingWord(sourceFile, position); - if (!node) { return undefined; } - var symbol = typeInfoResolver.getSymbolInfo(node); - var type = symbol && typeInfoResolver.getTypeOfSymbol(symbol); - if (type) { - return { - memberName: new TypeScript.MemberNameString(typeInfoResolver.typeToString(type)), - docComment: "", - fullSymbolName: typeInfoResolver.symbolToString(symbol, getContainerNode(node)), - kind: getSymbolKind(symbol), - textSpan: TypeScript.TextSpan.fromBounds(node.pos, node.end) - }; - } - - return undefined; + var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, getContainerNode(node), typeInfoResolver, node); + return { + kind: displayPartsDocumentationsAndKind.symbolKind, + kindModifiers: getSymbolModifiers(symbol), + textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()), + displayParts: displayPartsDocumentationsAndKind.displayParts, + documentation: displayPartsDocumentationsAndKind.documentation + }; } /// Goto definition @@ -2625,10 +3164,9 @@ module ts { var declarations = symbol.getDeclarations(); var symbolName = typeInfoResolver.symbolToString(symbol); // Do not get scoped name, just the name of the symbol - var symbolKind = getSymbolKind(symbol); + var symbolKind = getSymbolKind(symbol, getMeaningFromLocation(node)); var containerSymbol = symbol.parent; var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; - var containerKind = containerSymbol ? getSymbolKind(symbol) : ""; if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { @@ -3333,7 +3871,7 @@ module ts { searchSymbol: Symbol, searchText: string, searchLocation: Node, - searchMeaning: SearchMeaning, + searchMeaning: SemanticMeaning, findInStrings: boolean, findInComments: boolean, result: ReferenceEntry[]): void { @@ -3632,114 +4170,6 @@ module ts { return undefined; } - function getMeaningFromDeclaration(node: Declaration): SearchMeaning { - switch (node.kind) { - case SyntaxKind.Parameter: - case SyntaxKind.VariableDeclaration: - case SyntaxKind.Property: - case SyntaxKind.PropertyAssignment: - case SyntaxKind.EnumMember: - case SyntaxKind.Method: - case SyntaxKind.Constructor: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.ArrowFunction: - case SyntaxKind.CatchBlock: - return SearchMeaning.Value; - - case SyntaxKind.TypeParameter: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.TypeLiteral: - return SearchMeaning.Type; - - case SyntaxKind.ClassDeclaration: - case SyntaxKind.EnumDeclaration: - return SearchMeaning.Value | SearchMeaning.Type; - - case SyntaxKind.ModuleDeclaration: - if ((node).name.kind === SyntaxKind.StringLiteral) { - return SearchMeaning.Namespace | SearchMeaning.Value; - } - else if (isInstantiated(node)) { - return SearchMeaning.Namespace | SearchMeaning.Value; - } - else { - return SearchMeaning.Namespace; - } - break; - - case SyntaxKind.ImportDeclaration: - return SearchMeaning.Value | SearchMeaning.Type | SearchMeaning.Namespace; - } - Debug.fail("Unknown declaration type"); - } - - function isTypeReference(node: Node): boolean { - if (node.parent.kind === SyntaxKind.QualifiedName && (node.parent).right === node) - node = node.parent; - - return node.parent.kind === SyntaxKind.TypeReference; - } - - function isNamespaceReference(node: Node): boolean { - var root = node; - var isLastClause = true; - if (root.parent.kind === SyntaxKind.QualifiedName) { - while (root.parent && root.parent.kind === SyntaxKind.QualifiedName) - root = root.parent; - - isLastClause = (root).right === node; - } - - return root.parent.kind === SyntaxKind.TypeReference && !isLastClause; - } - - function isInRightSideOfImport(node: EntityName) { - while (node.parent.kind === SyntaxKind.QualifiedName) { - node = node.parent; - } - - return node.parent.kind === SyntaxKind.ImportDeclaration && (node.parent).entityName === node; - } - - function getMeaningFromRightHandSideOfImport(node: Node) { - Debug.assert(node.kind === SyntaxKind.Identifier); - - // import a = |b|; // Namespace - // import a = |b.c|; // Value, type, namespace - // import a = |b.c|.d; // Namespace - - if (node.parent.kind === SyntaxKind.QualifiedName && - (node.parent).right === node && - node.parent.parent.kind === SyntaxKind.ImportDeclaration) { - return SearchMeaning.Value | SearchMeaning.Type | SearchMeaning.Namespace; - } - return SearchMeaning.Namespace; - } - - function getMeaningFromLocation(node: Node): SearchMeaning { - if (node.parent.kind === SyntaxKind.ExportAssignment) { - return SearchMeaning.Value | SearchMeaning.Type | SearchMeaning.Namespace; - } - else if (isInRightSideOfImport(node)) { - return getMeaningFromRightHandSideOfImport(node); - } - else if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { - return getMeaningFromDeclaration(node.parent); - } - else if (isTypeReference(node)) { - return SearchMeaning.Type; - } - else if (isNamespaceReference(node)) { - return SearchMeaning.Namespace; - } - else { - return SearchMeaning.Value; - } - } - /** Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class * then we need to widen the search to include type positions as well. @@ -3747,7 +4177,7 @@ module ts { * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) * do not intersect in any of the three spaces. */ - function getIntersectingMeaningFromDeclarations(meaning: SearchMeaning, declarations: Declaration[]): SearchMeaning { + function getIntersectingMeaningFromDeclarations(meaning: SemanticMeaning, declarations: Declaration[]): SemanticMeaning { if (declarations) { do { // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] @@ -3957,6 +4387,114 @@ module ts { return emitOutput; } + function getMeaningFromDeclaration(node: Declaration): SemanticMeaning { + switch (node.kind) { + case SyntaxKind.Parameter: + case SyntaxKind.VariableDeclaration: + case SyntaxKind.Property: + case SyntaxKind.PropertyAssignment: + case SyntaxKind.EnumMember: + case SyntaxKind.Method: + case SyntaxKind.Constructor: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.ArrowFunction: + case SyntaxKind.CatchBlock: + return SemanticMeaning.Value; + + case SyntaxKind.TypeParameter: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeLiteral: + return SemanticMeaning.Type; + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.EnumDeclaration: + return SemanticMeaning.Value | SemanticMeaning.Type; + + case SyntaxKind.ModuleDeclaration: + if ((node).name.kind === SyntaxKind.StringLiteral) { + return SemanticMeaning.Namespace | SemanticMeaning.Value; + } + else if (isInstantiated(node)) { + return SemanticMeaning.Namespace | SemanticMeaning.Value; + } + else { + return SemanticMeaning.Namespace; + } + break; + + case SyntaxKind.ImportDeclaration: + return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; + } + Debug.fail("Unknown declaration type"); + } + + function isTypeReference(node: Node): boolean { + if (node.parent.kind === SyntaxKind.QualifiedName && (node.parent).right === node) + node = node.parent; + + return node.parent.kind === SyntaxKind.TypeReference; + } + + function isNamespaceReference(node: Node): boolean { + var root = node; + var isLastClause = true; + if (root.parent.kind === SyntaxKind.QualifiedName) { + while (root.parent && root.parent.kind === SyntaxKind.QualifiedName) + root = root.parent; + + isLastClause = (root).right === node; + } + + return root.parent.kind === SyntaxKind.TypeReference && !isLastClause; + } + + function isInRightSideOfImport(node: EntityName) { + while (node.parent.kind === SyntaxKind.QualifiedName) { + node = node.parent; + } + + return node.parent.kind === SyntaxKind.ImportDeclaration && (node.parent).entityName === node; + } + + function getMeaningFromRightHandSideOfImport(node: Node) { + Debug.assert(node.kind === SyntaxKind.Identifier); + + // import a = |b|; // Namespace + // import a = |b.c|; // Value, type, namespace + // import a = |b.c|.d; // Namespace + + if (node.parent.kind === SyntaxKind.QualifiedName && + (node.parent).right === node && + node.parent.parent.kind === SyntaxKind.ImportDeclaration) { + return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; + } + return SemanticMeaning.Namespace; + } + + function getMeaningFromLocation(node: Node): SemanticMeaning { + if (node.parent.kind === SyntaxKind.ExportAssignment) { + return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; + } + else if (isInRightSideOfImport(node)) { + return getMeaningFromRightHandSideOfImport(node); + } + else if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return getMeaningFromDeclaration(node.parent); + } + else if (isTypeReference(node)) { + return SemanticMeaning.Type; + } + else if (isNamespaceReference(node)) { + return SemanticMeaning.Namespace; + } + else { + return SemanticMeaning.Value; + } + } + // Signature help /** * This is a semantic operation. @@ -3981,7 +4519,7 @@ module ts { var formalSignatures: FormalSignatureItemInfo[] = []; forEach(signatureHelpItems.items, signature => { - var signatureInfoString = ts.SymbolDisplayPart.toString(signature.prefixDisplayParts); + var signatureInfoString = displayPartsToString(signature.prefixDisplayParts); var parameters: FormalParameterInfo[] = []; if (signature.parameters) { @@ -3990,29 +4528,29 @@ module ts { // add the parameter to the string if (i) { - signatureInfoString += ts.SymbolDisplayPart.toString(signature.separatorDisplayParts); + signatureInfoString += displayPartsToString(signature.separatorDisplayParts); } var start = signatureInfoString.length; - signatureInfoString += ts.SymbolDisplayPart.toString(parameter.displayParts); + signatureInfoString += displayPartsToString(parameter.displayParts); var end = signatureInfoString.length - 1; // add the parameter to the list parameters.push({ name: parameter.name, - isVariable: i == n - 1 && signature.isVariadic, - docComment: ts.SymbolDisplayPart.toString(parameter.documentation), + isVariable: i === n - 1 && signature.isVariadic, + docComment: displayPartsToString(parameter.documentation), minChar: start, limChar: end }); } } - signatureInfoString += ts.SymbolDisplayPart.toString(signature.suffixDisplayParts); + signatureInfoString += displayPartsToString(signature.suffixDisplayParts); formalSignatures.push({ signatureInfo: signatureInfoString, - docComment: ts.SymbolDisplayPart.toString(signature.documentation), + docComment: displayPartsToString(signature.documentation), parameters: parameters, typeParameters: [], }); @@ -4125,7 +4663,7 @@ module ts { return result; - function classifySymbol(symbol: Symbol, isInTypePosition: boolean) { + function classifySymbol(symbol: Symbol, meaningAtPosition: SemanticMeaning) { var flags = symbol.getFlags(); if (flags & SymbolFlags.Class) { @@ -4134,10 +4672,7 @@ module ts { else if (flags & SymbolFlags.Enum) { return ClassificationTypeNames.enumName; } - else if (flags & SymbolFlags.Module) { - return ClassificationTypeNames.moduleName; - } - else if (isInTypePosition) { + else if (meaningAtPosition & SemanticMeaning.Type) { if (flags & SymbolFlags.Interface) { return ClassificationTypeNames.interfaceName; } @@ -4145,6 +4680,9 @@ module ts { return ClassificationTypeNames.typeParameterName; } } + else if (flags & SymbolFlags.Module) { + return ClassificationTypeNames.moduleName; + } } function processNode(node: Node) { @@ -4153,7 +4691,7 @@ module ts { if (node.kind === SyntaxKind.Identifier && node.getWidth() > 0) { var symbol = typeInfoResolver.getSymbolInfo(node); if (symbol) { - var type = classifySymbol(symbol, isTypeNode(node) || isTypeDeclarationName(node)); + var type = classifySymbol(symbol, getMeaningFromLocation(node)); if (type) { result.push({ textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()), @@ -4614,7 +5152,7 @@ module ts { // Only allow a symbol to be renamed if it actually has at least one declaration. if (symbol && symbol.getDeclarations() && symbol.getDeclarations().length > 0) { - var kind = getSymbolKind(symbol); + var kind = getSymbolKind(symbol, getMeaningFromLocation(node)); if (kind) { return getRenameInfo(symbol.name, typeInfoResolver.getFullyQualifiedName(symbol), kind, getSymbolModifiers(symbol), @@ -4660,7 +5198,6 @@ module ts { getSemanticClassifications: getSemanticClassifications, getCompletionsAtPosition: getCompletionsAtPosition, getCompletionEntryDetails: getCompletionEntryDetails, - getTypeAtPosition: getTypeAtPosition, getSignatureHelpItems: getSignatureHelpItems, getQuickInfoAtPosition: getQuickInfoAtPosition, getDefinitionAtPosition: getDefinitionAtPosition, diff --git a/src/services/shims.ts b/src/services/shims.ts index bab9b98a983..fdea0202323 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -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; @@ -579,15 +576,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 /** diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 189d8d2e727..273cfda99b8 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -306,12 +306,12 @@ module ts.SignatureHelp { displayParts.push(punctuationPart(SyntaxKind.ColonToken)); displayParts.push(spacePart()); - var typeParts = typeInfoResolver.typeToDisplayParts(typeInfoResolver.getTypeOfSymbol(p), argumentListOrTypeArgumentList); + var typeParts = typeToDisplayParts(typeInfoResolver, typeInfoResolver.getTypeOfSymbol(p), argumentListOrTypeArgumentList); displayParts.push.apply(displayParts, typeParts); return { name: p.name, - documentation: getSymbolDocumentationDisplayParts(p), + documentation: p.getDocumentationComment(), displayParts: displayParts, isOptional: isOptional }; @@ -320,7 +320,7 @@ module ts.SignatureHelp { var callTargetNode = (argumentListOrTypeArgumentList.parent).func; var callTargetSymbol = typeInfoResolver.getSymbolInfo(callTargetNode); - var prefixParts = callTargetSymbol ? typeInfoResolver.symbolToDisplayParts(callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined) : []; + var prefixParts = callTargetSymbol ? symbolToDisplayParts(typeInfoResolver, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined) : []; var separatorParts = [punctuationPart(SyntaxKind.CommaToken), spacePart()]; @@ -346,7 +346,7 @@ module ts.SignatureHelp { suffixParts.push(punctuationPart(SyntaxKind.ColonToken)); suffixParts.push(spacePart()); - var typeParts = typeInfoResolver.typeToDisplayParts(candidateSignature.getReturnType(), argumentListOrTypeArgumentList); + var typeParts = typeToDisplayParts(typeInfoResolver, candidateSignature.getReturnType(), argumentListOrTypeArgumentList); suffixParts.push.apply(suffixParts, typeParts); return { @@ -355,7 +355,7 @@ module ts.SignatureHelp { suffixDisplayParts: suffixParts, separatorDisplayParts: separatorParts, parameters: parameterHelpItems, - documentation: null + documentation: candidateSignature.getDocumentationComment() }; }); diff --git a/tests/baselines/reference/constructorOverloads1.errors.txt b/tests/baselines/reference/constructorOverloads1.errors.txt index d72aac5bcd0..2e8c79d159a 100644 --- a/tests/baselines/reference/constructorOverloads1.errors.txt +++ b/tests/baselines/reference/constructorOverloads1.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/constructorOverloads1.ts(3,5): error TS2392: Multiple const tests/cases/compiler/constructorOverloads1.ts(4,5): error TS2392: Multiple constructor implementations are not allowed. tests/cases/compiler/constructorOverloads1.ts(7,5): error TS2392: Multiple constructor implementations are not allowed. tests/cases/compiler/constructorOverloads1.ts(16,18): error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'number'. -tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2345: Argument of type 'unknown[]' is not assignable to parameter of type 'number'. +tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2345: Argument of type 'any[]' is not assignable to parameter of type 'number'. ==== tests/cases/compiler/constructorOverloads1.ts (6 errors) ==== @@ -39,7 +39,7 @@ tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2345: Argument of !!! error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'number'. var f4 = new Foo([f1,f2,f3]); ~~~~~~~~~~ -!!! error TS2345: Argument of type 'unknown[]' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'any[]' is not assignable to parameter of type 'number'. f1.bar1(); f1.bar2(); diff --git a/tests/baselines/reference/contextuallyTypingRestParameters.errors.txt b/tests/baselines/reference/contextuallyTypingRestParameters.errors.txt new file mode 100644 index 00000000000..369d10e88c2 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypingRestParameters.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/contextuallyTypingRestParameters.ts(3,9): error TS2323: Type 'string[]' is not assignable to type 'string'. +tests/cases/compiler/contextuallyTypingRestParameters.ts(5,9): error TS2323: Type 'string[]' is not assignable to type 'string'. + + +==== tests/cases/compiler/contextuallyTypingRestParameters.ts (2 errors) ==== + var x: (...y: string[]) => void = function (.../*3*/y) { + var t = y; + var x2: string = t; // This should be error + ~~ +!!! error TS2323: Type 'string[]' is not assignable to type 'string'. + var x3: string[] = t; // No error + var y2: string = y; // This should be error + ~~ +!!! error TS2323: Type 'string[]' is not assignable to type 'string'. + var y3: string[] = y; // No error + }; \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypingRestParameters.js b/tests/baselines/reference/contextuallyTypingRestParameters.js new file mode 100644 index 00000000000..17561f5d7fc --- /dev/null +++ b/tests/baselines/reference/contextuallyTypingRestParameters.js @@ -0,0 +1,21 @@ +//// [contextuallyTypingRestParameters.ts] +var x: (...y: string[]) => void = function (.../*3*/y) { + var t = y; + var x2: string = t; // This should be error + var x3: string[] = t; // No error + var y2: string = y; // This should be error + var y3: string[] = y; // No error +}; + +//// [contextuallyTypingRestParameters.js] +var x = function () { + var y = []; + for (var _i = 0; _i < arguments.length; _i++) { + y[_i - 0] = arguments[_i]; + } + var t = y; + var x2 = t; // This should be error + var x3 = t; // No error + var y2 = y; // This should be error + var y3 = y; // No error +}; diff --git a/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt b/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt index 6e9247d5c45..be90535f14c 100644 --- a/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt +++ b/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt @@ -2,14 +2,14 @@ tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,5): error TS1098: Typ tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,6): error TS1005: '(' expected. tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,6): error TS1139: Type parameter declaration expected. tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(4,1): error TS1109: Expression expected. -tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(1,5): error TS2322: Type 'number' is not assignable to type '{ <>(): any; x: number; }': +tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(1,5): error TS2322: Type 'number' is not assignable to type '{ (): any; x: number; }': Property 'x' is missing in type 'Number'. ==== tests/cases/compiler/dontShowCompilerGeneratedMembers.ts (5 errors) ==== var f: { ~ -!!! error TS2322: Type 'number' is not assignable to type '{ <>(): any; x: number; }': +!!! error TS2322: Type 'number' is not assignable to type '{ (): any; x: number; }': !!! error TS2322: Property 'x' is missing in type 'Number'. x: number; <- diff --git a/tests/baselines/reference/genericConstraint2.errors.txt b/tests/baselines/reference/genericConstraint2.errors.txt index eda7a260679..e8635f24cee 100644 --- a/tests/baselines/reference/genericConstraint2.errors.txt +++ b/tests/baselines/reference/genericConstraint2.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/genericConstraint2.ts(5,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. tests/cases/compiler/genericConstraint2.ts(11,7): error TS2421: Class 'ComparableString' incorrectly implements interface 'Comparable': Property 'comparer' is missing in type 'ComparableString'. -tests/cases/compiler/genericConstraint2.ts(21,17): error TS2343: Type 'ComparableString' does not satisfy the constraint 'Comparable': +tests/cases/compiler/genericConstraint2.ts(21,17): error TS2343: Type 'ComparableString' does not satisfy the constraint 'Comparable': Property 'comparer' is missing in type 'ComparableString'. @@ -33,5 +33,5 @@ tests/cases/compiler/genericConstraint2.ts(21,17): error TS2343: Type 'Comparabl var b = new ComparableString("b"); var c = compare(a, b); ~~~~~~~~~~~~~~~~ -!!! error TS2343: Type 'ComparableString' does not satisfy the constraint 'Comparable': +!!! error TS2343: Type 'ComparableString' does not satisfy the constraint 'Comparable': !!! error TS2343: Property 'comparer' is missing in type 'ComparableString'. \ No newline at end of file diff --git a/tests/baselines/reference/lambdaArgCrash.errors.txt b/tests/baselines/reference/lambdaArgCrash.errors.txt index e8c7d5264e4..bf1c4dd01bd 100644 --- a/tests/baselines/reference/lambdaArgCrash.errors.txt +++ b/tests/baselines/reference/lambdaArgCrash.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/lambdaArgCrash.ts(27,25): error TS2304: Cannot find name 'ItemSet'. -tests/cases/compiler/lambdaArgCrash.ts(29,14): error TS2345: Argument of type '(items: unknown) => void' is not assignable to parameter of type '() => any'. +tests/cases/compiler/lambdaArgCrash.ts(29,14): error TS2345: Argument of type '(items: any) => void' is not assignable to parameter of type '() => any'. ==== tests/cases/compiler/lambdaArgCrash.ts (2 errors) ==== @@ -35,7 +35,7 @@ tests/cases/compiler/lambdaArgCrash.ts(29,14): error TS2345: Argument of type '( super.add(listener); ~~~~~~~~ -!!! error TS2345: Argument of type '(items: unknown) => void' is not assignable to parameter of type '() => any'. +!!! error TS2345: Argument of type '(items: any) => void' is not assignable to parameter of type '() => any'. } diff --git a/tests/baselines/reference/maxConstraints.errors.txt b/tests/baselines/reference/maxConstraints.errors.txt index c1d980b552e..1c3844d6974 100644 --- a/tests/baselines/reference/maxConstraints.errors.txt +++ b/tests/baselines/reference/maxConstraints.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/maxConstraints.ts(5,6): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. -tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. +tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. ==== tests/cases/compiler/maxConstraints.ts (2 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'nu var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; var maxResult = max2(1, 2); ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt index dc45b3237d7..77411f2c7b2 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt @@ -6,8 +6,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(18,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(21,5): error TS2412: Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: {}; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: unknown; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }': +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: {}; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }': Index signatures are incompatible: Type '{}' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(88,9): error TS2304: Cannot find name 'Myn'. @@ -107,7 +107,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo // error var b: { [x: number]: string; } = { ~ -!!! error TS2322: Type '{ [x: number]: {}; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: unknown; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }': +!!! error TS2322: Type '{ [x: number]: {}; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }': !!! error TS2322: Index signatures are incompatible: !!! error TS2322: Type '{}' is not assignable to type 'string'. a: '', diff --git a/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt b/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt index 021c5be324c..bd918de55fe 100644 --- a/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt +++ b/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/overloadsWithProvisionalErrors.ts(6,6): error TS2345: Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. tests/cases/compiler/overloadsWithProvisionalErrors.ts(7,17): error TS2304: Cannot find name 'blah'. -tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,6): error TS2345: Argument of type '(s: string) => { a: unknown; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. +tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,6): error TS2345: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cannot find name 'blah'. @@ -18,6 +18,6 @@ tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cann !!! error TS2304: Cannot find name 'blah'. func(s => ({ a: blah })); // Two errors here, one for blah not being defined, and one for the overload since it would not be applicable anyway ~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(s: string) => { a: unknown; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. +!!! error TS2345: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. ~~~~ !!! error TS2304: Cannot find name 'blah'. \ No newline at end of file diff --git a/tests/baselines/reference/undeclaredModuleError.errors.txt b/tests/baselines/reference/undeclaredModuleError.errors.txt index f340c18a5a9..9ce6cbfd89f 100644 --- a/tests/baselines/reference/undeclaredModuleError.errors.txt +++ b/tests/baselines/reference/undeclaredModuleError.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/undeclaredModuleError.ts(1,21): error TS2307: Cannot find external module 'fs'. -tests/cases/compiler/undeclaredModuleError.ts(8,29): error TS2345: Argument of type '() => void' is not assignable to parameter of type '(stat: unknown, name: string) => boolean'. +tests/cases/compiler/undeclaredModuleError.ts(8,29): error TS2345: Argument of type '() => void' is not assignable to parameter of type '(stat: any, name: string) => boolean'. tests/cases/compiler/undeclaredModuleError.ts(11,41): error TS2304: Cannot find name 'IDoNotExist'. @@ -17,7 +17,7 @@ tests/cases/compiler/undeclaredModuleError.ts(11,41): error TS2304: Cannot find ~~~~~~~ } , (error: Error, files: {}[]) => { ~~~~~~~~~ -!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '(stat: unknown, name: string) => boolean'. +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '(stat: any, name: string) => boolean'. files.forEach((file) => { var fullPath = join(IDoNotExist); ~~~~~~~~~~~ diff --git a/tests/cases/compiler/contextuallyTypingRestParameters.ts b/tests/cases/compiler/contextuallyTypingRestParameters.ts new file mode 100644 index 00000000000..bad36b47db2 --- /dev/null +++ b/tests/cases/compiler/contextuallyTypingRestParameters.ts @@ -0,0 +1,7 @@ +var x: (...y: string[]) => void = function (.../*3*/y) { + var t = y; + var x2: string = t; // This should be error + var x3: string[] = t; // No error + var y2: string = y; // This should be error + var y3: string[] = y; // No error +}; \ No newline at end of file diff --git a/tests/cases/fourslash/addInterfaceMemberAboveClass.ts b/tests/cases/fourslash/addInterfaceMemberAboveClass.ts index 68aa9cb8905..7da128c02be 100644 --- a/tests/cases/fourslash/addInterfaceMemberAboveClass.ts +++ b/tests/cases/fourslash/addInterfaceMemberAboveClass.ts @@ -11,11 +11,11 @@ //// } goTo.marker('className'); -verify.quickInfoSymbolNameIs('Sphere'); +verify.quickInfoIs('class Sphere'); goTo.marker('insertHere'); edit.insert("ray: Ray;"); goTo.marker('className'); -verify.quickInfoSymbolNameIs('Sphere'); \ No newline at end of file +verify.quickInfoIs('class Sphere'); \ No newline at end of file diff --git a/tests/cases/fourslash/addMemberToInterface.ts b/tests/cases/fourslash/addMemberToInterface.ts index dead2922287..e961c6a0cb3 100644 --- a/tests/cases/fourslash/addMemberToInterface.ts +++ b/tests/cases/fourslash/addMemberToInterface.ts @@ -12,10 +12,10 @@ edit.disableFormatting(); diagnostics.setEditValidation(IncrementalEditValidation.SyntacticOnly); goTo.marker('check'); -verify.quickInfoSymbolNameIs('Mod'); +verify.quickInfoIs('module Mod'); goTo.marker('insert'); edit.insert("x: number;\n"); goTo.marker('check'); -verify.quickInfoSymbolNameIs('Mod'); +verify.quickInfoIs('module Mod'); diff --git a/tests/cases/fourslash_old/addMemberToModule.ts b/tests/cases/fourslash/addMemberToModule.ts similarity index 91% rename from tests/cases/fourslash_old/addMemberToModule.ts rename to tests/cases/fourslash/addMemberToModule.ts index 8e306b8487a..6b0e0d0eef5 100644 --- a/tests/cases/fourslash_old/addMemberToModule.ts +++ b/tests/cases/fourslash/addMemberToModule.ts @@ -3,7 +3,7 @@ ////module A { //// /*var*/ ////} -////module A/*check*/ { +////module /*check*/A { //// var p; ////} diff --git a/tests/cases/fourslash/argumentsAreAvailableAfterEditsAtEndOfFunction.ts b/tests/cases/fourslash/argumentsAreAvailableAfterEditsAtEndOfFunction.ts index bc6997822fb..e3ab1388514 100644 --- a/tests/cases/fourslash/argumentsAreAvailableAfterEditsAtEndOfFunction.ts +++ b/tests/cases/fourslash/argumentsAreAvailableAfterEditsAtEndOfFunction.ts @@ -12,4 +12,4 @@ goTo.marker(); var text = "this.children = ch"; edit.insert(text); -verify.completionListContains("children", "string[]"); \ No newline at end of file +verify.completionListContains("children", "(parameter) children: string[]"); \ No newline at end of file diff --git a/tests/cases/fourslash/arrayCallAndConstructTypings.ts b/tests/cases/fourslash/arrayCallAndConstructTypings.ts index 5df918afe3b..40f9c066c14 100644 --- a/tests/cases/fourslash/arrayCallAndConstructTypings.ts +++ b/tests/cases/fourslash/arrayCallAndConstructTypings.ts @@ -13,31 +13,31 @@ goTo.marker('1'); -verify.quickInfoIs('any[]'); +verify.quickInfoIs('(var) a1: any[]'); goTo.marker('2'); -verify.quickInfoIs('any[]'); +verify.quickInfoIs('(var) a2: any[]'); goTo.marker('3'); -verify.quickInfoIs('boolean[]'); +verify.quickInfoIs('(var) a3: boolean[]'); goTo.marker('4'); -verify.quickInfoIs('boolean[]'); +verify.quickInfoIs('(var) a4: boolean[]'); goTo.marker('5'); -verify.quickInfoIs('string[]'); +verify.quickInfoIs('(var) a5: string[]'); goTo.marker('6'); -verify.quickInfoIs('any[]'); +verify.quickInfoIs('(var) a6: any[]'); goTo.marker('7'); -verify.quickInfoIs('any[]'); +verify.quickInfoIs('(var) a7: any[]'); goTo.marker('8'); -verify.quickInfoIs('boolean[]'); +verify.quickInfoIs('(var) a8: boolean[]'); goTo.marker('9'); -verify.quickInfoIs('boolean[]'); +verify.quickInfoIs('(var) a9: boolean[]'); goTo.marker('10'); -verify.quickInfoIs('string[]'); \ No newline at end of file +verify.quickInfoIs('(var) a10: string[]'); \ No newline at end of file diff --git a/tests/cases/fourslash/assertContextualType.ts b/tests/cases/fourslash/assertContextualType.ts index c6a2caaa245..36a59583825 100644 --- a/tests/cases/fourslash/assertContextualType.ts +++ b/tests/cases/fourslash/assertContextualType.ts @@ -6,4 +6,4 @@ edit.insert(''); goTo.marker(); -verify.quickInfoIs('any'); \ No newline at end of file +verify.quickInfoIs('(parameter) bb: any'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/augmentedTypesClass1.ts b/tests/cases/fourslash/augmentedTypesClass1.ts similarity index 60% rename from tests/cases/fourslash_old/augmentedTypesClass1.ts rename to tests/cases/fourslash/augmentedTypesClass1.ts index 4641813c615..54c0d75dd29 100644 --- a/tests/cases/fourslash_old/augmentedTypesClass1.ts +++ b/tests/cases/fourslash/augmentedTypesClass1.ts @@ -7,7 +7,7 @@ ////r./*2*/ goTo.marker('1'); -verify.completionListContains('prototype', 'c5b'); +verify.completionListContains('prototype', '(property) c5b.prototype: c5b'); edit.insert('y;'); goTo.marker('2'); -verify.completionListContains('foo', '(): void'); \ No newline at end of file +verify.completionListContains('foo', '(method) c5b.foo(): void'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/augmentedTypesClass2.ts b/tests/cases/fourslash/augmentedTypesClass2.ts similarity index 62% rename from tests/cases/fourslash_old/augmentedTypesClass2.ts rename to tests/cases/fourslash/augmentedTypesClass2.ts index 1256ebe4b37..cb9e5f7f572 100644 --- a/tests/cases/fourslash_old/augmentedTypesClass2.ts +++ b/tests/cases/fourslash/augmentedTypesClass2.ts @@ -7,7 +7,7 @@ ////r./*2*/ goTo.marker('1'); -verify.not.completionListContains('y', 'number'); +verify.not.completionListContains('y', '(var) y: number'); edit.backspace(4); goTo.marker('2'); -verify.completionListContains('foo', '(): void'); \ No newline at end of file +verify.completionListContains('foo', '(method) c5b.foo(): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/augmentedTypesClass3.ts b/tests/cases/fourslash/augmentedTypesClass3.ts new file mode 100644 index 00000000000..e26fe744624 --- /dev/null +++ b/tests/cases/fourslash/augmentedTypesClass3.ts @@ -0,0 +1,14 @@ +/// + +////class c/*1*/5b { public foo() { } } +////module c/*2*/5b { export var y = 2; } // should be ok +/////*3*/ + +goTo.marker('1'); +verify.quickInfoIs("class c5b\nmodule c5b"); + +goTo.marker('2'); +verify.quickInfoIs("class c5b\nmodule c5b"); + +goTo.marker('3'); +verify.completionListContains("c5b", "class c5b\nmodule c5b"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/augmentedTypesModule1.ts b/tests/cases/fourslash/augmentedTypesModule1.ts similarity index 79% rename from tests/cases/fourslash_old/augmentedTypesModule1.ts rename to tests/cases/fourslash/augmentedTypesModule1.ts index ca0e5aeb97c..0a56504b972 100644 --- a/tests/cases/fourslash_old/augmentedTypesModule1.ts +++ b/tests/cases/fourslash/augmentedTypesModule1.ts @@ -4,13 +4,12 @@ //// export interface I { foo(): void; } ////} ////var m1c = 1; // Should be allowed - ////var x: m1c./*1*/; -////var r/*2*/ = m1c; +////var /*2*/r = m1c; goTo.marker('1'); verify.completionListContains('I'); verify.not.completionListContains('foo'); goTo.marker('2'); -verify.quickInfoIs('number'); \ No newline at end of file +verify.quickInfoIs('(var) r: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/augmentedTypesModule2.ts b/tests/cases/fourslash/augmentedTypesModule2.ts index ca4d2db1423..6c2c63fff06 100644 --- a/tests/cases/fourslash/augmentedTypesModule2.ts +++ b/tests/cases/fourslash/augmentedTypesModule2.ts @@ -3,20 +3,20 @@ ////function /*11*/m2f(x: number) { }; ////module m2f { export interface I { foo(): void } } ////var x: m2f./*1*/ -////var r/*2*/ = m2f/*3*/; +////var /*2*/r = m2f/*3*/; -//goTo.marker('11'); -//verify.quickInfoIs('(x: number): void'); +goTo.marker('11'); +verify.quickInfoIs('(function) m2f(x: number): void\nmodule m2f'); -//goTo.marker('1'); -//verify.completionListContains('I'); +goTo.marker('1'); +verify.completionListContains('I'); -//edit.insert('I.'); -//verify.not.completionListContains('foo'); -//edit.backspace(1); +edit.insert('I.'); +verify.not.completionListContains('foo'); +edit.backspace(1); -//goTo.marker('2'); -//verify.quickInfoIs('typeof m2f'); +goTo.marker('2'); +verify.quickInfoIs('(var) r: (x: number) => void'); goTo.marker('3'); edit.insert('('); diff --git a/tests/cases/fourslash/augmentedTypesModule3.ts b/tests/cases/fourslash/augmentedTypesModule3.ts index 08d0b241ef1..b1640a41641 100644 --- a/tests/cases/fourslash/augmentedTypesModule3.ts +++ b/tests/cases/fourslash/augmentedTypesModule3.ts @@ -3,17 +3,17 @@ ////function m2g() { }; ////module m2g { export class C { foo(x: number) { } } } ////var x: m2g./*1*/; -////var r/*2*/ = m2g/*3*/; +////var /*2*/r = m2g/*3*/; -//goTo.marker('1'); -//verify.completionListContains('C'); +goTo.marker('1'); +verify.completionListContains('C'); -//edit.insert('C.'); -//verify.not.completionListContains('foo'); -//edit.backspace(1); +edit.insert('C.'); +verify.not.completionListContains('foo'); +edit.backspace(1); -//goTo.marker('2'); -//verify.quickInfoIs("typeof m2g", undefined, "r", "var"); +goTo.marker('2'); +verify.quickInfoIs("(var) r: typeof m2g"); goTo.marker('3'); edit.insert('('); diff --git a/tests/cases/fourslash_old/augmentedTypesModule4.ts b/tests/cases/fourslash/augmentedTypesModule4.ts similarity index 67% rename from tests/cases/fourslash_old/augmentedTypesModule4.ts rename to tests/cases/fourslash/augmentedTypesModule4.ts index 924c4920bdd..ffef24aa658 100644 --- a/tests/cases/fourslash_old/augmentedTypesModule4.ts +++ b/tests/cases/fourslash/augmentedTypesModule4.ts @@ -2,12 +2,12 @@ ////module m3d { export var y = 2; } ////declare class m3d { foo(): void } -////var r/*1*/ = new m3d(); +////var /*1*/r = new m3d(); ////r./*2*/ -////var r2/*4*/ = m3d./*3*/ +////var /*4*/r2 = m3d./*3*/ goTo.marker('1'); -verify.quickInfoIs('m3d'); +verify.quickInfoIs('(var) r: m3d'); goTo.marker('2'); verify.completionListContains('foo'); @@ -18,4 +18,4 @@ verify.completionListContains('y'); edit.insert('y;'); goTo.marker('4'); -verify.quickInfoIs('number'); \ No newline at end of file +verify.quickInfoIs('(var) r2: number'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/augmentedTypesModule5.ts b/tests/cases/fourslash/augmentedTypesModule5.ts similarity index 67% rename from tests/cases/fourslash_old/augmentedTypesModule5.ts rename to tests/cases/fourslash/augmentedTypesModule5.ts index 8fca36ea3f5..043372f21d5 100644 --- a/tests/cases/fourslash_old/augmentedTypesModule5.ts +++ b/tests/cases/fourslash/augmentedTypesModule5.ts @@ -2,12 +2,12 @@ ////declare class m3e { foo(): void } ////module m3e { export var y = 2; } -////var r/*1*/ = new m3e(); +////var /*1*/r = new m3e(); ////r./*2*/ -////var r2/*4*/ = m3e./*3*/ +////var /*4*/r2 = m3e./*3*/ goTo.marker('1'); -verify.quickInfoIs('m3e'); +verify.quickInfoIs('(var) r: m3e'); goTo.marker('2'); verify.completionListContains('foo'); @@ -19,4 +19,4 @@ verify.completionListContains('y'); edit.insert('y;'); goTo.marker('4'); -verify.quickInfoIs('number'); \ No newline at end of file +verify.quickInfoIs('(var) r2: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/augmentedTypesModule6.ts b/tests/cases/fourslash/augmentedTypesModule6.ts index f7e71c4a685..b5811e92468 100644 --- a/tests/cases/fourslash/augmentedTypesModule6.ts +++ b/tests/cases/fourslash/augmentedTypesModule6.ts @@ -3,32 +3,33 @@ ////declare class m3f { foo(x: number): void } ////module m3f { export interface I { foo(): void } } ////var x: m3f./*1*/ -////var r/*4*/ = new /*2*/m3f(/*3*/); +////var /*4*/r = new /*2*/m3f(/*3*/); ////r./*5*/ ////var r2: m3f.I = r; ////r2./*6*/ -//goTo.marker('1'); -//verify.completionListContains('I'); +goTo.marker('1'); +verify.completionListContains('I'); -//verify.not.completionListContains('foo'); -//edit.insert('I;'); +// bug #837 +verify.completionListContains('foo'); +edit.insert('I;'); -//goTo.marker('2'); -//verify.completionListContains('m3f'); +goTo.marker('2'); +verify.completionListContains('m3f'); goTo.marker('3'); verify.currentSignatureHelpIs('m3f(): m3f'); -//goTo.marker('4'); -//verify.quickInfoIs('m3f'); +goTo.marker('4'); +verify.quickInfoIs('(var) r: m3f'); -//goTo.marker('5'); -//verify.completionListContains('foo'); -//edit.insert('foo(1)'); +goTo.marker('5'); +verify.completionListContains('foo'); +edit.insert('foo(1)'); goTo.marker('6'); -//verify.completionListContains('foo'); +verify.completionListContains('foo'); edit.insert('foo('); -// verify.currentSignatureHelpIs('foo(): void'); +verify.currentSignatureHelpIs('foo(): void'); diff --git a/tests/cases/fourslash/automaticConstructorToggling.ts b/tests/cases/fourslash/automaticConstructorToggling.ts new file mode 100644 index 00000000000..9f430827854 --- /dev/null +++ b/tests/cases/fourslash/automaticConstructorToggling.ts @@ -0,0 +1,57 @@ +/// + +////class A { } +////class B {/*B*/ } +////class C { /*C*/constructor(val: T) { } } +////class D { constructor(/*D*/val: T) { } } +//// +////new /*Asig*/A(); +////new /*Bsig*/B(""); +////new /*Csig*/C(""); +////new /*Dsig*/D(); + +var A = 'A'; +var B = 'B'; +var C = 'C'; +var D = 'D' +goTo.marker(B); +edit.insert('constructor(val: T) { }'); +goTo.marker('Asig'); +verify.quickInfoIs("(constructor) A(): A"); + +goTo.marker('Bsig'); +verify.quickInfoIs("(constructor) B(val: string): B"); + +goTo.marker('Csig'); +verify.quickInfoIs("(constructor) C(val: string): C"); + +goTo.marker('Dsig'); +verify.quickInfoIs("(constructor) D(val: T): D"); // Cannot resolve signature + +goTo.marker(C); +edit.deleteAtCaret('constructor(val: T) { }'.length); +goTo.marker('Asig'); +verify.quickInfoIs("(constructor) A(): A"); + +goTo.marker('Bsig'); +verify.quickInfoIs("(constructor) B(val: string): B"); + +goTo.marker('Csig'); +verify.quickInfoIs("(constructor) C(): C"); // Cannot resolve signature + +goTo.marker('Dsig'); +verify.quickInfoIs("(constructor) D(val: T): D"); // Cannot resolve signature + +goTo.marker(D); +edit.deleteAtCaret("val: T".length); +goTo.marker('Asig'); +verify.quickInfoIs("(constructor) A(): A"); + +goTo.marker('Bsig'); +verify.quickInfoIs("(constructor) B(val: string): B"); + +goTo.marker('Csig'); +verify.quickInfoIs("(constructor) C(): C"); // Cannot resolve signature + +goTo.marker('Dsig'); +verify.quickInfoIs("(constructor) D(): D"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/basicClassMembers.ts b/tests/cases/fourslash/basicClassMembers.ts similarity index 100% rename from tests/cases/fourslash_old/basicClassMembers.ts rename to tests/cases/fourslash/basicClassMembers.ts diff --git a/tests/cases/fourslash_old/bestCommonTypeObjectLiterals1.ts b/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts similarity index 51% rename from tests/cases/fourslash_old/bestCommonTypeObjectLiterals1.ts rename to tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts index 20dfe754b5d..1632fff5df8 100644 --- a/tests/cases/fourslash_old/bestCommonTypeObjectLiterals1.ts +++ b/tests/cases/fourslash/bestCommonTypeObjectLiterals1.ts @@ -2,16 +2,16 @@ ////var a = { name: 'bob', age: 18 }; ////var b = { name: 'jim', age: 20 }; -////var c/*1*/ = [a, b]; +////var /*1*/c = [a, b]; ////var a1 = { name: 'bob', age: 18 }; ////var b1 = { name: 'jim', age: 20, dob: new Date() }; -////var c1/*2*/ = [a1, b1]; +////var /*2*/c1 = [a1, b1]; ////var a2 = { name: 'bob', age: 18, address: 'springfield' }; ////var b2 = { name: 'jim', age: 20, dob: new Date() }; -////var c2/*3*/ = [a2, b2]; -////var c2a/*4*/ = [a2, b2, a1]; +////var /*3*/c2 = [a2, b2]; +////var /*4*/c2a = [a2, b2, a1]; ////interface I { //// name: string; @@ -19,19 +19,19 @@ ////} ////var i: I; -////var c3/*5*/ = [a2, b2, i]; +////var /*5*/c3 = [a2, b2, i]; goTo.marker('1'); -verify.quickInfoIs('{ name: string; age: number; }[]'); +verify.quickInfoIs('(var) c: {\n name: string;\n age: number;\n}[]'); goTo.marker('2'); -verify.quickInfoIs('{ name: string; age: number; }[]'); +verify.quickInfoIs('(var) c1: {\n name: string;\n age: number;\n}[]'); goTo.marker('3'); -verify.quickInfoIs('{}[]'); +verify.quickInfoIs('(var) c2: {}[]'); goTo.marker('4'); -verify.quickInfoIs('{ name: string; age: number; }[]'); +verify.quickInfoIs('(var) c2a: {\n name: string;\n age: number;\n}[]'); goTo.marker('5'); -verify.quickInfoIs('I[]'); \ No newline at end of file +verify.quickInfoIs('(var) c3: I[]'); \ No newline at end of file diff --git a/tests/cases/fourslash/classInterfaceInsert.ts b/tests/cases/fourslash/classInterfaceInsert.ts index 9194c2f83cd..1796a0b62c3 100644 --- a/tests/cases/fourslash/classInterfaceInsert.ts +++ b/tests/cases/fourslash/classInterfaceInsert.ts @@ -10,10 +10,10 @@ //// } goTo.marker('className'); -verify.quickInfoSymbolNameIs('Sphere'); +verify.quickInfoIs('class Sphere'); goTo.marker('interfaceGoesHere'); edit.insert("\r\ninterface Surface {\r\n reflect: () => number;\r\n}\r\n"); goTo.marker('className'); -verify.quickInfoSymbolNameIs('Sphere'); +verify.quickInfoIs('class Sphere'); diff --git a/tests/cases/fourslash_old/cloduleAsBaseClass2.ts b/tests/cases/fourslash/cloduleAsBaseClass2.ts similarity index 100% rename from tests/cases/fourslash_old/cloduleAsBaseClass2.ts rename to tests/cases/fourslash/cloduleAsBaseClass2.ts diff --git a/tests/cases/fourslash_old/cloduleTypeOf1.ts b/tests/cases/fourslash/cloduleTypeOf1.ts similarity index 75% rename from tests/cases/fourslash_old/cloduleTypeOf1.ts rename to tests/cases/fourslash/cloduleTypeOf1.ts index 8a6c1196a8c..f34bb04c075 100644 --- a/tests/cases/fourslash_old/cloduleTypeOf1.ts +++ b/tests/cases/fourslash/cloduleTypeOf1.ts @@ -8,8 +8,8 @@ ////module C { //// export function f(x: typeof C) { //// x./*1*/ -//// var r/*3*/ = new /*2*/x(); -//// var r2/*5*/ = r./*4*/ +//// var /*3*/r = new /*2*/x(); +//// var /*5*/r2 = r./*4*/ //// return typeof r; //// } ////} @@ -27,13 +27,13 @@ goTo.marker('2'); verify.completionListContains('x'); goTo.marker('3'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(local var) r: C'); goTo.marker('4'); verify.completionListContains('x'); edit.insert('x;'); goTo.marker('5'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(local var) r2: number'); verify.numberOfErrorsInCurrentFile(0); \ No newline at end of file diff --git a/tests/cases/fourslash_old/cloduleWithRecursiveReference.ts b/tests/cases/fourslash/cloduleWithRecursiveReference.ts similarity index 76% rename from tests/cases/fourslash_old/cloduleWithRecursiveReference.ts rename to tests/cases/fourslash/cloduleWithRecursiveReference.ts index 6b5831a9c5f..96e5e51d4d4 100644 --- a/tests/cases/fourslash_old/cloduleWithRecursiveReference.ts +++ b/tests/cases/fourslash/cloduleWithRecursiveReference.ts @@ -5,7 +5,7 @@ //// foo() { } //// } //// export module C { -//// export var C/**/ = M.C +//// export var /**/C = M.C //// } ////} @@ -13,5 +13,5 @@ edit.insert(''); goTo.marker(); -verify.quickInfoIs('typeof C'); +verify.quickInfoIs('(var) M.C.C: typeof M.C'); verify.numberOfErrorsInCurrentFile(0); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsClass.ts b/tests/cases/fourslash/commentsClass.ts new file mode 100644 index 00000000000..a2c9ccc6fab --- /dev/null +++ b/tests/cases/fourslash/commentsClass.ts @@ -0,0 +1,176 @@ +/// + +/////** This is class c2 without constuctor*/ +////class c/*1*/2 { +////} +////var i/*2*/2 = new c/*28*/2(/*3*/); +////var i2/*4*/_c = c/*5*/2; +////class c/*6*/3 { +//// /** Constructor comment*/ +//// constructor() { +//// } +////} +////var i/*7*/3 = new c/*29*/3(/*8*/); +////var i3/*9*/_c = c/*10*/3; +/////** Class comment*/ +////class c/*11*/4 { +//// /** Constructor comment*/ +//// constructor() { +//// } +////} +////var i/*12*/4 = new c/*30*/4(/*13*/); +////var i4/*14*/_c = c/*15*/4; +/////** Class with statics*/ +////class c/*16*/5 { +//// static s1: number; +////} +////var i/*17*/5 = new c/*31*/5(/*18*/); +////var i5_/*19*/c = c/*20*/5; +/////** class with statics and constructor*/ +////class c/*21*/6 { +//// /** s1 comment*/ +//// static s1: number; +//// /** constructor comment*/ +//// constructor() { +//// } +////} +////var i/*22*/6 = new c/*32*/6(/*23*/); +////var i6/*24*/_c = c/*25*/6; +/////*26*/ +////class a { +//// /** +//// constructor for a +//// @param a this is my a +//// */ +//// constructor(a: string) { +//// } +////} +////new a(/*27*/"Hello"); +////module m { +//// export module m2 { +//// /** class comment */ +//// export class c1 { +//// /** constructor comment*/ +//// constructor() { +//// } +//// } +//// } +////} +////var myVar = new m.m2.c/*33*/1(); + +// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed +edit.insert(''); + +goTo.marker('1'); +verify.quickInfoIs("class c2", "This is class c2 without constuctor"); + +goTo.marker('2'); +verify.quickInfoIs("(var) i2: c2", ""); + +goTo.marker('3'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('4'); +verify.quickInfoIs("(var) i2_c: typeof c2", ""); + +goTo.marker('5'); +verify.quickInfoIs("class c2", "This is class c2 without constuctor"); + +goTo.marker('6'); +verify.quickInfoIs("class c3", ""); + +goTo.marker('7'); +verify.quickInfoIs("(var) i3: c3", ""); + +goTo.marker('8'); +verify.currentSignatureHelpDocCommentIs("Constructor comment"); + +goTo.marker('9'); +verify.quickInfoIs("(var) i3_c: typeof c3", ""); + +goTo.marker('10'); +verify.quickInfoIs("class c3", ""); + +goTo.marker('11'); +verify.quickInfoIs("class c4", "Class comment"); + +goTo.marker('12'); +verify.quickInfoIs("(var) i4: c4", ""); + +goTo.marker('13'); +verify.currentSignatureHelpDocCommentIs("Constructor comment"); + +goTo.marker('14'); +verify.quickInfoIs("(var) i4_c: typeof c4", ""); + +goTo.marker('15'); +verify.quickInfoIs("class c4", "Class comment"); + +goTo.marker('16'); +verify.quickInfoIs("class c5", "Class with statics"); + +goTo.marker('17'); +verify.quickInfoIs("(var) i5: c5", ""); + +goTo.marker('18'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('19'); +verify.quickInfoIs("(var) i5_c: typeof c5", ""); + +goTo.marker('20'); +verify.quickInfoIs("class c5", "Class with statics"); + +goTo.marker('21'); +verify.quickInfoIs("class c6", "class with statics and constructor"); + +goTo.marker('22'); +verify.quickInfoIs("(var) i6: c6", ""); + +goTo.marker('23'); +verify.currentSignatureHelpDocCommentIs("constructor comment"); + +goTo.marker('24'); +verify.quickInfoIs("(var) i6_c: typeof c6", ""); + +goTo.marker('25'); +verify.quickInfoIs("class c6", "class with statics and constructor"); + +goTo.marker('26'); +verify.completionListContains("c2", "class c2", "This is class c2 without constuctor"); +verify.completionListContains("i2", "(var) i2: c2", ""); +verify.completionListContains("i2_c", "(var) i2_c: typeof c2", ""); +verify.completionListContains("c3", "class c3", ""); +verify.completionListContains("i3", "(var) i3: c3", ""); +verify.completionListContains("i3_c", "(var) i3_c: typeof c3", ""); +verify.completionListContains("c4", "class c4", "Class comment"); +verify.completionListContains("i4", "(var) i4: c4", ""); +verify.completionListContains("i4_c", "(var) i4_c: typeof c4", ""); +verify.completionListContains("c5", "class c5", "Class with statics"); +verify.completionListContains("i5", "(var) i5: c5", ""); +verify.completionListContains("i5_c", "(var) i5_c: typeof c5"); +verify.completionListContains("c6", "class c6", "class with statics and constructor"); +verify.completionListContains("i6", "(var) i6: c6", ""); +verify.completionListContains("i6_c", "(var) i6_c: typeof c6", ""); + +goTo.marker('27'); +verify.currentSignatureHelpDocCommentIs("constructor for a"); +verify.currentParameterHelpArgumentDocCommentIs("this is my a"); + +goTo.marker('28'); +verify.quickInfoIs("(constructor) c2(): c2", ""); + +goTo.marker('29'); +verify.quickInfoIs("(constructor) c3(): c3", "Constructor comment"); + +goTo.marker('30'); +verify.quickInfoIs("(constructor) c4(): c4", "Constructor comment"); + +goTo.marker('31'); +verify.quickInfoIs("(constructor) c5(): c5", ""); + +goTo.marker('32'); +verify.quickInfoIs("(constructor) c6(): c6", "constructor comment"); + +goTo.marker('33'); +verify.quickInfoIs("(constructor) m.m2.c1(): m.m2.c1", "constructor comment"); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsClassMembers.ts b/tests/cases/fourslash/commentsClassMembers.ts new file mode 100644 index 00000000000..c524b4184c7 --- /dev/null +++ b/tests/cases/fourslash/commentsClassMembers.ts @@ -0,0 +1,706 @@ +/// + +/////** This is comment for c1*/ +////class c/*1*/1 { +//// /** p1 is property of c1*/ +//// public p/*2*/1: number; +//// /** sum with property*/ +//// public p/*3*/2(/** number to add*/b: number) { +//// return this./*4*/p1 + /*5*/b; +//// } +//// /** getter property*/ +//// public get p/*6*/3() { +//// return this./*7*/p/*8q*/2(/*8*/this./*9*/p1); +//// } +//// /** setter property*/ +//// public set p/*10*/3(/** this is value*/value: number) { +//// this./*11*/p1 = this./*12*/p/*13q*/2(/*13*/value); +//// } +//// /** pp1 is property of c1*/ +//// private p/*14*/p1: number; +//// /** sum with property*/ +//// private p/*15*/p2(/** number to add*/b: number) { +//// return this./*16*/p1 + /*17*/b; +//// } +//// /** getter property*/ +//// private get p/*18*/p3() { +//// return this./*19*/p/*20q*/p2(/*20*/this./*21*/pp1); +//// } +//// /** setter property*/ +//// private set p/*22*/p3( /** this is value*/value: number) { +//// this./*23*/pp1 = this./*24*/p/*25q*/p2(/*25*/value); +//// } +//// /** Constructor method*/ +//// constru/*26*/ctor() { +//// } +//// /** s1 is static property of c1*/ +//// static s/*27*/1: number; +//// /** static sum with property*/ +//// static s/*28*/2(/** number to add*/b: number) { +//// return /*29*/c1./*30*/s1 + /*31*/b; +//// } +//// /** static getter property*/ +//// static get s/*32*/3() { +//// return /*33*/c1./*34*/s/*35q*/2(/*35*/c1./*36*/s1); +//// } +//// /** setter property*/ +//// static set s/*37*/3( /** this is value*/value: number) { +//// /*38*/c1./*39*/s1 = /*40*/c1./*41*/s/*42q*/2(/*42*/value); +//// } +//// public nc_/*43*/p1: number; +//// public nc_/*44*/p2(b: number) { +//// return this.nc_p1 + /*45*/b; +//// } +//// public get nc_/*46*/p3() { +//// return this.nc/*47q*/_p2(/*47*/this.nc_p1); +//// } +//// public set nc/*48*/_p3(value: number) { +//// this.nc_p1 = this.nc/*49q*/_p2(/*49*/value); +//// } +//// private nc/*50*/_pp1: number; +//// private nc_/*51*/pp2(b: number) { +//// return this.nc_pp1 + /*52*/b; +//// } +//// private get nc/*53*/_pp3() { +//// return this.nc_/*54q*/pp2(/*54*/this.nc_pp1); +//// } +//// private set nc_p/*55*/p3(value: number) { +//// this.nc_pp1 = this./*56q*/nc_pp2(/*56*/value); +//// } +//// static nc/*57*/_s1: number; +//// static nc/*58*/_s2(b: number) { +//// return c1.nc_s1 + /*59*/b; +//// } +//// static get nc/*60*/_s3() { +//// return c1.nc/*61q*/_s2(/*61*/c1.nc_s1); +//// } +//// static set nc/*62*/_s3(value: number) { +//// c1.nc_s1 = c1.nc_/*63q*/s2(/*63*/value); +//// } +////} +////var i/*64*/1 = new c/*65q*/1(/*65*/); +////var i1/*66*/_p = i1./*67*/p1; +////var i1/*68*/_f = i1.p/*69*/2; +////var i1/*70*/_r = i1.p/*71q*/2(/*71*/20); +////var i1_p/*72*/rop = i1./*73*/p3; +////i1./*74*/p3 = i1_/*75*/prop; +////var i1_/*76*/nc_p = i1.n/*77*/c_p1; +////var i1/*78*/_ncf = i1.nc_/*79*/p2; +////var i1_/*80*/ncr = i1.nc/*81q*/_p2(/*81*/20); +////var i1_n/*82*/cprop = i1.n/*83*/c_p3; +////i1.nc/*84*/_p3 = i1_/*85*/ncprop; +////var i1_/*86*/s_p = /*87*/c1./*88*/s1; +////var i1_s/*89*/_f = c1./*90*/s2; +////var i1_/*91*/s_r = c1.s/*92q*/2(/*92*/20); +////var i1_s/*93*/_prop = c1.s/*94*/3; +////c1.s/*95*/3 = i1_s/*96*/_prop; +////var i1_s/*97*/_nc_p = c1.n/*98*/c_s1; +////var i1_s_/*99*/ncf = c1.nc/*100*/_s2; +////var i1_s_/*101*/ncr = c1.n/*102q*/c_s2(/*102*/20); +////var i1_s_n/*103*/cprop = c1.nc/*104*/_s3; +////c1.nc/*105*/_s3 = i1_s_nc/*106*/prop; +////var i1/*107*/_c = c/*108*/1; +/////*109*/ +////class cProperties { +//// private val: number; +//// /** getter only property*/ +//// public get p1() { +//// return this.val; +//// } +//// public get nc_p1() { +//// return this.val; +//// } +//// /**setter only property*/ +//// public set p2(value: number) { +//// this.val = value; +//// } +//// public set nc_p2(value: number) { +//// this.val = value; +//// } +////} +////var cProperties_i = new cProperties(); +////cProperties_i./*110*/p2 = cProperties_i.p/*111*/1; +////cProperties_i.nc/*112*/_p2 = cProperties_i.nc/*113*/_p1; +////class cWithConstructorProperty { +//// /** +//// * this is class cWithConstructorProperty's constructor +//// * @param a this is first parameter a +//// */ +//// /*119*/constructor(/**more info about a*/public a: number) { +//// var b/*118*/bbb = 10; +//// th/*116*/is./*114*/a = /*115*/a + 2 + bb/*117*/bb; +//// } +////} + +goTo.marker('1'); +verify.quickInfoIs("class c1", "This is comment for c1"); + +goTo.marker('2'); +verify.quickInfoIs("(property) c1.p1: number", "p1 is property of c1"); + +goTo.marker('3'); +verify.quickInfoIs("(method) c1.p2(b: number): number", "sum with property"); + +goTo.marker('4'); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); + +goTo.marker('5'); +verify.completionListContains("b", "(parameter) b: number", "number to add"); + +goTo.marker('6'); +verify.quickInfoIs("(property) c1.p3: number", "getter property\nsetter property"); + +goTo.marker('7'); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); + +goTo.marker('8'); +verify.currentSignatureHelpDocCommentIs("sum with property"); +verify.currentParameterHelpArgumentDocCommentIs("number to add"); +goTo.marker('8q'); +verify.quickInfoIs("(method) c1.p2(b: number): number", "sum with property"); + +goTo.marker('9'); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); + +goTo.marker('10'); +verify.quickInfoIs("(property) c1.p3: number", "getter property\nsetter property"); + +goTo.marker('11'); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); + +goTo.marker('12'); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); + +goTo.marker('13'); +verify.currentSignatureHelpDocCommentIs("sum with property"); +verify.currentParameterHelpArgumentDocCommentIs("number to add"); +verify.completionListContains("value", "(parameter) value: number", "this is value"); +goTo.marker('13q'); +verify.quickInfoIs("(method) c1.p2(b: number): number", "sum with property"); + +goTo.marker('14'); +verify.quickInfoIs("(property) c1.pp1: number", "pp1 is property of c1"); + +goTo.marker('15'); +verify.quickInfoIs("(method) c1.pp2(b: number): number", "sum with property"); + +goTo.marker('16'); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); + +goTo.marker('17'); +verify.completionListContains("b", "(parameter) b: number", "number to add"); + +goTo.marker('18'); +verify.quickInfoIs("(property) c1.pp3: number", "getter property\nsetter property"); + +goTo.marker('19'); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); + +goTo.marker('20'); +verify.currentSignatureHelpDocCommentIs("sum with property"); +verify.currentParameterHelpArgumentDocCommentIs("number to add"); +goTo.marker('20q'); +verify.quickInfoIs("(method) c1.pp2(b: number): number", "sum with property"); + +goTo.marker('21'); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); + +goTo.marker('22'); +verify.quickInfoIs("(property) c1.pp3: number", "getter property\nsetter property"); + +goTo.marker('23'); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); + +goTo.marker('24'); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); + +goTo.marker('25'); +verify.currentSignatureHelpDocCommentIs("sum with property"); +verify.currentParameterHelpArgumentDocCommentIs("number to add"); +verify.completionListContains("value", "(parameter) value: number", "this is value"); +goTo.marker('25q'); +verify.quickInfoIs("(method) c1.pp2(b: number): number", "sum with property"); + +goTo.marker('26'); +verify.quickInfoIs("(constructor) c1(): c1", "Constructor method"); + +goTo.marker('27'); +verify.quickInfoIs("(property) c1.s1: number", "s1 is static property of c1"); + +goTo.marker('28'); +verify.quickInfoIs("(method) c1.s2(b: number): number", "static sum with property"); + +goTo.marker('29'); +verify.completionListContains("c1", "class c1", "This is comment for c1"); + +goTo.marker('30'); +verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property"); +verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); + +goTo.marker('31'); +verify.completionListContains("b", "(parameter) b: number", "number to add"); + +goTo.marker('32'); +verify.quickInfoIs("(property) c1.s3: number", "static getter property\nsetter property"); + +goTo.marker('33'); +verify.completionListContains("c1", "class c1", "This is comment for c1"); + +goTo.marker('34'); +verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property"); +verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); + +goTo.marker('35'); +verify.currentSignatureHelpDocCommentIs("static sum with property"); +verify.currentParameterHelpArgumentDocCommentIs("number to add"); +verify.completionListContains("c1", "class c1", "This is comment for c1"); +goTo.marker('35q'); +verify.quickInfoIs("(method) c1.s2(b: number): number", "static sum with property"); + +goTo.marker('36'); +verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property"); +verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); + +goTo.marker('37'); +verify.quickInfoIs("(property) c1.s3: number", "static getter property\nsetter property"); + +goTo.marker('38'); +verify.completionListContains("c1", "class c1", "This is comment for c1"); + +goTo.marker('39'); +verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property"); +verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); + +goTo.marker('40'); +verify.completionListContains("c1", "class c1", "This is comment for c1"); + +goTo.marker('41'); +verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property"); +verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); + +goTo.marker('42'); +verify.currentSignatureHelpDocCommentIs("static sum with property"); +verify.currentParameterHelpArgumentDocCommentIs("number to add"); +verify.completionListContains("value", "(parameter) value: number", "this is value"); +goTo.marker('42q'); +verify.quickInfoIs("(method) c1.s2(b: number): number", "static sum with property"); + +goTo.marker('43'); +verify.quickInfoIs("(property) c1.nc_p1: number", ""); + +goTo.marker('44'); +verify.quickInfoIs("(method) c1.nc_p2(b: number): number", ""); + +goTo.marker('45'); +verify.completionListContains("b", "(parameter) b: number", ""); + +goTo.marker('46'); +verify.quickInfoIs("(property) c1.nc_p3: number", ""); + +goTo.marker('47'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('47q'); +verify.quickInfoIs("(method) c1.nc_p2(b: number): number", ""); + +goTo.marker('48'); +verify.quickInfoIs("(property) c1.nc_p3: number", ""); + +goTo.marker('49'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +verify.completionListContains("value", "(parameter) value: number", ""); +goTo.marker('49q'); +verify.quickInfoIs("(method) c1.nc_p2(b: number): number", ""); + +goTo.marker('50'); +verify.quickInfoIs("(property) c1.nc_pp1: number", ""); + +goTo.marker('51'); +verify.quickInfoIs("(method) c1.nc_pp2(b: number): number", ""); + +goTo.marker('52'); +verify.completionListContains("b", "(parameter) b: number", ""); + +goTo.marker('53'); +verify.quickInfoIs("(property) c1.nc_pp3: number", ""); + +goTo.marker('54'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('54q'); +verify.quickInfoIs("(method) c1.nc_pp2(b: number): number", ""); + +goTo.marker('55'); +verify.quickInfoIs("(property) c1.nc_pp3: number", ""); + +goTo.marker('56'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +verify.completionListContains("value", "(parameter) value: number", ""); +goTo.marker('56q'); +verify.quickInfoIs("(method) c1.nc_pp2(b: number): number", ""); + +goTo.marker('57'); +verify.quickInfoIs("(property) c1.nc_s1: number", ""); + +goTo.marker('58'); +verify.quickInfoIs("(method) c1.nc_s2(b: number): number", ""); + +goTo.marker('59'); +verify.completionListContains("b", "(parameter) b: number", ""); + +goTo.marker('60'); +verify.quickInfoIs("(property) c1.nc_s3: number", ""); + +goTo.marker('61'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('61q'); +verify.quickInfoIs("(method) c1.nc_s2(b: number): number", ""); + +goTo.marker('62'); +verify.quickInfoIs("(property) c1.nc_s3: number", ""); + +goTo.marker('63'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +verify.completionListContains("value", "(parameter) value: number", ""); +goTo.marker('63q'); +verify.quickInfoIs("(method) c1.nc_s2(b: number): number", ""); + +goTo.marker('64'); +verify.quickInfoIs("(var) i1: c1", ""); + +goTo.marker('65'); +verify.currentSignatureHelpDocCommentIs("Constructor method"); +goTo.marker('65q'); +verify.quickInfoIs("(constructor) c1(): c1", "Constructor method"); + +goTo.marker('66'); +verify.quickInfoIs("(var) i1_p: number", ""); + +goTo.marker('67'); +verify.quickInfoIs("(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.memberListContains("p3", "(property) c1.p3: number", "getter property\nsetter property"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); + +goTo.marker('68'); +verify.quickInfoIs("(var) i1_f: (b: number) => number", ""); + +goTo.marker('69'); +verify.quickInfoIs("(method) c1.p2(b: number): number", "sum with property"); + +goTo.marker('70'); +verify.quickInfoIs("(var) i1_r: number", ""); + +goTo.marker('71'); +verify.currentSignatureHelpDocCommentIs("sum with property"); +verify.currentParameterHelpArgumentDocCommentIs("number to add"); +goTo.marker('71q'); +verify.quickInfoIs("(method) c1.p2(b: number): number", "sum with property"); + +goTo.marker('72'); +verify.quickInfoIs("(var) i1_prop: number", ""); +goTo.marker('73'); +verify.quickInfoIs("(property) c1.p3: number", "getter property\nsetter property"); +goTo.marker('74'); +verify.quickInfoIs("(property) c1.p3: number", "getter property\nsetter property"); +goTo.marker('75'); +verify.quickInfoIs("(var) i1_prop: number", ""); + +goTo.marker('76'); +verify.quickInfoIs("(var) i1_nc_p: number", ""); + +goTo.marker('77'); +verify.quickInfoIs("(property) c1.nc_p1: number", ""); + +goTo.marker('78'); +verify.quickInfoIs("(var) i1_ncf: (b: number) => number", ""); + +goTo.marker('79'); +verify.quickInfoIs("(method) c1.nc_p2(b: number): number", ""); + +goTo.marker('80'); +verify.quickInfoIs("(var) i1_ncr: number", ""); + +goTo.marker('81'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('81q'); +verify.quickInfoIs("(method) c1.nc_p2(b: number): number", ""); + +goTo.marker('82'); +verify.quickInfoIs("(var) i1_ncprop: number", ""); +goTo.marker('83'); +verify.quickInfoIs("(property) c1.nc_p3: number", ""); +goTo.marker('84'); +verify.quickInfoIs("(property) c1.nc_p3: number", ""); +goTo.marker('85'); +verify.quickInfoIs("(var) i1_ncprop: number", ""); + +goTo.marker('86'); +verify.quickInfoIs("(var) i1_s_p: number", ""); + +goTo.marker('87'); +verify.quickInfoIs("class c1", "This is comment for c1"); +verify.completionListContains("c1", "class c1", "This is comment for c1"); + +goTo.marker('88'); +verify.quickInfoIs("(property) c1.s1: number", "s1 is static property of c1"); +verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property"); +verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); + +goTo.marker('89'); +verify.quickInfoIs("(var) i1_s_f: (b: number) => number", ""); + +goTo.marker('90'); +verify.quickInfoIs("(method) c1.s2(b: number): number", "static sum with property"); + +goTo.marker('91'); +verify.quickInfoIs("(var) i1_s_r: number", ""); + +goTo.marker('92'); +verify.currentSignatureHelpDocCommentIs("static sum with property"); +verify.currentParameterHelpArgumentDocCommentIs("number to add"); +goTo.marker('92q'); +verify.quickInfoIs("(method) c1.s2(b: number): number", "static sum with property"); + +goTo.marker('93'); +verify.quickInfoIs("(var) i1_s_prop: number", ""); +goTo.marker('94'); +verify.quickInfoIs("(property) c1.s3: number", "static getter property\nsetter property"); +goTo.marker('95'); +verify.quickInfoIs("(property) c1.s3: number", "static getter property\nsetter property"); +goTo.marker('96'); +verify.quickInfoIs("(var) i1_s_prop: number", ""); + +goTo.marker('97'); +verify.quickInfoIs("(var) i1_s_nc_p: number", ""); + +goTo.marker('98'); +verify.quickInfoIs("(property) c1.nc_s1: number", ""); + +goTo.marker('99'); +verify.quickInfoIs("(var) i1_s_ncf: (b: number) => number", ""); + +goTo.marker('100'); +verify.quickInfoIs("(method) c1.nc_s2(b: number): number", ""); + +goTo.marker('101'); +verify.quickInfoIs("(var) i1_s_ncr: number", ""); + +goTo.marker('102'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('102q'); +verify.quickInfoIs("(method) c1.nc_s2(b: number): number", ""); + +goTo.marker('103'); +verify.quickInfoIs("(var) i1_s_ncprop: number", ""); +goTo.marker('104'); +verify.quickInfoIs("(property) c1.nc_s3: number", ""); +goTo.marker('105'); +verify.quickInfoIs("(property) c1.nc_s3: number", ""); +goTo.marker('106'); +verify.quickInfoIs("(var) i1_s_ncprop: number", ""); + +goTo.marker('107'); +verify.quickInfoIs("(var) i1_c: typeof c1", ""); + +goTo.marker('108'); +verify.quickInfoIs("class c1", "This is comment for c1"); + +goTo.marker('109'); +verify.completionListContains("c1", "class c1", "This is comment for c1"); +verify.completionListContains("i1", "(var) i1: c1", ""); +verify.completionListContains("i1_p", "(var) i1_p: number", ""); +verify.completionListContains("i1_f", "(var) i1_f: (b: number) => number", ""); +verify.completionListContains("i1_r", "(var) i1_r: number", ""); +verify.completionListContains("i1_prop", "(var) i1_prop: number", ""); +verify.completionListContains("i1_nc_p", "(var) i1_nc_p: number", ""); +verify.completionListContains("i1_ncf", "(var) i1_ncf: (b: number) => number", ""); +verify.completionListContains("i1_ncr", "(var) i1_ncr: number", ""); +verify.completionListContains("i1_ncprop", "(var) i1_ncprop: number", ""); +verify.completionListContains("i1_s_p", "(var) i1_s_p: number", ""); +verify.completionListContains("i1_s_f", "(var) i1_s_f: (b: number) => number", ""); +verify.completionListContains("i1_s_r", "(var) i1_s_r: number", ""); +verify.completionListContains("i1_s_prop", "(var) i1_s_prop: number", ""); +verify.completionListContains("i1_s_nc_p", "(var) i1_s_nc_p: number", ""); +verify.completionListContains("i1_s_ncf", "(var) i1_s_ncf: (b: number) => number", ""); +verify.completionListContains("i1_s_ncr", "(var) i1_s_ncr: number", ""); +verify.completionListContains("i1_s_ncprop", "(var) i1_s_ncprop: number", ""); + +verify.completionListContains("i1_c", "(var) i1_c: typeof c1", ""); + +goTo.marker('110'); +verify.quickInfoIs("(property) cProperties.p2: number", "setter only property"); +verify.memberListContains("p1", "(property) cProperties.p1: number", "getter only property"); +verify.memberListContains("p2", "(property) cProperties.p2: number", "setter only property"); +verify.memberListContains("nc_p1", "(property) cProperties.nc_p1: number", ""); +verify.memberListContains("nc_p2", "(property) cProperties.nc_p2: number", ""); + +goTo.marker('111'); +verify.quickInfoIs("(property) cProperties.p1: number", "getter only property"); +goTo.marker('112'); +verify.quickInfoIs("(property) cProperties.nc_p2: number", ""); +goTo.marker('113'); +verify.quickInfoIs("(property) cProperties.nc_p1: number", ""); + +goTo.marker('114'); +verify.memberListContains("a", "(property) cWithConstructorProperty.a: number", "more info about a"); +verify.quickInfoIs("(property) cWithConstructorProperty.a: number", "more info about a"); + +goTo.marker('115'); +verify.completionListContains("a", "(parameter) a: number", "this is first parameter a\nmore info about a"); +verify.quickInfoIs("(parameter) a: number", "this is first parameter a\nmore info about a"); + +goTo.marker('116'); +verify.quickInfoIs("class cWithConstructorProperty", ""); + +goTo.marker('117'); +verify.quickInfoIs("(local var) bbbb: number", ""); + +goTo.marker('118'); +verify.quickInfoIs("(local var) bbbb: number", ""); + +goTo.marker('119'); +verify.quickInfoIs("(constructor) cWithConstructorProperty(a: number): cWithConstructorProperty", "this is class cWithConstructorProperty's constructor"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/commentsCommentParsing.ts b/tests/cases/fourslash/commentsCommentParsing.ts similarity index 59% rename from tests/cases/fourslash_old/commentsCommentParsing.ts rename to tests/cases/fourslash/commentsCommentParsing.ts index 9e54385952a..4e4c33c0d94 100644 --- a/tests/cases/fourslash_old/commentsCommentParsing.ts +++ b/tests/cases/fourslash/commentsCommentParsing.ts @@ -43,7 +43,7 @@ ////jsDocMix/*6q*/edComments1(/*6*/); //// /////// Triple slash comment -/////** jsdoc comment */ /*** another jsDocComment*/ +/////** jsdoc comment */ /** another jsDocComment*/ ////function jsDocMixedComments2() { ////} ////jsDocMi/*7q*/xedComments2(/*7*/); @@ -54,7 +54,7 @@ ////} ////jsDocMixe/*8q*/dComments3(/*8*/); //// -/////** jsdoc comment */ /*** another jsDocComment*/ +/////** jsdoc comment */ /** another jsDocComment*/ /////// Triple slash comment /////// Triple slash comment 2 ////function jsDocMixedComments4() { @@ -62,14 +62,14 @@ ////jsDocMixed/*9q*/Comments4(/*9*/); //// /////// Triple slash comment 1 -/////** jsdoc comment */ /*** another jsDocComment*/ +/////** jsdoc comment */ /** another jsDocComment*/ /////// Triple slash comment /////// Triple slash comment 2 ////function jsDocMixedComments5() { ////} ////jsDocM/*10q*/ixedComments5(/*10*/); //// -/////*** another jsDocComment*/ +/////** another jsDocComment*/ /////// Triple slash comment 1 /////// Triple slash comment /////// Triple slash comment 2 @@ -95,7 +95,7 @@ //// * @param {number} a first number //// * @param b second number //// */ -////function sum(a: number, b: number) { +////function sum(/*16aq*/a: number, /*17aq*/b: number) { //// return /*18*/a + b; ////} /////*15*/s/*16q*/um(/*16*/10, /*17*/20); @@ -106,14 +106,14 @@ /////** @param c { //// @param d @anotherTag*/ /////** @param e LastParam @anotherTag*/ -////function multiply(a: number, b: number, c?: number, d?, e?) { +////function multiply(/*19aq*/a: number, /*20aq*/b: number, /*21aq*/c?: number, /*22aq*/d?, /*23aq*/e?) { ////} ////mult/*19q*/iply(/*19*/10,/*20*/ 20,/*21*/ 30, /*22*/40, /*23*/50); /////** fn f1 with number ////* @param { string} b about b ////*/ -////function f1(a: number); -////function f1(b: string); +////function f1(/*25aq*/a: number); +////function f1(/*26aq*/b: string); /////**@param opt optional parameter*/ ////function f1(aOrb, opt?) { //// return /*24*/aOrb; @@ -129,7 +129,7 @@ ////@param { { () => string; } } e this is optional param e ////@param { { { () => string; } } f this is optional param f ////*/ -////function subtract(a: number, b: number, c?: () => string, d?: () => string, e?: () => string, f?: () => string) { +////function subtract(/*28aq*/a: number, /*29aq*/b: number, /*30aq*/c?: () => string, /*31aq*/d?: () => string, /*32aq*/e?: () => string, /*33aq*/f?: () => string) { ////} ////subt/*28q*/ract(/*28*/10, /*29*/ 20, /*30*/ null, /*31*/ null, /*32*/ null, /*33*/null); /////** this is square function @@ -137,7 +137,7 @@ ////@param { number } a this is input number ////@returnType { number } it is return type ////*/ -////function square(a: number) { +////function square(/*34aq*/a: number) { //// return a * a; ////} ////squ/*34q*/are(/*34*/10); @@ -146,7 +146,7 @@ ////@paramTag { number } g this is optional param g ////@param { number} b this is b ////*/ -////function divide(a: number, b: number) { +////function divide(/*35aq*/a: number, /*36aq*/b: number) { ////} ////div/*35q*/ide(/*35*/10, /*36*/20); /////** @@ -154,7 +154,7 @@ ////@param {string} foo is string ////@param {string} bar is second string ////*/ -////function fooBar(foo: string, bar: string) { +////function fooBar(/*37aq*/foo: string, /*38aq*/bar: string) { //// return foo + bar; ////} ////fo/*37q*/oBar(/*37*/"foo",/*38*/"bar"); @@ -168,7 +168,7 @@ ////*@param a it is first parameter ////*@param c it is third parameter ////*/ -////function jsDocParamTest(/** this is inline comment for a */a: number, /** this is inline comment for b*/ b: number, c: number, d: number) { +////function jsDocParamTest(/** this is inline comment for a *//*40aq*/a: number, /** this is inline comment for b*/ /*41aq*/b: number, /*42aq*/c: number, /*43aq*/d: number) { //// return /*39*/a + b + c + d; ////} /////*44*/jsD/*40q*/ocParamTest(/*40*/30, /*41*/40, /*42*/50, /*43*/60); @@ -195,7 +195,7 @@ //// * @param c this is info about b //// * not aligned text about parameter will eat only one space //// */ -////function jsDocCommentAlignmentTest3(a: string, b, c) { +////function jsDocCommentAlignmentTest3(/*47aq*/a: string, /*48aq*/b, /*49aq*/c) { ////} ////jsDocComme/*47q*/ntAlignmentTest3(/*47*/"hello",/*48*/1, /*49*/2); /////**/ @@ -205,237 +205,291 @@ goTo.marker('1'); verify.currentSignatureHelpDocCommentIs(""); goTo.marker('1q'); -verify.quickInfoIs("(): void", "", "simple", "function"); +verify.quickInfoIs("(function) simple(): void", ""); goTo.marker('2'); 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 "); 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"); 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"); 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 "); 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"); 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 \nanother jsDocComment"); +verify.currentSignatureHelpDocCommentIs("jsdoc comment \n* another jsDocComment"); goTo.marker('8q'); -verify.quickInfoIs("(): void", "jsdoc comment \nanother jsDocComment", "jsDocMixedComments3", "function"); +verify.quickInfoIs("(function) jsDocMixedComments3(): void", "jsdoc comment \n* another jsDocComment"); goTo.marker('9'); 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"); 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 "); 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(""); goTo.marker('12q'); -verify.quickInfoIs("(): void", "", "noHelpComment1", "function"); +verify.quickInfoIs("(function) noHelpComment1(): void", ""); goTo.marker('13'); verify.currentSignatureHelpDocCommentIs(""); goTo.marker('13q'); -verify.quickInfoIs("(): void", "", "noHelpComment2", "function"); +verify.quickInfoIs("(function) noHelpComment2(): void", ""); goTo.marker('14'); 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"); 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("(parameter) a: number", "first number"); goTo.marker('17'); verify.currentSignatureHelpDocCommentIs("Adds two integers and returns the result"); verify.currentParameterHelpArgumentDocCommentIs("second number"); +goTo.marker('17aq'); +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"); 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("(parameter) a: number", "first number"); goTo.marker('20'); verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag"); verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('20aq'); +verify.quickInfoIs("(parameter) b: number", ""); goTo.marker('21'); verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag"); verify.currentParameterHelpArgumentDocCommentIs("{"); +goTo.marker('21aq'); +verify.quickInfoIs("(parameter) c: number", "{"); goTo.marker('22'); verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag"); verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('22aq'); +verify.quickInfoIs("(parameter) d: any", ""); goTo.marker('23'); verify.currentSignatureHelpDocCommentIs("This is multiplication function\n@anotherTag\n@anotherTag"); verify.currentParameterHelpArgumentDocCommentIs("LastParam "); +goTo.marker('23aq'); +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(""); goTo.marker('25q'); -verify.quickInfoIs("(a: number): any (+ 1 overload(s))", "fn f1 with number", "f1", "function"); +verify.quickInfoIs("(function) f1(a: number): any (+1 overload)", "fn f1 with number"); +goTo.marker('25aq'); +verify.quickInfoIs("(parameter) a: number", ""); goTo.marker('26'); verify.currentSignatureHelpDocCommentIs(""); verify.currentParameterHelpArgumentDocCommentIs(""); goTo.marker('26q'); -verify.quickInfoIs("(b: string): any (+ 1 overload(s))", "", "f1", "function"); +verify.quickInfoIs("(function) f1(b: string): any (+1 overload)", ""); +goTo.marker('26aq'); +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("f1", "(a: number): any (+ 1 overload(s))", "fn f1 with number", "f1", "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"); +verify.completionListContains("f1", "(function) f1(a: number): any (+1 overload)", "fn f1 with number"); goTo.marker('28'); 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("(parameter) a: number", ""); goTo.marker('29'); verify.currentSignatureHelpDocCommentIs("This is subtract function"); verify.currentParameterHelpArgumentDocCommentIs("this is about b"); +goTo.marker('29aq'); +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"); +goTo.marker('30aq'); +verify.quickInfoIs("(parameter) c: () => string", "this is optional param c"); goTo.marker('31'); verify.currentSignatureHelpDocCommentIs("This is subtract function"); verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('31aq'); +verify.quickInfoIs("(parameter) d: () => string", ""); goTo.marker('32'); verify.currentSignatureHelpDocCommentIs("This is subtract function"); verify.currentParameterHelpArgumentDocCommentIs("this is optional param e"); +goTo.marker('32aq'); +verify.quickInfoIs("(parameter) e: () => string", "this is optional param e"); goTo.marker('33'); verify.currentSignatureHelpDocCommentIs("This is subtract function"); verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('33aq'); +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"); 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("(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"); 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("(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"); +goTo.marker('36aq'); +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"); 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("(parameter) foo: string", "is string"); goTo.marker('38'); verify.currentSignatureHelpDocCommentIs("Function returns string concat of foo and bar"); verify.currentParameterHelpArgumentDocCommentIs("is second string"); +goTo.marker('38aq'); +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 "); 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("(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"); +goTo.marker('41aq'); +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"); +goTo.marker('42aq'); +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(""); +goTo.marker('43aq'); +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 "); 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"); 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"); 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("(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"); +goTo.marker('48aq'); +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"); +goTo.marker('49aq'); +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"); \ No newline at end of file +verify.quickInfoIs("class NoQuickInfoClass", ""); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsEnums.ts b/tests/cases/fourslash/commentsEnums.ts new file mode 100644 index 00000000000..9e3213a0903 --- /dev/null +++ b/tests/cases/fourslash/commentsEnums.ts @@ -0,0 +1,37 @@ +/// + +/////** Enum of colors*/ +////enum /*1*/Colors { +//// /** Fancy name for 'blue'*/ +//// /*2*/Cornflower, +//// /** Fancy name for 'pink'*/ +//// /*3*/FancyPink +////} +////var /*4*/x = /*5*/Colors./*6*/Cornflower; +////x = Colors./*7*/FancyPink; + +goTo.marker('1'); +verify.quickInfoIs("enum Colors", "Enum of colors"); + +goTo.marker('2'); +verify.quickInfoIs("(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); + +goTo.marker('3'); +verify.quickInfoIs("(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); + +goTo.marker('4'); +verify.quickInfoIs("(var) x: Colors", ""); + +goTo.marker('5'); +verify.completionListContains("Colors", "enum Colors", "Enum of colors"); +verify.quickInfoIs("enum Colors", "Enum of colors"); + +goTo.marker('6'); +verify.memberListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); +verify.memberListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); +verify.quickInfoIs("(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); + +goTo.marker('7'); +verify.memberListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); +verify.memberListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); +verify.quickInfoIs("(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsExternalModules.ts b/tests/cases/fourslash/commentsExternalModules.ts new file mode 100644 index 00000000000..0eed08ca01e --- /dev/null +++ b/tests/cases/fourslash/commentsExternalModules.ts @@ -0,0 +1,95 @@ +/// + +// @Filename: commentsExternalModules_file0.ts +/////** Module comment*/ +////export module m/*1*/1 { +//// /** b's comment*/ +//// export var b: number; +//// /** foo's comment*/ +//// function foo() { +//// return /*2*/b; +//// } +//// /** m2 comments*/ +//// export module m2 { +//// /** class comment;*/ +//// export class c { +//// }; +//// /** i*/ +//// export var i = new c(); +//// } +//// /** exported function*/ +//// export function fooExport() { +//// return f/*3q*/oo(/*3*/); +//// } +////} +/////*4*/m1./*5*/fooEx/*6q*/port(/*6*/); +////var my/*7*/var = new m1.m2./*8*/c(); + +// @Filename: commentsExternalModules_file1.ts +/////**This is on import declaration*/ +////import ex/*9*/tMod = require("commentsExternalModules_file0"); +/////*10*/extMod./*11*/m1./*12*/fooExp/*13q*/ort(/*13*/); +////var new/*14*/Var = new extMod.m1.m2./*15*/c(); + +// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed +edit.insert(''); + +goTo.file("commentsExternalModules_file0.ts"); +goTo.marker('1'); +verify.quickInfoIs("module m1", "Module comment"); + +goTo.marker('2'); +verify.completionListContains("b", "(var) m1.b: number", "b's comment"); +verify.completionListContains("foo", "(function) foo(): number", "foo's comment"); + +goTo.marker('3'); +verify.currentSignatureHelpDocCommentIs("foo's comment"); +goTo.marker('3q'); +verify.quickInfoIs("(function) foo(): number", "foo's comment"); + +goTo.marker('4'); +verify.completionListContains("m1", "module m1", "Module comment"); + +goTo.marker('5'); +verify.memberListContains("b", "(var) m1.b: number", "b's comment"); +verify.memberListContains("fooExport", "(function) m1.fooExport(): number", "exported function"); +verify.memberListContains("m2", "module m1.m2"); + +goTo.marker('6'); +verify.currentSignatureHelpDocCommentIs("exported function"); +goTo.marker('6q'); +verify.quickInfoIs("(function) m1.fooExport(): number", "exported function"); + +goTo.marker('7'); +verify.quickInfoIs("(var) myvar: m1.m2.c", ""); + +goTo.marker('8'); +verify.memberListContains("c", "class m1.m2.c", "class comment;"); +verify.memberListContains("i", "(var) m1.m2.i: m1.m2.c", "i"); + +goTo.file("commentsExternalModules_file1.ts"); +goTo.marker('9'); +verify.quickInfoIs('(alias) extMod', "This is on import declaration"); + +goTo.marker('10'); +verify.completionListContains("extMod", "(alias) extMod", "This is on import declaration"); + +goTo.marker('11'); +verify.memberListContains("m1", "module extMod.m1"); + +goTo.marker('12'); +verify.memberListContains("b", "(var) extMod.m1.b: number", "b's comment"); +verify.memberListContains("fooExport", "(function) extMod.m1.fooExport(): number", "exported function"); +verify.memberListContains("m2", "module extMod.m1.m2"); + +goTo.marker('13'); +verify.currentSignatureHelpDocCommentIs("exported function"); +goTo.marker('13q'); +verify.quickInfoIs("(function) extMod.m1.fooExport(): number", "exported function"); + +goTo.marker('14'); +verify.quickInfoIs("(var) newVar: extMod.m1.m2.c", ""); + +goTo.marker('15'); +verify.memberListContains("c", "class extMod.m1.m2.c", "class comment;"); +verify.memberListContains("i", "(var) extMod.m1.m2.i: extMod.m1.m2.c", "i"); diff --git a/tests/cases/fourslash_old/commentsFunction.ts b/tests/cases/fourslash/commentsFunction.ts similarity index 52% rename from tests/cases/fourslash_old/commentsFunction.ts rename to tests/cases/fourslash/commentsFunction.ts index 5a13b3142aa..3a4e4e4dcc2 100644 --- a/tests/cases/fourslash_old/commentsFunction.ts +++ b/tests/cases/fourslash/commentsFunction.ts @@ -46,36 +46,36 @@ verify.currentSignatureHelpDocCommentIs("This is comment for function signature" verify.currentParameterHelpArgumentDocCommentIs("this is comment for b"); goTo.marker('4'); -verify.completionListContains('foo', '(): void', 'This comment should appear for foo', "foo", "function"); +verify.completionListContains('foo', '(function) foo(): void', 'This comment should appear for foo'); goTo.marker('5'); -verify.completionListContains('fooWithParameters', '(a: string, b: number): void', 'This is comment for function signature', "fooWithParameters", "function"); +verify.completionListContains('fooWithParameters', '(function) fooWithParameters(a: string, b: number): void', 'This is comment for function signature'); goTo.marker('6'); -verify.quickInfoIs("(): void", "This comment should appear for foo", "foo", "function"); +verify.quickInfoIs("(function) foo(): void", "This comment should appear for foo"); goTo.marker('7'); -verify.quickInfoIs("(): void", "This comment should appear for foo", "foo", "function"); +verify.quickInfoIs("(function) foo(): void", "This comment should appear for foo"); goTo.marker('8'); -verify.quickInfoIs("(a: string, b: number): void", "This is comment for function signature", "fooWithParameters", "function"); +verify.quickInfoIs("(function) fooWithParameters(a: string, b: number): void", "This is comment for function signature"); goTo.marker('9'); -verify.quickInfoIs("(a: string, b: number): void", "This is comment for function signature", "fooWithParameters", "function"); +verify.quickInfoIs("(function) fooWithParameters(a: string, b: number): void", "This is comment for function signature"); goTo.marker('10'); -verify.completionListContains('a', 'string', 'this is comment about a', "a", "parameter"); -verify.completionListContains('b', 'number', 'this is comment for b', "b", "parameter"); +verify.completionListContains('a', '(parameter) a: string', 'this is comment about a'); +verify.completionListContains('b', '(parameter) b: number', 'this is comment for b'); goTo.marker('11'); -verify.quickInfoIs("(a: number, b: number) => number", "lamdaFoo var comment", "lambdaFoo", "var"); +verify.quickInfoIs("(var) lambdaFoo: (a: number, b: number) => number", "lamdaFoo var comment"); goTo.marker('12'); -verify.quickInfoIs("(a: number, b: number) => number", "", "lambddaNoVarComment", "var"); +verify.quickInfoIs("(var) lambddaNoVarComment: (a: number, b: number) => number", ""); goTo.marker('13'); -verify.completionListContains('lambdaFoo', '(a: number, b: number) => number', 'lamdaFoo var comment', "lambdaFoo", "var"); -verify.completionListContains('lambddaNoVarComment', '(a: number, b: number) => number', '', "lambddaNoVarComment", "var"); +verify.completionListContains('lambdaFoo', '(var) lambdaFoo: (a: number, b: number) => number', 'lamdaFoo var comment'); +verify.completionListContains('lambddaNoVarComment', '(var) lambddaNoVarComment: (a: number, b: number) => number', ''); goTo.marker('14'); verify.currentParameterHelpArgumentDocCommentIs("param a"); @@ -90,42 +90,43 @@ goTo.marker('17'); verify.currentParameterHelpArgumentDocCommentIs("param b"); goTo.marker('18'); -verify.completionListContains('a', 'number', 'param a', "a", "parameter"); -verify.completionListContains('b', 'number', 'param b', "b", "parameter"); +verify.completionListContains('a', '(parameter) a: number', 'param a'); +verify.completionListContains('b', '(parameter) b: number', 'param b'); goTo.marker('19'); verify.currentSignatureHelpDocCommentIs("Does something"); verify.currentParameterHelpArgumentDocCommentIs("a string"); goTo.marker('20'); -verify.quickInfoIs('string', '', 'd', "local var"); +verify.quickInfoIs('(local var) d: string', ''); goTo.marker('20a'); -verify.quickInfoIs('(a: number) => number', '', 'lambdaAnotherFunc', "var"); +verify.quickInfoIs('(var) lambdaAnotherFunc: (a: number) => number', ''); goTo.marker('21'); -verify.quickInfoIs('number', '', 'a', "parameter"); +verify.quickInfoIs('(parameter) a: number', ''); goTo.marker('22'); -verify.quickInfoIs('number', '', 'bbbb', "local var"); +verify.quickInfoIs('(local var) bbbb: number', ''); goTo.marker('23'); -verify.quickInfoIs('number', '', 'bbbb', "local var"); +verify.quickInfoIs('(local var) bbbb: number', ''); goTo.marker('24'); -verify.quickInfoIs('number', '', 'a', "parameter"); +verify.quickInfoIs('(parameter) a: number', ''); goTo.marker('25'); -verify.quickInfoIs('(a: number): string', '', 'anotherFunc', "function"); +verify.quickInfoIs('(function) anotherFunc(a: number): string', ''); goTo.marker('26'); -verify.quickInfoIs('number', '', 'a', "parameter"); +verify.quickInfoIs('(parameter) a: number', ''); goTo.marker('27a'); -verify.quickInfoIs('(b: string) => string', '', 'lambdaVar', "local var"); +verify.quickInfoIs('(local var) lambdaVar: (b: string) => string', ''); goTo.marker('27'); -verify.quickInfoIs('string', '', 'b', "parameter"); +verify.quickInfoIs('(parameter) b: string', ''); goTo.marker('28'); -verify.quickInfoIs('string', '', 'localVar', "local var"); +verify.quickInfoIs('(local var) localVar: string', ''); goTo.marker('29'); -verify.quickInfoIs('string', '', 'localVar', "local var"); +verify.quickInfoIs('(local var) localVar: string', ''); goTo.marker('30'); -verify.quickInfoIs('string', '', 'b', "parameter"); +verify.quickInfoIs('(parameter) b: string', ''); goTo.marker('31'); -verify.quickInfoIs('(b: string) => string', '', 'lambdaVar', "local var"); +debugger; +verify.quickInfoIs('(local var) lambdaVar: (b: string) => string', ''); goTo.marker('32'); -verify.quickInfoIs('number', '', 'a', "parameter"); +verify.quickInfoIs('(parameter) a: number', ''); diff --git a/tests/cases/fourslash_old/commentsImportDeclaration.ts b/tests/cases/fourslash/commentsImportDeclaration.ts similarity index 52% rename from tests/cases/fourslash_old/commentsImportDeclaration.ts rename to tests/cases/fourslash/commentsImportDeclaration.ts index 29bfc3e2a61..192cb2763ca 100644 --- a/tests/cases/fourslash_old/commentsImportDeclaration.ts +++ b/tests/cases/fourslash/commentsImportDeclaration.ts @@ -20,32 +20,32 @@ // @Filename: commentsImportDeclaration_file1.ts /////// /////** Import declaration*/ -////import extMod/*3*/ = require("commentsImportDeclaration_file0/*4*/"); +////import /*3*/extMod = require("commentsImportDeclaration_file0/*4*/"); ////extMod./*6*/m1./*7*/fooEx/*8q*/port(/*8*/); ////var new/*9*/Var = new extMod.m1.m2./*10*/c(); goTo.marker('2'); -verify.quickInfoIs("m1", "ModuleComment", "m1", "module"); +verify.quickInfoIs("module m1", "ModuleComment"); goTo.marker('3'); -verify.quickInfoIs("extMod", "Import declaration", "extMod", "module"); +verify.quickInfoIs("(alias) extMod", "Import declaration"); goTo.marker('6'); -verify.memberListContains("m1", "extMod.m1"); +verify.memberListContains("m1", "module extMod.m1"); goTo.marker('7'); -verify.memberListContains("b", "number", "b's comment", "extMod.m1.b", "var"); -verify.memberListContains("fooExport", "(): number", "exported function", "extMod.m1.fooExport", "function"); -verify.memberListContains("m2", "extMod.m1.m2"); +verify.memberListContains("b", "(var) extMod.m1.b: number", "b's comment"); +verify.memberListContains("fooExport", "(function) extMod.m1.fooExport(): number", "exported function"); +verify.memberListContains("m2", "module extMod.m1.m2"); goTo.marker('8'); verify.currentSignatureHelpDocCommentIs("exported function"); goTo.marker('8q'); -verify.quickInfoIs("(): number", "exported function", "extMod.m1.fooExport", "function"); +verify.quickInfoIs("(function) extMod.m1.fooExport(): number", "exported function"); goTo.marker('9'); -verify.quickInfoIs("extMod.m1.m2.c", "", "newVar", "var"); +verify.quickInfoIs("(var) newVar: extMod.m1.m2.c", ""); goTo.marker('10'); -verify.memberListContains("c", undefined, "class comment;", "extMod.m1.m2.c", "class"); -verify.memberListContains("i", "extMod.m1.m2.c", "i", "extMod.m1.m2.i", "var"); +verify.memberListContains("c", "class extMod.m1.m2.c", "class comment;"); +verify.memberListContains("i", "(var) extMod.m1.m2.i: extMod.m1.m2.c", "i"); diff --git a/tests/cases/fourslash/commentsInheritance.ts b/tests/cases/fourslash/commentsInheritance.ts new file mode 100644 index 00000000000..eaca1d79ccb --- /dev/null +++ b/tests/cases/fourslash/commentsInheritance.ts @@ -0,0 +1,679 @@ +/// + +/////** i1 is interface with properties*/ +////interface i1 { +//// /** i1_p1*/ +//// i1_p1: number; +//// /** i1_f1*/ +//// i1_f1(): void; +//// /** i1_l1*/ +//// i1_l1: () => void; +//// i1_nc_p1: number; +//// i1_nc_f1(): void; +//// i1_nc_l1: () => void; +//// p1: number; +//// f1(): void; +//// l1: () => void; +//// nc_p1: number; +//// nc_f1(): void; +//// nc_l1: () => void; +////} +////class c1 implements i1 { +//// public i1_p1: number; +//// public i1_f1() { +//// } +//// public i1_l1: () => void; +//// public i1_nc_p1: number; +//// public i1_nc_f1() { +//// } +//// public i1_nc_l1: () => void; +//// /** c1_p1*/ +//// public p1: number; +//// /** c1_f1*/ +//// public f1() { +//// } +//// /** c1_l1*/ +//// public l1: () => void; +//// /** c1_nc_p1*/ +//// public nc_p1: number; +//// /** c1_nc_f1*/ +//// public nc_f1() { +//// } +//// /** c1_nc_l1*/ +//// public nc_l1: () => void; +////} +////var i1/*1iq*/_i: /*16i*/i1; +////i1_i./*1*/i/*2q*/1_f1(/*2*/); +////i1_i.i1_n/*3q*/c_f1(/*3*/); +////i1_i.f/*4q*/1(/*4*/); +////i1_i.nc/*5q*/_f1(/*5*/); +////i1_i.i1/*l2q*/_l1(/*l2*/); +////i1_i.i1_/*l3q*/nc_l1(/*l3*/); +////i1_i.l/*l4q*/1(/*l4*/); +////i1_i.nc/*l5q*/_l1(/*l5*/); +////var c1/*6iq*/_i = new c1(); +////c1_i./*6*/i1/*7q*/_f1(/*7*/); +////c1_i.i1_nc/*8q*/_f1(/*8*/); +////c1_i.f/*9q*/1(/*9*/); +////c1_i.nc/*10q*/_f1(/*10*/); +////c1_i.i1/*l7q*/_l1(/*l7*/); +////c1_i.i1_n/*l8q*/c_l1(/*l8*/); +////c1_i.l/*l9q*/1(/*l9*/); +////c1_i.nc/*l10q*/_l1(/*l10*/); +////// assign to interface +////i1_i = c1_i; +////i1_i./*11*/i1/*12q*/_f1(/*12*/); +////i1_i.i1_nc/*13q*/_f1(/*13*/); +////i1_i.f/*14q*/1(/*14*/); +////i1_i.nc/*15q*/_f1(/*15*/); +////i1_i.i1/*l12q*/_l1(/*l12*/); +////i1_i.i1/*l13q*/_nc_l1(/*l13*/); +////i1_i.l/*l14q*/1(/*l14*/); +////i1_i.nc/*l15q*/_l1(/*l15*/); +/////*16*/ +////class c2 { +//// /** c2 c2_p1*/ +//// public c2_p1: number; +//// /** c2 c2_f1*/ +//// public c2_f1() { +//// } +//// /** c2 c2_prop*/ +//// public get c2_prop() { +//// return 10; +//// } +//// public c2_nc_p1: number; +//// public c2_nc_f1() { +//// } +//// public get c2_nc_prop() { +//// return 10; +//// } +//// /** c2 p1*/ +//// public p1: number; +//// /** c2 f1*/ +//// public f1() { +//// } +//// /** c2 prop*/ +//// public get prop() { +//// return 10; +//// } +//// public nc_p1: number; +//// public nc_f1() { +//// } +//// public get nc_prop() { +//// return 10; +//// } +//// /** c2 constructor*/ +//// constr/*55*/uctor(a: number) { +//// this.c2_p1 = a; +//// } +////} +////class c3 extends c2 { +//// cons/*56*/tructor() { +//// su/*18sq*/per(10); +//// this.p1 = s/*18spropq*/uper./*18spropProp*/c2_p1; +//// } +//// /** c3 p1*/ +//// public p1: number; +//// /** c3 f1*/ +//// public f1() { +//// } +//// /** c3 prop*/ +//// public get prop() { +//// return 10; +//// } +//// public nc_p1: number; +//// public nc_f1() { +//// } +//// public get nc_prop() { +//// return 10; +//// } +////} +////var c/*17iq*/2_i = new c/*17q*/2(/*17*/10); +////var c/*18iq*/3_i = new c/*18q*/3(/*18*/); +////c2_i./*19*/c2/*20q*/_f1(/*20*/); +////c2_i.c2_nc/*21q*/_f1(/*21*/); +////c2_i.f/*22q*/1(/*22*/); +////c2_i.nc/*23q*/_f1(/*23*/); +////c3_i./*24*/c2/*25q*/_f1(/*25*/); +////c3_i.c2_nc/*26q*/_f1(/*26*/); +////c3_i.f/*27q*/1(/*27*/); +////c3_i.nc/*28q*/_f1(/*28*/); +////// assign +////c2_i = c3_i; +////c2_i./*29*/c2/*30q*/_f1(/*30*/); +////c2_i.c2_nc_/*31q*/f1(/*31*/); +////c2_i.f/*32q*/1(/*32*/); +////c2_i.nc/*33q*/_f1(/*33*/); +////class c4 extends c2 { +////} +////var c4/*34iq*/_i = new c/*34q*/4(/*34*/10); +/////*35*/ +////interface i2 { +//// /** i2_p1*/ +//// i2_p1: number; +//// /** i2_f1*/ +//// i2_f1(): void; +//// /** i2_l1*/ +//// i2_l1: () => void; +//// i2_nc_p1: number; +//// i2_nc_f1(): void; +//// i2_nc_l1: () => void; +//// /** i2 p1*/ +//// p1: number; +//// /** i2 f1*/ +//// f1(): void; +//// /** i2 l1*/ +//// l1: () => void; +//// nc_p1: number; +//// nc_f1(): void; +//// nc_l1: () => void; +////} +////interface i3 extends i2 { +//// /** i3 p1*/ +//// p1: number; +//// /** i3 f1*/ +//// f1(): void; +//// /** i3 l1*/ +//// l1: () => void; +//// nc_p1: number; +//// nc_f1(): void; +//// nc_l1: () => void; +////} +////var i2/*36iq*/_i: /*51i*/i2; +////var i3/*37iq*/_i: i3; +////i2_i./*36*/i2/*37q*/_f1(/*37*/); +////i2_i.i2_n/*38q*/c_f1(/*38*/); +////i2_i.f/*39q*/1(/*39*/); +////i2_i.nc/*40q*/_f1(/*40*/); +////i2_i.i2_/*l37q*/l1(/*l37*/); +////i2_i.i2_nc/*l38q*/_l1(/*l38*/); +////i2_i.l/*l39q*/1(/*l39*/); +////i2_i.nc_/*l40q*/l1(/*l40*/); +////i3_i./*41*/i2_/*42q*/f1(/*42*/); +////i3_i.i2_nc/*43q*/_f1(/*43*/); +////i3_i.f/*44q*/1(/*44*/); +////i3_i.nc_/*45q*/f1(/*45*/); +////i3_i.i2_/*l42q*/l1(/*l42*/); +////i3_i.i2_nc/*l43q*/_l1(/*l43*/); +////i3_i.l/*l44q*/1(/*l44*/); +////i3_i.nc_/*l45q*/l1(/*l45*/); +////// assign to interface +////i2_i = i3_i; +////i2_i./*46*/i2/*47q*/_f1(/*47*/); +////i2_i.i2_nc_/*48q*/f1(/*48*/); +////i2_i.f/*49q*/1(/*49*/); +////i2_i.nc/*50q*/_f1(/*50*/); +////i2_i.i2_/*l47q*/l1(/*l47*/); +////i2_i.i2_nc/*l48q*/_l1(/*l48*/); +////i2_i.l/*l49q*/1(/*l49*/); +////i2_i.nc_/*l50q*/l1(/*l50*/); +/////*51*/ +/////**c5 class*/ +////class c5 { +//// public b: number; +////} +////class c6 extends c5 { +//// public d; +//// const/*57*/ructor() { +//// /*52*/super(); +//// this.d = /*53*/super./*54*/b; +//// } +////} + +goTo.marker('1'); +verify.memberListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1"); +verify.memberListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1"); +verify.memberListContains("i1_l1", "(property) i1.i1_l1: () => void", "i1_l1"); +verify.memberListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", ""); +verify.memberListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", ""); +verify.memberListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", ""); +verify.memberListContains("p1", "(property) i1.p1: number", ""); +verify.memberListContains("f1", "(method) i1.f1(): void", ""); +verify.memberListContains("l1", "(property) i1.l1: () => void", ""); +verify.memberListContains("nc_p1", "(property) i1.nc_p1: number", ""); +verify.memberListContains("nc_f1", "(method) i1.nc_f1(): void", ""); +verify.memberListContains("nc_l1", "(property) i1.nc_l1: () => void", ""); +goTo.marker('2'); +verify.currentSignatureHelpDocCommentIs("i1_f1"); +goTo.marker('3'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('4'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('5'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l2'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l3'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l4'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l5'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('1iq'); +verify.quickInfoIs("(var) i1_i: i1", ""); +goTo.marker('2q'); +verify.quickInfoIs("(method) i1.i1_f1(): void", "i1_f1"); +goTo.marker('3q'); +verify.quickInfoIs("(method) i1.i1_nc_f1(): void", ""); +goTo.marker('4q'); +verify.quickInfoIs("(method) i1.f1(): void", ""); +goTo.marker('5q'); +verify.quickInfoIs("(method) i1.nc_f1(): void", ""); +goTo.marker('l2q'); +verify.quickInfoIs("(property) i1.i1_l1: () => void", ""); +goTo.marker('l3q'); +verify.quickInfoIs("(property) i1.i1_nc_l1: () => void", ""); +goTo.marker('l4q'); +verify.quickInfoIs("(property) i1.l1: () => void", ""); +goTo.marker('l5q'); +verify.quickInfoIs("(property) i1.nc_l1: () => void", ""); + +goTo.marker('6'); +verify.memberListContains("i1_p1", "(property) c1.i1_p1: number", ""); +verify.memberListContains("i1_f1", "(method) c1.i1_f1(): void", ""); +verify.memberListContains("i1_l1", "(property) c1.i1_l1: () => void", ""); +verify.memberListContains("i1_nc_p1", "(property) c1.i1_nc_p1: number", ""); +verify.memberListContains("i1_nc_f1", "(method) c1.i1_nc_f1(): void", ""); +verify.memberListContains("i1_nc_l1", "(property) c1.i1_nc_l1: () => void", ""); +verify.memberListContains("p1", "(property) c1.p1: number", "c1_p1"); +verify.memberListContains("f1", "(method) c1.f1(): void", "c1_f1"); +verify.memberListContains("l1", "(property) c1.l1: () => void", "c1_l1"); +verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "c1_nc_p1"); +verify.memberListContains("nc_f1", "(method) c1.nc_f1(): void", "c1_nc_f1"); +verify.memberListContains("nc_l1", "(property) c1.nc_l1: () => void", "c1_nc_l1"); +goTo.marker('7'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('8'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('9'); +verify.currentSignatureHelpDocCommentIs("c1_f1"); +goTo.marker('10'); +verify.currentSignatureHelpDocCommentIs("c1_nc_f1"); +goTo.marker('l7'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l8'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l9'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l10'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('6iq'); +verify.quickInfoIs("(var) c1_i: c1", ""); +goTo.marker('7q'); +verify.quickInfoIs("(method) c1.i1_f1(): void", ""); +goTo.marker('8q'); +verify.quickInfoIs("(method) c1.i1_nc_f1(): void", ""); +goTo.marker('9q'); +verify.quickInfoIs("(method) c1.f1(): void", "c1_f1"); +goTo.marker('10q'); +verify.quickInfoIs("(method) c1.nc_f1(): void", "c1_nc_f1"); +goTo.marker('l7q'); +verify.quickInfoIs("(property) c1.i1_l1: () => void", ""); +goTo.marker('l8q'); +verify.quickInfoIs("(property) c1.i1_nc_l1: () => void", ""); +goTo.marker('l9q'); +verify.quickInfoIs("(property) c1.l1: () => void", ""); +goTo.marker('l10q'); +verify.quickInfoIs("(property) c1.nc_l1: () => void", ""); + +goTo.marker('11'); +verify.memberListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1"); +verify.memberListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1"); +verify.memberListContains("i1_l1", "(property) i1.i1_l1: () => void", "i1_l1"); +verify.memberListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", ""); +verify.memberListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", ""); +verify.memberListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", ""); +verify.memberListContains("p1", "(property) i1.p1: number", ""); +verify.memberListContains("f1", "(method) i1.f1(): void", ""); +verify.memberListContains("l1", "(property) i1.l1: () => void", ""); +verify.memberListContains("nc_p1", "(property) i1.nc_p1: number", ""); +verify.memberListContains("nc_f1", "(method) i1.nc_f1(): void", ""); +verify.memberListContains("nc_l1", "(property) i1.nc_l1: () => void", ""); +goTo.marker('12'); +verify.currentSignatureHelpDocCommentIs("i1_f1"); +goTo.marker('13'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('14'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('15'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l12'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l13'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l14'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l15'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('12q'); +verify.quickInfoIs("(method) i1.i1_f1(): void", "i1_f1"); +goTo.marker('13q'); +verify.quickInfoIs("(method) i1.i1_nc_f1(): void", ""); +goTo.marker('14q'); +verify.quickInfoIs("(method) i1.f1(): void", ""); +goTo.marker('15q'); +verify.quickInfoIs("(method) i1.nc_f1(): void", ""); +goTo.marker('l12q'); +verify.quickInfoIs("(property) i1.i1_l1: () => void", ""); +goTo.marker('l13q'); +verify.quickInfoIs("(property) i1.i1_nc_l1: () => void", ""); +goTo.marker('l14q'); +verify.quickInfoIs("(property) i1.l1: () => void", ""); +goTo.marker('l15q'); +verify.quickInfoIs("(property) i1.nc_l1: () => void", ""); + +goTo.marker('16'); +verify.completionListContains("i1", "interface i1", "i1 is interface with properties"); +verify.completionListContains("i1_i", "(var) i1_i: i1", ""); +verify.completionListContains("c1", "class c1", ""); +verify.completionListContains("c1_i", "(var) c1_i: c1", ""); + +goTo.marker('16i'); +verify.completionListContains("i1", "interface i1", "i1 is interface with properties"); + +goTo.marker('17iq'); +verify.quickInfoIs("(var) c2_i: c2", ""); +goTo.marker('18iq'); +verify.quickInfoIs("(var) c3_i: c3", ""); + +goTo.marker('17'); +verify.currentSignatureHelpDocCommentIs("c2 constructor"); + +goTo.marker('18'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('18sq'); +verify.quickInfoIs("(constructor) c2(a: number): c2", "c2 constructor"); + +goTo.marker('18spropq'); +verify.quickInfoIs("class c2", ""); +goTo.marker('18spropProp'); +verify.quickInfoIs("(property) c2.c2_p1: number", "c2 c2_p1"); + +goTo.marker('17q'); +verify.quickInfoIs("(constructor) c2(a: number): c2", "c2 constructor"); +goTo.marker('18q'); +verify.quickInfoIs("(constructor) c3(): c3", ""); + +goTo.marker('19'); +verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); +verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); +verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); +verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); +verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); +verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", ""); +verify.memberListContains("p1", "(property) c2.p1: number", "c2 p1"); +verify.memberListContains("f1", "(method) c2.f1(): void", "c2 f1"); +verify.memberListContains("prop", "(property) c2.prop: number", "c2 prop"); +verify.memberListContains("nc_p1", "(property) c2.nc_p1: number", ""); +verify.memberListContains("nc_f1", "(method) c2.nc_f1(): void", ""); +verify.memberListContains("nc_prop", "(property) c2.nc_prop: number", ""); +goTo.marker('20'); +verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); +goTo.marker('21'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('22'); +verify.currentSignatureHelpDocCommentIs("c2 f1"); +goTo.marker('23'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('20q'); +verify.quickInfoIs("(method) c2.c2_f1(): void", "c2 c2_f1"); +goTo.marker('21q'); +verify.quickInfoIs("(method) c2.c2_nc_f1(): void", ""); +goTo.marker('22q'); +verify.quickInfoIs("(method) c2.f1(): void", "c2 f1"); +goTo.marker('23q'); +verify.quickInfoIs("(method) c2.nc_f1(): void", ""); + +goTo.marker('24'); +verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); +verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); +verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); +verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); +verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); +verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", ""); +verify.memberListContains("p1", "(property) c3.p1: number", "c3 p1"); +verify.memberListContains("f1", "(method) c3.f1(): void", "c3 f1"); +verify.memberListContains("prop", "(property) c3.prop: number", "c3 prop"); +verify.memberListContains("nc_p1", "(property) c3.nc_p1: number", ""); +verify.memberListContains("nc_f1", "(method) c3.nc_f1(): void", ""); +verify.memberListContains("nc_prop", "(property) c3.nc_prop: number", ""); +goTo.marker('25'); +verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); +goTo.marker('26'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('27'); +verify.currentSignatureHelpDocCommentIs("c3 f1"); +goTo.marker('28'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('25q'); +verify.quickInfoIs("(method) c2.c2_f1(): void", "c2 c2_f1"); +goTo.marker('26q'); +verify.quickInfoIs("(method) c2.c2_nc_f1(): void", ""); +goTo.marker('27q'); +verify.quickInfoIs("(method) c3.f1(): void", "c3 f1"); +goTo.marker('28q'); +verify.quickInfoIs("(method) c3.nc_f1(): void", ""); + +goTo.marker('29'); +verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); +verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); +verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); +verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); +verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); +verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number"); +verify.memberListContains("p1", "(property) c2.p1: number", "c2 p1"); +verify.memberListContains("f1", "(method) c2.f1(): void", "c2 f1"); +verify.memberListContains("prop", "(property) c2.prop: number", "c2 prop"); +verify.memberListContains("nc_p1", "(property) c2.nc_p1: number", ""); +verify.memberListContains("nc_f1", "(method) c2.nc_f1(): void", ""); +verify.memberListContains("nc_prop", "(property) c2.nc_prop: number", ""); +goTo.marker('30'); +verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); +goTo.marker('31'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('32'); +verify.currentSignatureHelpDocCommentIs("c2 f1"); +goTo.marker('33'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('30q'); +verify.quickInfoIs("(method) c2.c2_f1(): void", "c2 c2_f1"); +goTo.marker('31q'); +verify.quickInfoIs("(method) c2.c2_nc_f1(): void", ""); +goTo.marker('32q'); +verify.quickInfoIs("(method) c2.f1(): void", "c2 f1"); +goTo.marker('33q'); +verify.quickInfoIs("(method) c2.nc_f1(): void", ""); + +goTo.marker('34'); +verify.currentSignatureHelpDocCommentIs("c2 constructor"); +goTo.marker('34iq'); +verify.quickInfoIs("(var) c4_i: c4", ""); +goTo.marker('34q'); +verify.quickInfoIs("(constructor) c4(a: number): c4", "c2 constructor"); + +goTo.marker('35'); +verify.completionListContains("c2", "class c2", ""); +verify.completionListContains("c2_i", "(var) c2_i: c2", ""); +verify.completionListContains("c3", "class c3", ""); +verify.completionListContains("c3_i", "(var) c3_i: c3", ""); +verify.completionListContains("c4", "class c4", ""); +verify.completionListContains("c4_i", "(var) c4_i: c4", ""); + +goTo.marker('36'); +verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); +verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); +verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", "i2_l1"); +verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); +verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); +verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); +verify.memberListContains("p1", "(property) i2.p1: number", "i2 p1"); +verify.memberListContains("f1", "(method) i2.f1(): void", "i2 f1"); +verify.memberListContains("l1", "(property) i2.l1: () => void", "i2 l1"); +verify.memberListContains("nc_p1", "(property) i2.nc_p1: number", ""); +verify.memberListContains("nc_f1", "(method) i2.nc_f1(): void", ""); +verify.memberListContains("nc_l1", "(property) i2.nc_l1: () => void", ""); +goTo.marker('37'); +verify.currentSignatureHelpDocCommentIs("i2_f1"); +goTo.marker('38'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('39'); +verify.currentSignatureHelpDocCommentIs("i2 f1"); +goTo.marker('40'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l37'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l38'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l39'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l40'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('36iq'); +verify.quickInfoIs("(var) i2_i: i2", ""); +goTo.marker('37iq'); +verify.quickInfoIs("(var) i3_i: i3", ""); +goTo.marker('37q'); +verify.quickInfoIs("(method) i2.i2_f1(): void", "i2_f1"); +goTo.marker('38q'); +verify.quickInfoIs("(method) i2.i2_nc_f1(): void", ""); +goTo.marker('39q'); +verify.quickInfoIs("(method) i2.f1(): void", "i2 f1"); +goTo.marker('40q'); +verify.quickInfoIs("(method) i2.nc_f1(): void", ""); +goTo.marker('l37q'); +verify.quickInfoIs("(property) i2.i2_l1: () => void", ""); +goTo.marker('l38q'); +verify.quickInfoIs("(property) i2.i2_nc_l1: () => void", ""); +goTo.marker('l39q'); +verify.quickInfoIs("(property) i2.l1: () => void", ""); +goTo.marker('l40q'); +verify.quickInfoIs("(property) i2.nc_l1: () => void", ""); + +goTo.marker('41'); +verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); +verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); +verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", "i2_l1"); +verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); +verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); +verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); +verify.memberListContains("p1", "(property) i3.p1: number", "i3 p1"); +verify.memberListContains("f1", "(method) i3.f1(): void", "i3 f1"); +verify.memberListContains("l1", "(property) i3.l1: () => void", "i3 l1"); +verify.memberListContains("nc_p1", "(property) i3.nc_p1: number", ""); +verify.memberListContains("nc_f1", "(method) i3.nc_f1(): void", ""); +verify.memberListContains("nc_l1", "(property) i3.nc_l1: () => void", ""); +goTo.marker('42'); +verify.currentSignatureHelpDocCommentIs("i2_f1"); +goTo.marker('43'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('44'); +verify.currentSignatureHelpDocCommentIs("i3 f1"); +goTo.marker('45'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l42'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l43'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l44'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l45'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('42q'); +verify.quickInfoIs("(method) i2.i2_f1(): void", "i2_f1"); +goTo.marker('43q'); +verify.quickInfoIs("(method) i2.i2_nc_f1(): void", ""); +goTo.marker('44q'); +verify.quickInfoIs("(method) i3.f1(): void", "i3 f1"); +goTo.marker('45q'); +verify.quickInfoIs("(method) i3.nc_f1(): void", ""); +goTo.marker('l42q'); +verify.quickInfoIs("(property) i2.i2_l1: () => void", ""); +goTo.marker('l43q'); +verify.quickInfoIs("(property) i2.i2_nc_l1: () => void", ""); +goTo.marker('l44q'); +verify.quickInfoIs("(property) i3.l1: () => void", ""); +goTo.marker('l45q'); +verify.quickInfoIs("(property) i3.nc_l1: () => void", ""); + +goTo.marker('46'); +verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); +verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); +verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", "i2_l1"); +verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); +verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); +verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); +verify.memberListContains("p1", "(property) i2.p1: number", "i2 p1"); +verify.memberListContains("f1", "(method) i2.f1(): void", "i2 f1"); +verify.memberListContains("l1", "(property) i2.l1: () => void", "i2 l1"); +verify.memberListContains("nc_p1", "(property) i2.nc_p1: number", ""); +verify.memberListContains("nc_f1", "(method) i2.nc_f1(): void", ""); +verify.memberListContains("nc_l1", "(property) i2.nc_l1: () => void", ""); +goTo.marker('47'); +verify.currentSignatureHelpDocCommentIs("i2_f1"); +goTo.marker('48'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('49'); +verify.currentSignatureHelpDocCommentIs("i2 f1"); +goTo.marker('50'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l47'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l48'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l49'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('l50'); +verify.currentSignatureHelpDocCommentIs(""); + +goTo.marker('47q'); +verify.quickInfoIs("(method) i2.i2_f1(): void", "i2_f1"); +goTo.marker('48q'); +verify.quickInfoIs("(method) i2.i2_nc_f1(): void", ""); +goTo.marker('49q'); +verify.quickInfoIs("(method) i2.f1(): void", "i2 f1"); +goTo.marker('50q'); +verify.quickInfoIs("(method) i2.nc_f1(): void", ""); +goTo.marker('l47q'); +verify.quickInfoIs("(property) i2.i2_l1: () => void", ""); +goTo.marker('l48q'); +verify.quickInfoIs("(property) i2.i2_nc_l1: () => void", ""); +goTo.marker('l49q'); +verify.quickInfoIs("(property) i2.l1: () => void", ""); +goTo.marker('l50q'); +verify.quickInfoIs("(property) i2.nc_l1: () => void", ""); + +goTo.marker('51'); +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", ""); + +goTo.marker('51i'); +verify.completionListContains("i2", "interface i2", ""); +verify.completionListContains("i3", "interface i3", ""); + +goTo.marker('52'); +verify.quickInfoIs("(constructor) c5(): c5", ""); + +goTo.marker('53'); +verify.quickInfoIs("class c5", "c5 class"); + +goTo.marker('54'); +verify.quickInfoIs("(property) c5.b: number", ""); + +goTo.marker('55'); +verify.quickInfoIs("(constructor) c2(a: number): c2", "c2 constructor"); + +goTo.marker('56'); +verify.quickInfoIs("(constructor) c3(): c3", ""); + +goTo.marker('57'); +verify.quickInfoIs("(constructor) c6(): c6", ""); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsInterface.ts b/tests/cases/fourslash/commentsInterface.ts new file mode 100644 index 00000000000..02856242cee --- /dev/null +++ b/tests/cases/fourslash/commentsInterface.ts @@ -0,0 +1,264 @@ +/// + +/////** this is interface 1*/ +////interface i/*1*/1 { +////} +////var i1/*2*/_i: i1; +////interface nc_/*3*/i1 { +////} +////var nc_/*4*/i1_i: nc_i1; +/////** this is interface 2 with memebers*/ +////interface i/*5*/2 { +//// /** this is x*/ +//// x: number; +//// /** this is foo*/ +//// foo: (/**param help*/b: number) => string; +//// /** this is indexer*/ +//// [/**string param*/i: string]: number; +//// /**new method*/ +//// new (/** param*/i: i1); +//// nc_x: number; +//// nc_foo: (b: number) => string; +//// [i: number]: number; +//// /** this is call signature*/ +//// (/**paramhelp a*/a: number,/**paramhelp b*/ b: number) : number; +//// /** this is fnfoo*/ +//// fnfoo(/**param help*/b: number): string; +//// nc_fnfoo(b: number): string; +////} +////var i2/*6*/_i: /*34i*/i2; +////var i2_i/*7*/_x = i2_i./*8*/x; +////var i2_i/*9*/_foo = i2_i.f/*10*/oo; +////var i2_i_f/*11*/oo_r = i2_i.f/*12q*/oo(/*12*/30); +////var i2_i_i2_/*13*/si = i2/*13q*/_i["hello"]; +////var i2_i_i2/*14*/_ii = i2/*14q*/_i[30]; +////var i2_/*15*/i_n = new i2/*16q*/_i(/*16*/i1_i); +////var i2_i/*17*/_nc_x = i2_i.n/*18*/c_x; +////var i2_i_/*19*/nc_foo = i2_i.n/*20*/c_foo; +////var i2_i_nc_f/*21*/oo_r = i2_i.nc/*22q*/_foo(/*22*/30); +////var i2/*23*/_i_r = i2/*24q*/_i(/*24*/10, /*25*/20); +////var i2_i/*26*/_fnfoo = i2_i.fn/*27*/foo; +////var i2_i_/*28*/fnfoo_r = i2_i.fn/*29q*/foo(/*29*/10); +////var i2_i/*30*/_nc_fnfoo = i2_i.nc_fn/*31*/foo; +////var i2_i_nc_/*32*/fnfoo_r = i2_i.nc/*33q*/_fnfoo(/*33*/10); +/////*34*/ +////interface i3 { +//// /** Comment i3 x*/ +//// x: number; +//// /** Function i3 f*/ +//// f(/**number parameter*/a: number): string; +//// /** i3 l*/ +//// l: (/**comment i3 l b*/b: number) => string; +//// nc_x: number; +//// nc_f(a: number): string; +//// nc_l: (b: number) => string; +////} +////var i3_i: i3; +////i3_i = { +//// /*35*/f: /**own f*/ (/**i3_i a*/a: number) => "Hello" + /*36*/a, +//// l: this./*37*/f, +//// /** own x*/ +//// x: this.f(/*38*/10), +//// nc_x: this.l(/*39*/this.x), +//// nc_f: this.f, +//// nc_l: this.l +////}; +/////*40*/i/*40q*/3_i./*41*/f(/*42*/10); +////i3_i./*43q*/l(/*43*/10); +////i3_i.nc_/*44q*/f(/*44*/10); +////i3_i.nc/*45q*/_l(/*45*/10); + +goTo.marker('1'); +verify.quickInfoIs("interface i1", "this is interface 1"); + +goTo.marker('2'); +verify.quickInfoIs("(var) i1_i: i1", ""); + +goTo.marker('3'); +verify.quickInfoIs("interface nc_i1", ""); + +goTo.marker('4'); +verify.quickInfoIs("(var) nc_i1_i: nc_i1", ""); + +goTo.marker('5'); +verify.quickInfoIs("interface i2", "this is interface 2 with memebers"); + +goTo.marker('6'); +verify.quickInfoIs("(var) i2_i: i2", ""); + +goTo.marker('7'); +verify.quickInfoIs("(var) i2_i_x: number", ""); + +goTo.marker('8'); +verify.quickInfoIs("(property) i2.x: number", "this is x"); +verify.memberListContains("x", "(property) i2.x: number", "this is x"); +verify.memberListContains("foo", "(property) i2.foo: (b: number) => string", "this is foo"); +verify.memberListContains("nc_x", "(property) i2.nc_x: number", ""); +verify.memberListContains("nc_foo", "(property) i2.nc_foo: (b: number) => string", ""); +verify.memberListContains("fnfoo", "(method) i2.fnfoo(b: number): string", "this is fnfoo"); +verify.memberListContains("nc_fnfoo", "(method) i2.nc_fnfoo(b: number): string", ""); + +goTo.marker('9'); +verify.quickInfoIs("(var) i2_i_foo: (b: number) => string", ""); + +goTo.marker('10'); +verify.quickInfoIs("(property) i2.foo: (b: number) => string", "this is foo"); + +goTo.marker('11'); +verify.quickInfoIs("(var) i2_i_foo_r: string", ""); + +goTo.marker('12'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs("param help"); +goTo.marker('12q'); +verify.quickInfoIs("(property) i2.foo: (b: number) => string", ""); + +goTo.marker('13'); +verify.quickInfoIs("(var) i2_i_i2_si: number", ""); +goTo.marker('13q'); +verify.quickInfoIs("(var) i2_i: i2", ""); + +goTo.marker('14'); +verify.quickInfoIs("(var) i2_i_i2_ii: number", ""); +goTo.marker('14q'); +verify.quickInfoIs("(var) i2_i: i2", ""); + +goTo.marker('15'); +verify.quickInfoIs("(var) i2_i_n: any", ""); + +goTo.marker('16'); +verify.currentSignatureHelpDocCommentIs("new method"); +verify.currentParameterHelpArgumentDocCommentIs("param"); +goTo.marker('16q'); +verify.quickInfoIs("(var) i2_i: new i2(i: i1) => any", "new method"); + +goTo.marker('17'); +verify.quickInfoIs("(var) i2_i_nc_x: number", ""); + +goTo.marker('18'); +verify.quickInfoIs("(property) i2.nc_x: number", ""); + +goTo.marker('19'); +verify.quickInfoIs("(var) i2_i_nc_foo: (b: number) => string", ""); + +goTo.marker('20'); +verify.quickInfoIs("(property) i2.nc_foo: (b: number) => string", ""); + +goTo.marker('21'); +verify.quickInfoIs("(var) i2_i_nc_foo_r: string", ""); + +goTo.marker('22'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('22q'); +verify.quickInfoIs("(property) i2.nc_foo: (b: number) => string", ""); + +goTo.marker('23'); +verify.quickInfoIs("(var) i2_i_r: number", ""); + +goTo.marker('24'); +verify.currentSignatureHelpDocCommentIs("this is call signature"); +verify.currentParameterHelpArgumentDocCommentIs("paramhelp a"); +goTo.marker('24q'); +verify.quickInfoIs("(var) i2_i: i2(a: number, b: number) => number", "this is call signature"); + +goTo.marker('25'); +verify.currentSignatureHelpDocCommentIs("this is call signature"); +verify.currentParameterHelpArgumentDocCommentIs("paramhelp b"); + +goTo.marker('26'); +verify.quickInfoIs("(var) i2_i_fnfoo: (b: number) => string", ""); + +goTo.marker('27'); +verify.quickInfoIs("(method) i2.fnfoo(b: number): string", "this is fnfoo"); + +goTo.marker('28'); +verify.quickInfoIs("(var) i2_i_fnfoo_r: string", ""); + +goTo.marker('29'); +verify.currentSignatureHelpDocCommentIs("this is fnfoo"); +verify.currentParameterHelpArgumentDocCommentIs("param help"); +goTo.marker('29q'); +verify.quickInfoIs("(method) i2.fnfoo(b: number): string", "this is fnfoo"); + +goTo.marker('30'); +verify.quickInfoIs("(var) i2_i_nc_fnfoo: (b: number) => string", ""); + +goTo.marker('31'); +verify.quickInfoIs("(method) i2.nc_fnfoo(b: number): string", ""); + +goTo.marker('32'); +verify.quickInfoIs("(var) i2_i_nc_fnfoo_r: string", ""); + +goTo.marker('33'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('33q'); +verify.quickInfoIs("(method) i2.nc_fnfoo(b: number): string", ""); + +goTo.marker('34'); +verify.completionListContains("i1", "interface i1", "this is interface 1"); +verify.completionListContains("i1_i", "(var) i1_i: i1", ""); +verify.completionListContains("nc_i1", "interface nc_i1", ""); +verify.completionListContains("nc_i1_i", "(var) nc_i1_i: nc_i1", ""); +verify.completionListContains("i2", "interface i2", "this is interface 2 with memebers"); +verify.completionListContains("i2_i", "(var) i2_i: i2", ""); +verify.completionListContains("i2_i_x", "(var) i2_i_x: number", ""); +verify.completionListContains("i2_i_foo", "(var) i2_i_foo: (b: number) => string", ""); +verify.completionListContains("i2_i_foo_r", "(var) i2_i_foo_r: string", ""); +verify.completionListContains("i2_i_i2_si", "(var) i2_i_i2_si: number", ""); +verify.completionListContains("i2_i_i2_ii", "(var) i2_i_i2_ii: number", ""); +verify.completionListContains("i2_i_n", "(var) i2_i_n: any", ""); +verify.completionListContains("i2_i_nc_x", "(var) i2_i_nc_x: number", ""); +verify.completionListContains("i2_i_nc_foo", "(var) i2_i_nc_foo: (b: number) => string", ""); +verify.completionListContains("i2_i_nc_foo_r", "(var) i2_i_nc_foo_r: string", ""); +verify.completionListContains("i2_i_r", "(var) i2_i_r: number", ""); +verify.completionListContains("i2_i_fnfoo", "(var) i2_i_fnfoo: (b: number) => string", ""); +verify.completionListContains("i2_i_fnfoo_r", "(var) i2_i_fnfoo_r: string", ""); +verify.completionListContains("i2_i_nc_fnfoo", "(var) i2_i_nc_fnfoo: (b: number) => string", ""); +verify.completionListContains("i2_i_nc_fnfoo_r", "(var) i2_i_nc_fnfoo_r: string", ""); + +goTo.marker('34i'); +verify.completionListContains("i1", "interface i1", "this is interface 1"); +verify.completionListContains("nc_i1", "interface nc_i1", ""); +verify.completionListContains("i2", "interface i2", "this is interface 2 with memebers"); + +goTo.marker('36'); +verify.completionListContains("a", "(parameter) a: number", "i3_i a"); + +goTo.marker('40q'); +verify.quickInfoIs("(var) i3_i: i3", ""); +goTo.marker('40'); +verify.completionListContains("i3", "interface i3", ""); +verify.completionListContains("i3_i", "(var) i3_i: i3", ""); + +goTo.marker('41'); +verify.quickInfoIs("(method) i3.f(a: number): string", "Function i3 f"); +verify.memberListContains("f", "(method) i3.f(a: number): string", "Function i3 f"); +verify.memberListContains("l", "(property) i3.l: (b: number) => string", "i3 l"); +verify.memberListContains("x", "(property) i3.x: number", "Comment i3 x"); +verify.memberListContains("nc_f", "(method) i3.nc_f(a: number): string", ""); +verify.memberListContains("nc_l", "(property) i3.nc_l: (b: number) => string", ""); +verify.memberListContains("nc_x", "(property) i3.nc_x: number", ""); + +goTo.marker('42'); +verify.currentSignatureHelpDocCommentIs("Function i3 f"); +verify.currentParameterHelpArgumentDocCommentIs("number parameter"); + +goTo.marker('43'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs("comment i3 l b"); +goTo.marker('43q'); +verify.quickInfoIs("(property) i3.l: (b: number) => string", ""); + +goTo.marker('44'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('44q'); +verify.quickInfoIs("(method) i3.nc_f(a: number): string", ""); + +goTo.marker('45'); +verify.currentSignatureHelpDocCommentIs(""); +verify.currentParameterHelpArgumentDocCommentIs(""); +goTo.marker('45q'); +verify.quickInfoIs("(property) i3.nc_l: (b: number) => string", ""); diff --git a/tests/cases/fourslash/commentsModules.ts b/tests/cases/fourslash/commentsModules.ts new file mode 100644 index 00000000000..06b45afe89e --- /dev/null +++ b/tests/cases/fourslash/commentsModules.ts @@ -0,0 +1,251 @@ +/// + +/////** Module comment*/ +////module m/*1*/1 { +//// /** b's comment*/ +//// export var b: number; +//// /** foo's comment*/ +//// function foo() { +//// return /*2*/b; +//// } +//// /** m2 comments*/ +//// export module m2 { +//// /** class comment;*/ +//// export class c { +//// }; +//// /** i*/ +//// export var i = new c(); +//// } +//// /** exported function*/ +//// export function fooExport() { +//// return fo/*3q*/o(/*3*/); +//// } +////} +/////*4*/m1./*5*/fooExport(/*6*/); +////var my/*7*/var = new m1.m2./*8*/c(); +/////** module comment of m2.m3*/ +////module m2.m3 { +//// /** Exported class comment*/ +//// export class c { +//// } +////} +////new /*9*/m2./*10*/m3./*11*/c(); +/////** module comment of m3.m4.m5*/ +////module m3.m4.m5 { +//// /** Exported class comment*/ +//// export class c { +//// } +////} +////new /*12*/m3./*13*/m4./*14*/m5./*15*/c(); +/////** module comment of m4.m5.m6*/ +////module m4.m5.m6 { +//// export module m7 { +//// /** Exported class comment*/ +//// export class c { +//// } +//// } +////} +////new /*16*/m4./*17*/m5./*18*/m6./*19*/m7./*20*/c(); +/////** module comment of m5.m6.m7*/ +////module m5.m6.m7 { +//// /** module m8 comment*/ +//// export module m8 { +//// /** Exported class comment*/ +//// export class c { +//// } +//// } +////} +////new /*21*/m5./*22*/m6./*23*/m7./*24*/m8./*25*/c(); +////module m6.m7 { +//// export module m8 { +//// /** Exported class comment*/ +//// export class c { +//// } +//// } +////} +////new /*26*/m6./*27*/m7./*28*/m8./*29*/c(); +////module m7.m8 { +//// /** module m9 comment*/ +//// export module m9 { +//// /** Exported class comment*/ +//// export class c { +//// } +//// } +////} +////new /*30*/m7./*31*/m8./*32*/m9./*33*/c(); +////declare module "quotedM" { +//// export class c { +//// } +//// export var b: /*34*/c; +////} +////module complexM { +//// export module m1 { +//// export class c { +//// public foo() { +//// return 30; +//// } +//// } +//// } +//// export module m2 { +//// export class c { +//// public foo2() { +//// return new complexM.m1.c(); +//// } +//// } +//// } +////} +////var myComp/*35*/lexVal = new compl/*36*/exM.m/*37*/2./*38*/c().f/*39*/oo2().f/*40*/oo(); + +goTo.marker('1'); +verify.quickInfoIs("module m1", "Module comment"); + +goTo.marker('2'); +verify.completionListContains("b", "(var) m1.b: number", "b's comment"); +verify.completionListContains("foo", "(function) foo(): number", "foo's comment"); + +goTo.marker('3'); +verify.currentSignatureHelpDocCommentIs("foo's comment"); +goTo.marker('3q'); +verify.quickInfoIs("(function) foo(): number", "foo's comment"); + +goTo.marker('4'); +verify.completionListContains("m1", "module m1", "Module comment"); + +goTo.marker('5'); +verify.memberListContains("b", "(var) m1.b: number", "b's comment"); +verify.memberListContains("fooExport", "(function) m1.fooExport(): number", "exported function"); +verify.memberListContains("m2", "module m1.m2"); +verify.quickInfoIs("(function) m1.fooExport(): number", "exported function"); + +goTo.marker('6'); +verify.currentSignatureHelpDocCommentIs("exported function"); + +goTo.marker('7'); +verify.quickInfoIs("(var) myvar: m1.m2.c", ""); + +goTo.marker('8'); +verify.quickInfoIs("(constructor) m1.m2.c(): m1.m2.c", ""); +verify.memberListContains("c", "class m1.m2.c", "class comment;"); +verify.memberListContains("i", "(var) m1.m2.i: m1.m2.c", "i"); + +goTo.marker('9'); +verify.completionListContains("m2", "module m2", ""); +verify.quickInfoIs("module m2", ""); + +goTo.marker('10'); +verify.memberListContains("m3", "module m2.m3"); +verify.quickInfoIs("module m2.m3", "module comment of m2.m3"); + +goTo.marker('11'); +verify.quickInfoIs("(constructor) m2.m3.c(): m2.m3.c", ""); +verify.memberListContains("c", "class m2.m3.c", "Exported class comment"); + +goTo.marker('12'); +verify.completionListContains("m3", "module m3", ""); +verify.quickInfoIs("module m3", ""); + +goTo.marker('13'); +verify.memberListContains("m4", "module m3.m4", ""); +verify.quickInfoIs("module m3.m4", ""); + +goTo.marker('14'); +verify.memberListContains("m5", "module m3.m4.m5"); +verify.quickInfoIs("module m3.m4.m5", "module comment of m3.m4.m5"); + +goTo.marker('15'); +verify.memberListContains("c", "class m3.m4.m5.c", "Exported class comment"); +verify.quickInfoIs("(constructor) m3.m4.m5.c(): m3.m4.m5.c", ""); + +goTo.marker('16'); +verify.completionListContains("m4", "module m4", ""); +verify.quickInfoIs("module m4", ""); + +goTo.marker('17'); +verify.memberListContains("m5", "module m4.m5", ""); +verify.quickInfoIs("module m4.m5", ""); + +goTo.marker('18'); +verify.memberListContains("m6", "module m4.m5.m6"); +verify.quickInfoIs("module m4.m5.m6", "module comment of m4.m5.m6"); + +goTo.marker('19'); +verify.memberListContains("m7", "module m4.m5.m6.m7"); +verify.quickInfoIs("module m4.m5.m6.m7", ""); + +goTo.marker('20'); +verify.memberListContains("c", "class m4.m5.m6.m7.c", "Exported class comment"); +verify.quickInfoIs("(constructor) m4.m5.m6.m7.c(): m4.m5.m6.m7.c", ""); + +goTo.marker('21'); +verify.completionListContains("m5", "module m5"); +verify.quickInfoIs("module m5", ""); + +goTo.marker('22'); +verify.memberListContains("m6", "module m5.m6"); +verify.quickInfoIs("module m5.m6", ""); + +goTo.marker('23'); +verify.memberListContains("m7", "module m5.m6.m7"); +verify.quickInfoIs("module m5.m6.m7", "module comment of m5.m6.m7"); + +goTo.marker('24'); +verify.memberListContains("m8", "module m5.m6.m7.m8"); +verify.quickInfoIs("module m5.m6.m7.m8", "module m8 comment"); + +goTo.marker('25'); +verify.memberListContains("c", "class m5.m6.m7.m8.c", "Exported class comment"); +verify.quickInfoIs("(constructor) m5.m6.m7.m8.c(): m5.m6.m7.m8.c", ""); + +goTo.marker('26'); +verify.completionListContains("m6", "module m6"); +verify.quickInfoIs("module m6", ""); + +goTo.marker('27'); +verify.memberListContains("m7", "module m6.m7"); +verify.quickInfoIs("module m6.m7", ""); + +goTo.marker('28'); +verify.memberListContains("m8", "module m6.m7.m8"); +verify.quickInfoIs("module m6.m7.m8", ""); + +goTo.marker('29'); +verify.memberListContains("c", "class m6.m7.m8.c", "Exported class comment"); +verify.quickInfoIs("(constructor) m6.m7.m8.c(): m6.m7.m8.c", ""); + +goTo.marker('30'); +verify.completionListContains("m7", "module m7"); +verify.quickInfoIs("module m7", ""); + +goTo.marker('31'); +verify.memberListContains("m8", "module m7.m8"); +verify.quickInfoIs("module m7.m8", ""); + +goTo.marker('32'); +verify.memberListContains("m9", "module m7.m8.m9"); +verify.quickInfoIs("module m7.m8.m9", "module m9 comment"); + +goTo.marker('33'); +verify.memberListContains("c", "class m7.m8.m9.c", "Exported class comment"); +verify.quickInfoIs("(constructor) m7.m8.m9.c(): m7.m8.m9.c", ""); + +goTo.marker('34'); +verify.completionListContains("c", 'class c', ""); +verify.quickInfoIs('class c', ""); + +goTo.marker('35'); +verify.quickInfoIs("(var) myComplexVal: number", ""); + +goTo.marker('36'); +verify.quickInfoIs("module complexM", ""); + +goTo.marker('37'); +verify.quickInfoIs("module complexM.m2", ""); + +goTo.marker('38'); +verify.quickInfoIs("(constructor) complexM.m2.c(): complexM.m2.c", ""); + +goTo.marker('39'); +verify.quickInfoIs("(method) complexM.m2.c.foo2(): complexM.m1.c", ""); + +goTo.marker('40'); +verify.quickInfoIs("(method) complexM.m1.c.foo(): number", ""); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsMultiModuleMultiFile.ts b/tests/cases/fourslash/commentsMultiModuleMultiFile.ts new file mode 100644 index 00000000000..87c8abe93a2 --- /dev/null +++ b/tests/cases/fourslash/commentsMultiModuleMultiFile.ts @@ -0,0 +1,54 @@ +/// + +// @Filename: commentsMultiModuleMultiFile_0.ts +/////** this is multi declare module*/ +////module mult/*3*/iM { +//// /** class b*/ +//// export class b { +//// } +////} +/////** thi is multi module 2*/ +////module mu/*2*/ltiM { +//// /** class c comment*/ +//// export class c { +//// } +////} +//// +////new /*1*/mu/*4*/ltiM.b(); +////new mu/*5*/ltiM.c(); + +// @Filename: commentsMultiModuleMultiFile_1.ts +/////** this is multi module 3 comment*/ +////module mu/*6*/ltiM { +//// /** class d comment*/ +//// export class d { +//// } +////} +////new /*7*/mu/*8*/ltiM.d(); + +// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed +edit.insert(''); + +goTo.marker('1'); +verify.completionListContains("multiM", "module multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment"); + +goTo.marker('2'); +verify.quickInfoIs("module multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment"); + +goTo.marker('3'); +verify.quickInfoIs("module multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment"); + +goTo.marker('4'); +verify.quickInfoIs("module multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment"); + +goTo.marker('5'); +verify.quickInfoIs("module multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment"); + +goTo.marker('6'); +verify.quickInfoIs("module multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment"); + +goTo.marker('7'); +verify.completionListContains("multiM", "module multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment"); + +goTo.marker('8'); +verify.quickInfoIs("module multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment"); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsMultiModuleSingleFile.ts b/tests/cases/fourslash/commentsMultiModuleSingleFile.ts new file mode 100644 index 00000000000..29102e7eefb --- /dev/null +++ b/tests/cases/fourslash/commentsMultiModuleSingleFile.ts @@ -0,0 +1,35 @@ +/// + +/////** this is multi declare module*/ +////module mult/*3*/iM { +//// /** class b*/ +//// export class b { +//// } +////} +/////** thi is multi module 2*/ +////module mu/*2*/ltiM { +//// /** class c comment*/ +//// export class c { +//// } +////} +//// +////new /*1*/mu/*4*/ltiM.b(); +////new mu/*5*/ltiM.c(); + +// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed +edit.insert(''); + +goTo.marker('1'); +verify.completionListContains("multiM", "module multiM", "this is multi declare module\nthi is multi module 2"); + +goTo.marker('2'); +verify.quickInfoIs("module multiM", "this is multi declare module\nthi is multi module 2"); + +goTo.marker('3'); +verify.quickInfoIs("module multiM", "this is multi declare module\nthi is multi module 2"); + +goTo.marker('4'); +verify.quickInfoIs("module multiM", "this is multi declare module\nthi is multi module 2"); + +goTo.marker('5'); +verify.quickInfoIs("module multiM", "this is multi declare module\nthi is multi module 2"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/commentsOverloads.ts b/tests/cases/fourslash/commentsOverloads.ts similarity index 53% rename from tests/cases/fourslash_old/commentsOverloads.ts rename to tests/cases/fourslash/commentsOverloads.ts index 1a53adf3451..3976fdeae4a 100644 --- a/tests/cases/fourslash_old/commentsOverloads.ts +++ b/tests/cases/fourslash/commentsOverloads.ts @@ -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)", "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)", ""); 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)", "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)", ""); 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)", "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)", ""); 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)", "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)", ""); 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)", "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)", ""); 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)", ""); goTo.marker('10'); -verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "f3", "function"); +verify.quickInfoIs("(function) f3(b: string): number (+1 overload)", ""); goTo.marker('11'); -verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "f3", "function"); +verify.quickInfoIs("(function) f3(a: number): number (+1 overload)", ""); goTo.marker('12q'); -verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "f3", "function"); +verify.quickInfoIs("(function) f3(b: string): number (+1 overload)", ""); goTo.marker('o12q'); -verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "f3", "function"); +verify.quickInfoIs("(function) f3(a: number): number (+1 overload)", ""); 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)", "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)", "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)", "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)", "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)", "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)', 'this is signature 1'); +verify.completionListContains('f2', '(function) f2(a: number): number (+1 overload)', ''); +verify.completionListContains('f3', '(function) f3(a: number): number (+1 overload)', ''); +verify.completionListContains('f4', '(function) f4(a: number): number (+1 overload)', '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', '(var) i1_i: new i1(b: number) => any (+1 overload)', ''); +verify.completionListContains('i2', 'interface i2', ''); +verify.completionListContains('i2_i', '(var) i2_i: new i2(a: string) => any (+1 overload)', ''); +verify.completionListContains('i3', 'interface i3', ''); +verify.completionListContains('i3_i', '(var) i3_i: new i3(a: string) => any (+1 overload)', 'new 1'); +verify.completionListContains('i4', 'interface i4', ''); +verify.completionListContains('i4_i', '(var) i4_i: new i4(a: string) => any (+1 overload)', ''); goTo.marker('19'); verify.currentSignatureHelpDocCommentIs(""); verify.currentParameterHelpArgumentDocCommentIs(""); goTo.marker('19q'); -verify.quickInfoIs("(b: number): any (+ 1 overload(s))", "", "i1", "constructor"); +verify.quickInfoIs("(var) i1_i: new i1(b: number) => any (+1 overload)", ""); 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("(var) i1_i: new i1(a: string) => any (+1 overload)", "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("(var) i1_i: i1(a: number) => number (+1 overload)", "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("(var) i1_i: i1(b: string) => number (+1 overload)", "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)', 'foo 1'); +verify.memberListContains('foo2', '(method) i1.foo2(a: number): number (+1 overload)', ''); +verify.memberListContains('foo3', '(method) i1.foo3(a: number): number (+1 overload)', ''); +verify.memberListContains('foo4', '(method) i1.foo4(a: number): number (+1 overload)', '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)", "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)", "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)", ""); 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)", "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)", ""); 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)", ""); 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)", "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)", ""); 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("(var) i2_i: new i2(b: number) => any (+1 overload)", "new 2"); goTo.marker('33'); verify.currentSignatureHelpDocCommentIs(""); verify.currentParameterHelpArgumentDocCommentIs(""); goTo.marker('33q'); -verify.quickInfoIs("(a: string): any (+ 1 overload(s))", "", "i2", "constructor"); +verify.quickInfoIs("(var) i2_i: new i2(a: string) => any (+1 overload)", ""); goTo.marker('34'); verify.currentSignatureHelpDocCommentIs(""); verify.currentParameterHelpArgumentDocCommentIs(""); goTo.marker('34q'); -verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "i2", "function"); +verify.quickInfoIs("(var) i2_i: i2(a: number) => number (+1 overload)", ""); 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("(var) i2_i: i2(b: string) => number (+1 overload)", "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("(var) i3_i: new i3(b: number) => any (+1 overload)", "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("(var) i3_i: new i3(a: string) => any (+1 overload)", "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("(var) i3_i: i3(a: number) => number (+1 overload)", "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("(var) i3_i: i3(b: string) => number (+1 overload)", ""); goTo.marker('40'); verify.currentSignatureHelpDocCommentIs(""); verify.currentParameterHelpArgumentDocCommentIs(""); goTo.marker('40q'); -verify.quickInfoIs("(b: number): any (+ 1 overload(s))", "", "i4", "constructor"); +verify.quickInfoIs("(var) i4_i: new i4(b: number) => any (+1 overload)", ""); goTo.marker('41'); verify.currentSignatureHelpDocCommentIs(""); verify.currentParameterHelpArgumentDocCommentIs(""); goTo.marker('41q'); -verify.quickInfoIs("(a: string): any (+ 1 overload(s))", "", "i4", "constructor"); +verify.quickInfoIs("(var) i4_i: new i4(a: string) => any (+1 overload)", ""); goTo.marker('42'); verify.currentSignatureHelpDocCommentIs(""); verify.currentParameterHelpArgumentDocCommentIs(""); goTo.marker('42q'); -verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "i4", "function"); +verify.quickInfoIs("(var) i4_i: i4(a: number) => number (+1 overload)", ""); goTo.marker('43'); verify.currentSignatureHelpDocCommentIs(""); verify.currentParameterHelpArgumentDocCommentIs(""); goTo.marker('43q'); -verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "i4", "function"); +verify.quickInfoIs("(var) i4_i: i4(b: string) => number (+1 overload)", ""); 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)', ''); +verify.memberListContains('prop2', '(method) c.prop2(a: number): number (+1 overload)', 'prop2 1'); +verify.memberListContains('prop3', '(method) c.prop3(a: number): number (+1 overload)', ''); +verify.memberListContains('prop4', '(method) c.prop4(a: number): number (+1 overload)', 'prop4 1'); +verify.memberListContains('prop5', '(method) c.prop5(a: number): number (+1 overload)', '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)", ""); 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)", ""); 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)", "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)", ""); 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)", ""); 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)", "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)", "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)", "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)", "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)", "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)", ""); 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)", ""); 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)", "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)", ""); 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)", ""); 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)", "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)", "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)", "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)", "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)", "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 overloads)', 'This is multiOverload F1 1'); +verify.completionListContains('ambientF1', '(function) ambientF1(a: number): string (+2 overloads)', '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 overloads)", "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 overloads)", "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 overloads)", "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 overloads)", "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 overloads)", "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 overloads)", "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)", ""); goTo.marker('79'); -verify.quickInfoIs("(b: string): c1 (+ 1 overload(s))", "", "c1", "constructor"); +verify.quickInfoIs("(constructor) c1(b: string): c1 (+1 overload)", ""); goTo.marker('80'); -verify.quickInfoIs("(a: number): c1 (+ 1 overload(s))", "", "c1", "constructor"); +verify.quickInfoIs("(constructor) c1(a: number): c1 (+1 overload)", ""); goTo.marker('81'); -verify.quickInfoIs("(a: number): c2 (+ 1 overload(s))", "c2 1", "c2", "constructor"); +verify.quickInfoIs("(constructor) c2(a: number): c2 (+1 overload)", "c2 1"); goTo.marker('82'); -verify.quickInfoIs("(b: string): c2 (+ 1 overload(s))", "", "c2", "constructor"); +verify.quickInfoIs("(constructor) c2(b: string): c2 (+1 overload)", ""); goTo.marker('83'); -verify.quickInfoIs("(a: number): c2 (+ 1 overload(s))", "c2 1", "c2", "constructor"); +verify.quickInfoIs("(constructor) c2(a: number): c2 (+1 overload)", "c2 1"); goTo.marker('84'); -verify.quickInfoIs("(a: number): c3 (+ 1 overload(s))", "", "c3", "constructor"); +verify.quickInfoIs("(constructor) c3(a: number): c3 (+1 overload)", ""); goTo.marker('85'); -verify.quickInfoIs("(b: string): c3 (+ 1 overload(s))", "c3 2", "c3", "constructor"); +verify.quickInfoIs("(constructor) c3(b: string): c3 (+1 overload)", "c3 2"); goTo.marker('86'); -verify.quickInfoIs("(a: number): c3 (+ 1 overload(s))", "", "c3", "constructor"); +verify.quickInfoIs("(constructor) c3(a: number): c3 (+1 overload)", ""); goTo.marker('87'); -verify.quickInfoIs("(a: number): c4 (+ 1 overload(s))", "c4 1", "c4", "constructor"); +verify.quickInfoIs("(constructor) c4(a: number): c4 (+1 overload)", "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)", "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)", "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)", "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)", "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)", "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)", ""); goTo.marker('94'); -verify.quickInfoIs("(b: string): number (+ 1 overload(s))", "", "c.prop1", "method"); +verify.quickInfoIs("(method) c.prop1(b: string): number (+1 overload)", ""); goTo.marker('95'); -verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "", "c.prop1", "method"); +verify.quickInfoIs("(method) c.prop1(a: number): number (+1 overload)", ""); 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)", "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)", ""); 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)", "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)", ""); 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)", "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)", ""); 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)", "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)", "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)", "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)", "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)", "prop5 2"); goTo.marker('107'); -verify.quickInfoIs("(a: number): number (+ 1 overload(s))", "prop5 1", "c.prop5", "method"); \ No newline at end of file +verify.quickInfoIs("(method) c.prop5(a: number): number (+1 overload)", "prop5 1"); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsVariables.ts b/tests/cases/fourslash/commentsVariables.ts new file mode 100644 index 00000000000..d5ada916a98 --- /dev/null +++ b/tests/cases/fourslash/commentsVariables.ts @@ -0,0 +1,100 @@ +/// + +/////** This is my variable*/ +////var myV/*1*/ariable = 10; +/////*2*/ +/////** d variable*/ +////var d = 10; +////myVariable = d; +/////*3*/ +/////** foos comment*/ +////function foo() { +////} +/////** fooVar comment*/ +////var foo/*12*/Var: () => void; +/////*4*/ +////f/*5q*/oo(/*5*/); +////fo/*6q*/oVar(/*6*/); +////fo/*13*/oVar = f/*14*/oo; +/////*7*/ +////f/*8q*/oo(/*8*/); +////foo/*9q*/Var(/*9*/); +////var fooVarVar = /*9aq*/fooVar; +/////**class comment*/ +////class c { +//// /** constructor comment*/ +//// constructor() { +//// } +////} +/////**instance comment*/ +////var i = new c(); +/////*10*/ +/////** interface comments*/ +////interface i1 { +////} +/////**interface instance comments*/ +////var i1_i: i1; +/////*11*/ +////function foo2(a: number): void; +////function foo2(b: string): void; +////function foo2(aOrb) { +////} +////var x = fo/*15*/o2; + +goTo.marker('1'); +verify.quickInfoIs("(var) myVariable: number", "This is my variable"); + +goTo.marker('2'); +verify.completionListContains("myVariable", "(var) myVariable: number", "This is my variable"); + +goTo.marker('3'); +verify.completionListContains("myVariable", "(var) myVariable: number", "This is my variable"); +verify.completionListContains("d", "(var) d: number", "d variable"); + +goTo.marker('4'); +verify.completionListContains("foo", "(function) foo(): void", "foos comment"); +verify.completionListContains("fooVar", "(var) fooVar: () => void", "fooVar comment"); + +goTo.marker('5'); +verify.currentSignatureHelpDocCommentIs("foos comment"); +goTo.marker('5q'); +verify.quickInfoIs("(function) foo(): void", "foos comment"); + +goTo.marker('6'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('6q'); +verify.quickInfoIs("(var) fooVar: () => void", ""); + +goTo.marker('7'); +verify.completionListContains("foo", "(function) foo(): void", "foos comment"); +verify.completionListContains("fooVar", "(var) fooVar: () => void", "fooVar comment"); + +goTo.marker('8'); +verify.currentSignatureHelpDocCommentIs("foos comment"); +goTo.marker('8q'); +verify.quickInfoIs("(function) foo(): void", "foos comment"); + +goTo.marker('9'); +verify.currentSignatureHelpDocCommentIs(""); +goTo.marker('9q'); +verify.quickInfoIs("(var) fooVar: () => void", ""); +goTo.marker('9aq'); +verify.quickInfoIs("(var) fooVar: () => void", "fooVar comment"); + +goTo.marker('10'); +verify.completionListContains("i", "(var) i: c", "instance comment"); + +goTo.marker('11'); +verify.completionListContains("i1_i", "(var) i1_i: i1", "interface instance comments"); + +goTo.marker('12'); +verify.quickInfoIs("(var) fooVar: () => void", "fooVar comment"); + +goTo.marker('13'); +verify.quickInfoIs("(var) fooVar: () => void", "fooVar comment"); + +goTo.marker('14'); +verify.quickInfoIs("(function) foo(): void", "foos comment"); + +goTo.marker('15'); +verify.quickInfoIs("(function) foo2(a: number): void (+1 overload)", ""); \ No newline at end of file diff --git a/tests/cases/fourslash_old/completionBeforeSemanticDiagnosticsInArrowFunction1.ts b/tests/cases/fourslash/completionBeforeSemanticDiagnosticsInArrowFunction1.ts similarity index 86% rename from tests/cases/fourslash_old/completionBeforeSemanticDiagnosticsInArrowFunction1.ts rename to tests/cases/fourslash/completionBeforeSemanticDiagnosticsInArrowFunction1.ts index c3be71257f5..bc0aa713880 100644 --- a/tests/cases/fourslash_old/completionBeforeSemanticDiagnosticsInArrowFunction1.ts +++ b/tests/cases/fourslash/completionBeforeSemanticDiagnosticsInArrowFunction1.ts @@ -15,7 +15,7 @@ fs.edit.insert("A"); // Bring up completion to force a pull resolve. This will end up resolving several symbols and // producing unreported diagnostics (i.e. that 'V' wasn't found). fs.verify.completionListContains("T"); -fs.verify.completionEntryDetailIs("T", "T"); +fs.verify.completionEntryDetailIs("T", "(type parameter) T in (x: any): void"); // There should now be a single error. fs.verify.numberOfErrorsInCurrentFile(1); \ No newline at end of file diff --git a/tests/cases/fourslash/completionEntryForPrimitive.ts b/tests/cases/fourslash/completionEntryForPrimitive.ts index 9b800c7b7e2..c749379c862 100644 --- a/tests/cases/fourslash/completionEntryForPrimitive.ts +++ b/tests/cases/fourslash/completionEntryForPrimitive.ts @@ -6,4 +6,4 @@ diagnostics.setEditValidation(IncrementalEditValidation.None); goTo.marker(); verify.not.completionListIsEmpty(); edit.insert("nu"); -verify.completionListContains("number", undefined, undefined, undefined, "keyword"); \ No newline at end of file +verify.completionListContains("number", undefined, undefined, "keyword"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListForDerivedType1.ts b/tests/cases/fourslash/completionListForDerivedType1.ts index 0c514713c21..0d771441dae 100644 --- a/tests/cases/fourslash/completionListForDerivedType1.ts +++ b/tests/cases/fourslash/completionListForDerivedType1.ts @@ -12,10 +12,10 @@ ////f2./*2*/ // here bar has return type any, but bar2 is Foo2 goTo.marker('1'); -verify.completionListContains('bar', '() => IFoo'); +verify.completionListContains('bar', '(method) IFoo.bar(): IFoo'); verify.not.completionListContains('bar2'); edit.insert('bar();'); // just to make the file valid before checking next completion location goTo.marker('2'); -verify.completionListContains('bar', '() => IFoo'); -verify.completionListContains('bar2', '() => IFoo2'); \ No newline at end of file +verify.completionListContains('bar', '(method) IFoo.bar(): IFoo'); +verify.completionListContains('bar2', '(method) IFoo2.bar2(): IFoo2'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListForGenericInstance1.ts b/tests/cases/fourslash/completionListForGenericInstance1.ts index a0f19f07412..9a3fcab631d 100644 --- a/tests/cases/fourslash/completionListForGenericInstance1.ts +++ b/tests/cases/fourslash/completionListForGenericInstance1.ts @@ -7,4 +7,4 @@ ////i/**/ goTo.marker(); -verify.completionListContains('i', 'Iterator', '', 'i'); \ No newline at end of file +verify.completionListContains('i', '(var) i: Iterator'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListFunctionMembers.ts b/tests/cases/fourslash/completionListFunctionMembers.ts index 61eb2d1d649..6f4e2bf6069 100644 --- a/tests/cases/fourslash/completionListFunctionMembers.ts +++ b/tests/cases/fourslash/completionListFunctionMembers.ts @@ -8,4 +8,4 @@ ////fnc1./**/ goTo.marker(); -verify.memberListContains('arguments', 'any'); \ No newline at end of file +verify.memberListContains('arguments', '(property) Function.arguments: any'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListInNamedFunctionExpression.ts b/tests/cases/fourslash/completionListInNamedFunctionExpression.ts index a4dd328e1ed..6321018f5b5 100644 --- a/tests/cases/fourslash/completionListInNamedFunctionExpression.ts +++ b/tests/cases/fourslash/completionListInNamedFunctionExpression.ts @@ -24,9 +24,7 @@ goTo.marker("insideFunctionExpression"); verify.memberListContains("foo"); goTo.marker("referenceInsideFunctionExpression"); -verify.quickInfoIs("() => number"); +verify.quickInfoIs("(local function) foo(): number"); goTo.marker("referenceInGlobalScope"); -verify.quickInfoIs("(a: number) => string"); - - +verify.quickInfoIs("(function) foo(a: number): string"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListInObjectLiteralThatIsParameterOfFunctionCall.ts b/tests/cases/fourslash/completionListInObjectLiteralThatIsParameterOfFunctionCall.ts new file mode 100644 index 00000000000..9dcf7456226 --- /dev/null +++ b/tests/cases/fourslash/completionListInObjectLiteralThatIsParameterOfFunctionCall.ts @@ -0,0 +1,11 @@ +/// + +////function f(a: { xa: number; xb: number; }) { } +////var xc; +////f({ +//// /**/ + +goTo.marker() +verify.memberListContains('xa'); +verify.memberListContains('xb'); +verify.memberListCount(2); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListInsideTargetTypedFunction.ts b/tests/cases/fourslash/completionListInsideTargetTypedFunction.ts index 12e11c12f54..68d7f3081f7 100644 --- a/tests/cases/fourslash/completionListInsideTargetTypedFunction.ts +++ b/tests/cases/fourslash/completionListInsideTargetTypedFunction.ts @@ -6,4 +6,4 @@ ////} goTo.marker(); -verify.completionListContains("elem", "string"); \ No newline at end of file +verify.completionListContains("elem", "(parameter) elem: string"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListObjectMembers.ts b/tests/cases/fourslash/completionListObjectMembers.ts index c23eff12dbc..cbddba61be5 100644 --- a/tests/cases/fourslash/completionListObjectMembers.ts +++ b/tests/cases/fourslash/completionListObjectMembers.ts @@ -10,5 +10,5 @@ ////object./**/ goTo.marker(); -verify.memberListContains("bar", 'any'); -verify.memberListContains("foo", '(bar: any) => any'); +verify.memberListContains("bar", '(property) bar: any'); +verify.memberListContains("foo", '(method) foo(bar: any): any'); diff --git a/tests/cases/fourslash/completionListOfGnericSymbol.ts b/tests/cases/fourslash/completionListOfGnericSymbol.ts index fd223b68ca2..936eeeff714 100644 --- a/tests/cases/fourslash/completionListOfGnericSymbol.ts +++ b/tests/cases/fourslash/completionListOfGnericSymbol.ts @@ -6,6 +6,6 @@ ////a./**/ goTo.marker(); -verify.memberListContains('length', "number", /*docComments*/ undefined, /*fullSymbolName*/ undefined,/*kind*/ "property"); -verify.memberListContains('toString', "() => string", /*docComments*/ undefined, /*fullSymbolName*/ undefined,/*kind*/ "method"); +verify.memberListContains('length', "(property) Array.length: number", /*docComments*/ undefined, /*kind*/ "property"); +verify.memberListContains('toString', "(method) Array.toString(): string", /*docComments*/ undefined, /*kind*/ "method"); diff --git a/tests/cases/fourslash/completionListOnAliases.ts b/tests/cases/fourslash/completionListOnAliases.ts index 785a65a76bd..68c25d3608e 100644 --- a/tests/cases/fourslash/completionListOnAliases.ts +++ b/tests/cases/fourslash/completionListOnAliases.ts @@ -9,7 +9,7 @@ ////} goTo.marker("1"); -verify.memberListContains("x", undefined, undefined, undefined ,/*kind: */ "alias"); +verify.memberListContains("x", "(alias) x", undefined); goTo.marker("2"); verify.memberListContains("value"); diff --git a/tests/cases/fourslash/completionListOnPrivateVariableInModule.ts b/tests/cases/fourslash/completionListOnPrivateVariableInModule.ts index 5bb5836517e..8eeee08767b 100644 --- a/tests/cases/fourslash/completionListOnPrivateVariableInModule.ts +++ b/tests/cases/fourslash/completionListOnPrivateVariableInModule.ts @@ -3,4 +3,4 @@ //// module Foo { var testing = ""; test/**/ } goTo.marker(); -verify.completionListContains('testing', 'string'); \ No newline at end of file +verify.completionListContains('testing', '(var) testing: string'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/completionListWithModulesFromModule.ts b/tests/cases/fourslash/completionListWithModulesFromModule.ts similarity index 88% rename from tests/cases/fourslash_old/completionListWithModulesFromModule.ts rename to tests/cases/fourslash/completionListWithModulesFromModule.ts index 34ec7d54fd5..a8d99a47853 100644 --- a/tests/cases/fourslash_old/completionListWithModulesFromModule.ts +++ b/tests/cases/fourslash/completionListWithModulesFromModule.ts @@ -261,15 +261,8 @@ function sharedNegativeVerify() verify.not.completionListContains('mod2eexvar'); } -function goToMarkAndVerifyShadow(marker: string) +function goToMarkAndVerifyShadow() { - goTo.marker(marker); - - verify.completionListContains('shwvar', 'string'); - verify.completionListContains('shwfn', '(shadow: any): void'); - verify.completionListContains('shwcls', 'shwcls'); - verify.completionListContains('shwint', 'shwint'); - sharedNegativeVerify(); verify.not.completionListContains('mod2var'); verify.not.completionListContains('mod2fn'); @@ -284,20 +277,30 @@ function goToMarkAndVerifyShadow(marker: string) } // from a shadow module with no export -goToMarkAndVerifyShadow('shadowModuleWithNoExport'); +goTo.marker('shadowModuleWithNoExport'); +verify.completionListContains('shwvar', '(var) shwvar: string'); +verify.completionListContains('shwfn', '(function) shwfn(shadow: any): void'); +verify.completionListContains('shwcls', 'class shwcls'); +verify.completionListContains('shwint', 'interface shwint'); +goToMarkAndVerifyShadow(); // from a shadow module with export -goToMarkAndVerifyShadow('shadowModuleWithExport'); +goTo.marker('shadowModuleWithExport'); +verify.completionListContains('shwvar', '(var) mod4.shwvar: string'); +verify.completionListContains('shwfn', '(function) mod4.shwfn(shadow: any): void'); +verify.completionListContains('shwcls', 'class mod4.shwcls'); +verify.completionListContains('shwint', 'interface mod4.shwint'); +goToMarkAndVerifyShadow(); // from a modlue with import goTo.marker('moduleWithImport'); -verify.completionListContains('mod1', 'mod1'); -verify.completionListContains('mod2', 'mod2'); -verify.completionListContains('mod3', 'mod3'); -verify.completionListContains('shwvar', 'number'); -verify.completionListContains('shwfn', '(): void'); -verify.completionListContains('shwcls', 'shwcls'); -verify.completionListContains('shwint', 'shwint'); +verify.completionListContains('mod1', 'module mod1'); +verify.completionListContains('mod2', 'module mod2'); +verify.completionListContains('mod3', 'module mod3'); +verify.completionListContains('shwvar', '(var) shwvar: number'); +verify.completionListContains('shwfn', '(function) shwfn(): void'); +verify.completionListContains('shwcls', 'class shwcls'); +verify.completionListContains('shwint', 'interface shwint'); sharedNegativeVerify(); diff --git a/tests/cases/fourslash_old/completionListWithModulesInsideModuleScope.ts b/tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts similarity index 71% rename from tests/cases/fourslash_old/completionListWithModulesInsideModuleScope.ts rename to tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts index ea5d9076426..920ba030264 100644 --- a/tests/cases/fourslash_old/completionListWithModulesInsideModuleScope.ts +++ b/tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts @@ -229,23 +229,23 @@ function goToMarkAndGeneralVerify(marker: string) { goTo.marker(marker); - verify.completionListContains('mod1var', 'number'); - verify.completionListContains('mod1fn', '(): void'); - verify.completionListContains('mod1cls', 'mod1cls'); - verify.completionListContains('mod1int', 'mod1int'); - verify.completionListContains('mod1mod', 'mod1mod'); - verify.completionListContains('mod1evar', 'number'); - verify.completionListContains('mod1efn', '(): void'); - verify.completionListContains('mod1ecls', 'mod1ecls'); - verify.completionListContains('mod1eint', 'mod1eint'); - verify.completionListContains('mod1emod', 'mod1emod'); - verify.completionListContains('mod1eexvar', 'number'); - verify.completionListContains('mod2', 'mod2'); - verify.completionListContains('mod3', 'mod3'); - verify.completionListContains('shwvar', 'number'); - verify.completionListContains('shwfn', '(): void'); - verify.completionListContains('shwcls', 'shwcls'); - verify.completionListContains('shwint', 'shwint'); + verify.completionListContains('mod1var', '(var) mod1var: number'); + verify.completionListContains('mod1fn', '(function) mod1fn(): void'); + verify.completionListContains('mod1cls', 'class mod1cls'); + verify.completionListContains('mod1int', 'interface mod1int'); + verify.completionListContains('mod1mod', 'module mod1mod'); + verify.completionListContains('mod1evar', '(var) mod1.mod1evar: number'); + verify.completionListContains('mod1efn', '(function) mod1.mod1efn(): void'); + verify.completionListContains('mod1ecls', 'class mod1.mod1ecls'); + verify.completionListContains('mod1eint', 'interface mod1.mod1eint'); + verify.completionListContains('mod1emod', 'module mod1.mod1emod'); + verify.completionListContains('mod1eexvar', '(var) mod1.mod1eexvar: number'); + verify.completionListContains('mod2', 'module mod2'); + verify.completionListContains('mod3', 'module mod3'); + verify.completionListContains('shwvar', '(var) shwvar: number'); + verify.completionListContains('shwfn', '(function) shwfn(): void'); + verify.completionListContains('shwcls', 'class shwcls'); + verify.completionListContains('shwint', 'interface shwint'); verify.not.completionListContains('mod2var'); verify.not.completionListContains('mod2fn'); @@ -276,8 +276,8 @@ goToMarkAndGeneralVerify('mod1'); // from function in mod1 goToMarkAndGeneralVerify('function'); -verify.completionListContains('bar', 'number'); -verify.completionListContains('foob', '(): void'); +verify.completionListContains('bar', '(local var) bar: number'); +verify.completionListContains('foob', '(local function) foob(): void'); // from class in mod1 goToMarkAndGeneralVerify('class'); @@ -289,21 +289,21 @@ goToMarkAndGeneralVerify('interface'); // from module in mod1 goToMarkAndGeneralVerify('module'); -verify.completionListContains('m1X', 'number'); -verify.completionListContains('m1Func', '(): void'); -verify.completionListContains('m1Class', 'm1Class'); -verify.completionListContains('m1Int', 'm1Int'); -verify.completionListContains('m1Mod', 'm1Mod'); -verify.completionListContains('m1eX', 'number'); -verify.completionListContains('m1eFunc', '(): void'); -verify.completionListContains('m1eClass', 'm1eClass'); -verify.completionListContains('m1eInt', 'm1eInt'); -verify.completionListContains('m1eMod', 'm1eMod'); +verify.completionListContains('m1X', '(var) m1X: number'); +verify.completionListContains('m1Func', '(function) m1Func(): void'); +verify.completionListContains('m1Class', 'class m1Class'); +verify.completionListContains('m1Int', 'interface m1Int'); +verify.completionListContains('m1Mod', 'module m1Mod'); +verify.completionListContains('m1eX', '(var) mod1mod.m1eX: number'); +verify.completionListContains('m1eFunc', '(function) mod1mod.m1eFunc(): void'); +verify.completionListContains('m1eClass', 'class mod1mod.m1eClass'); +verify.completionListContains('m1eInt', 'interface mod1mod.m1eInt'); +verify.completionListContains('m1eMod', 'module mod1mod.m1eMod'); // from exported function in mod1 goToMarkAndGeneralVerify('exportedFunction'); -verify.completionListContains('bar', 'number'); -verify.completionListContains('foob', '(): void'); +verify.completionListContains('bar', '(local var) bar: number'); +verify.completionListContains('foob', '(local function) foob(): void'); // from exported class in mod1 goToMarkAndGeneralVerify('exportedClass'); @@ -315,31 +315,31 @@ goToMarkAndGeneralVerify('exportedInterface'); // from exported module in mod1 goToMarkAndGeneralVerify('exportedModule'); -verify.completionListContains('mX', 'number'); -verify.completionListContains('mFunc', '(): void'); -verify.completionListContains('mClass', 'mClass'); -verify.completionListContains('mInt', 'mInt'); -verify.completionListContains('mMod', 'mMod'); -verify.completionListContains('meX', 'number'); -verify.completionListContains('meFunc', '(): void'); -verify.completionListContains('meClass', 'meClass'); -verify.completionListContains('meInt', 'meInt'); -verify.completionListContains('meMod', 'meMod'); +verify.completionListContains('mX', '(var) mX: number'); +verify.completionListContains('mFunc', '(function) mFunc(): void'); +verify.completionListContains('mClass', 'class mClass'); +verify.completionListContains('mInt', 'interface mInt'); +verify.completionListContains('mMod', 'module mMod'); +verify.completionListContains('meX', '(var) mod1.mod1emod.meX: number'); +verify.completionListContains('meFunc', '(function) mod1.mod1emod.meFunc(): void'); +verify.completionListContains('meClass', 'class mod1.mod1emod.meClass'); +verify.completionListContains('meInt', 'interface mod1.mod1emod.meInt'); +verify.completionListContains('meMod', 'module mod1.mod1emod.meMod'); // from extended module goTo.marker('extendedModule'); -verify.completionListContains('mod1evar', 'number'); -verify.completionListContains('mod1efn', '(): void'); -verify.completionListContains('mod1ecls', 'mod1ecls'); -verify.completionListContains('mod1eint', 'mod1eint'); -verify.completionListContains('mod1emod', 'mod1emod'); -verify.completionListContains('mod1eexvar', 'number'); -verify.completionListContains('mod2', 'mod2'); -verify.completionListContains('mod3', 'mod3'); -verify.completionListContains('shwvar', 'number'); -verify.completionListContains('shwfn', '(): void'); -verify.completionListContains('shwcls', 'shwcls'); -verify.completionListContains('shwint', 'shwint'); +verify.completionListContains('mod1evar', '(var) mod1.mod1evar: number'); +verify.completionListContains('mod1efn', '(function) mod1.mod1efn(): void'); +verify.completionListContains('mod1ecls', 'class mod1.mod1ecls'); +verify.completionListContains('mod1eint', 'interface mod1.mod1eint'); +verify.completionListContains('mod1emod', 'module mod1.mod1emod'); +verify.completionListContains('mod1eexvar', '(var) mod1.mod1eexvar: number'); +verify.completionListContains('mod2', 'module mod2'); +verify.completionListContains('mod3', 'module mod3'); +verify.completionListContains('shwvar', '(var) shwvar: number'); +verify.completionListContains('shwfn', '(function) shwfn(): void'); +verify.completionListContains('shwcls', 'class shwcls'); +verify.completionListContains('shwint', 'interface shwint'); verify.not.completionListContains('mod2var'); verify.not.completionListContains('mod2fn'); diff --git a/tests/cases/fourslash_old/completionListWithModulesOutsideModuleScope.ts b/tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts similarity index 93% rename from tests/cases/fourslash_old/completionListWithModulesOutsideModuleScope.ts rename to tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts index fd192021757..43314b45d7f 100644 --- a/tests/cases/fourslash_old/completionListWithModulesOutsideModuleScope.ts +++ b/tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts @@ -260,13 +260,13 @@ function goToMarkAndGeneralVerify(marker: string) // from global scope goToMarkAndGeneralVerify('global'); -verify.completionListContains('mod1', 'mod1'); -verify.completionListContains('mod2', 'mod2'); -verify.completionListContains('mod3', 'mod3'); -verify.completionListContains('shwvar', 'number'); -verify.completionListContains('shwfn', '(): void'); -verify.completionListContains('shwcls', 'shwcls'); -verify.completionListContains('shwint', 'shwint'); +verify.completionListContains('mod1', 'module mod1'); +verify.completionListContains('mod2', 'module mod2'); +verify.completionListContains('mod3', 'module mod3'); +verify.completionListContains('shwvar', '(var) shwvar: number'); +verify.completionListContains('shwfn', '(function) shwfn(): void'); +verify.completionListContains('shwcls', 'class shwcls'); +verify.completionListContains('shwint', 'interface shwint'); verifyNotContainFunctionMembers(); verifyNotContainClassMembers(); @@ -274,8 +274,8 @@ verifyNotContainInterfaceMembers(); // from function scope goToMarkAndGeneralVerify('function'); -verify.completionListContains('sfvar', 'number'); -verify.completionListContains('sffn', '(): void'); +verify.completionListContains('sfvar', '(local var) sfvar: number'); +verify.completionListContains('sffn', '(local function) sffn(): void'); verifyNotContainClassMembers(); verifyNotContainInterfaceMembers(); diff --git a/tests/cases/fourslash_old/completionListWithModulesOutsideModuleScope2.ts b/tests/cases/fourslash/completionListWithModulesOutsideModuleScope2.ts similarity index 95% rename from tests/cases/fourslash_old/completionListWithModulesOutsideModuleScope2.ts rename to tests/cases/fourslash/completionListWithModulesOutsideModuleScope2.ts index 92e07419e1c..04bf7bf26d5 100644 --- a/tests/cases/fourslash_old/completionListWithModulesOutsideModuleScope2.ts +++ b/tests/cases/fourslash/completionListWithModulesOutsideModuleScope2.ts @@ -238,10 +238,10 @@ function goToMarkerAndVerify(marker: string) verify.completionListContains('mod1'); verify.completionListContains('mod2'); verify.completionListContains('mod3'); - verify.completionListContains('shwvar', 'number'); - verify.completionListContains('shwfn', '(): void'); - verify.completionListContains('shwcls', 'shwcls'); - verify.completionListContains('shwint', 'shwint'); + verify.completionListContains('shwvar', '(var) shwvar: number'); + verify.completionListContains('shwfn', '(function) shwfn(): void'); + verify.completionListContains('shwcls', 'class shwcls'); + verify.completionListContains('shwint', 'interface shwint'); verify.not.completionListContains('mod2var'); verify.not.completionListContains('mod2fn'); @@ -272,4 +272,4 @@ goToMarkerAndVerify('extendedClass'); goToMarkerAndVerify('objectLiteral'); goTo.marker('localVar'); -verify.completionListContains('shwvar', 'string'); \ No newline at end of file +verify.completionListContains('shwvar', '(local var) shwvar: string'); \ No newline at end of file diff --git a/tests/cases/fourslash/constructorQuickInfo.ts b/tests/cases/fourslash/constructorQuickInfo.ts index bdca5734878..6c9fc7cf795 100644 --- a/tests/cases/fourslash/constructorQuickInfo.ts +++ b/tests/cases/fourslash/constructorQuickInfo.ts @@ -7,10 +7,10 @@ ////var x/*3*/3 = new SS; goTo.marker('1'); -verify.quickInfoIs('SS'); +verify.quickInfoIs('(var) x1: SS'); goTo.marker('2'); -verify.quickInfoIs('SS<{}>'); +verify.quickInfoIs('(var) x2: SS<{}>'); goTo.marker('3'); -verify.quickInfoIs('SS<{}>'); \ No newline at end of file +verify.quickInfoIs('(var) x3: SS<{}>'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/contextualTyping.ts b/tests/cases/fourslash/contextualTyping.ts similarity index 59% rename from tests/cases/fourslash_old/contextualTyping.ts rename to tests/cases/fourslash/contextualTyping.ts index be3ec710952..dad6ee8b587 100644 --- a/tests/cases/fourslash_old/contextualTyping.ts +++ b/tests/cases/fourslash/contextualTyping.ts @@ -198,222 +198,222 @@ edit.insert(''); goTo.marker('1'); -verify.quickInfoIs("(i: number, s: string) => number"); +verify.quickInfoIs("(property) C1T5.foo: (i: number, s: string) => number"); goTo.marker('2'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) i: number"); goTo.marker('3'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) i: number"); goTo.marker('4'); -verify.quickInfoIs("(i: number, s: string) => number"); +verify.quickInfoIs("(var) C2T5.foo: (i: number, s: string) => number"); goTo.marker('5'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) i: number"); goTo.marker('6'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) i: number"); goTo.marker('7'); -verify.quickInfoIs("(s: string) => string"); +verify.quickInfoIs("(var) c3t1: (s: string) => string"); goTo.marker('8'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) s: any"); goTo.marker('9'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) s: any"); goTo.marker('10'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(var) c3t2: IFoo"); goTo.marker('11'); -verify.quickInfoIs("number[]"); +verify.quickInfoIs("(var) c3t3: number[]"); goTo.marker('12'); -verify.quickInfoIs("() => IFoo"); +verify.quickInfoIs("(var) c3t4: () => IFoo"); goTo.marker('13'); -verify.quickInfoIs("(n: number) => IFoo"); +verify.quickInfoIs("(var) c3t5: (n: number) => IFoo"); goTo.marker('14'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('15'); -verify.quickInfoIs("(n: number, s: string) => IFoo"); +verify.quickInfoIs("(var) c3t6: (n: number, s: string) => IFoo"); goTo.marker('16'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('17'); -verify.quickInfoIs("string"); +verify.quickInfoIs("(parameter) s: string"); goTo.marker('18'); -verify.quickInfoIs("(n: number): number (+ 1 overload(s))"); +verify.quickInfoIs("(var) c3t7: {\n (n: number): number;\n (s1: string): number;\n}"); goTo.marker('20'); -verify.quickInfoIs("(n: number, s: string) => number"); +verify.quickInfoIs("(var) c3t8: (n: number, s: string) => number"); goTo.marker('21'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('22'); -verify.quickInfoIs("number[][]"); +verify.quickInfoIs("(var) c3t9: number[][]"); goTo.marker('23'); -verify.quickInfoIs("IFoo[]"); +verify.quickInfoIs("(var) c3t10: IFoo[]"); goTo.marker('24'); -verify.quickInfoIs("{ (n: number, s: string): string; }[]"); +verify.quickInfoIs("(var) c3t11: {\n (n: number, s: string): string;\n}[]"); goTo.marker('25'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('26'); -verify.quickInfoIs("string"); +verify.quickInfoIs("(parameter) s: string"); goTo.marker('27'); -verify.quickInfoIs("IBar"); +verify.quickInfoIs("(var) c3t12: IBar"); goTo.marker('28'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(property) foo: IFoo"); goTo.marker('29'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(var) c3t13: IFoo"); goTo.marker('30'); -verify.quickInfoIs("(i: any, s: any) => any"); +verify.quickInfoIs("(property) f: (i: any, s: any) => any"); goTo.marker('31'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) i: any"); goTo.marker('32'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) s: any"); goTo.marker('33'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(var) c3t14: IFoo"); goTo.marker('34'); -verify.quickInfoIs("any[]"); +verify.quickInfoIs("(property) a: undefined[]"); goTo.marker('35'); -verify.quickInfoIs("(i: number, s: string) => string"); +verify.quickInfoIs("(property) C4T5.foo: (i: number, s: string) => string"); goTo.marker('36'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) i: number"); goTo.marker('37'); -verify.quickInfoIs("string"); +verify.quickInfoIs("(parameter) s: string"); goTo.marker('38'); -verify.quickInfoIs("(i: number, s: string) => string"); +verify.quickInfoIs("(var) C5T5.foo: (i: number, s: string) => string"); goTo.marker('39'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) i: number"); goTo.marker('40'); -verify.quickInfoIs("string"); +verify.quickInfoIs("(parameter) s: string"); goTo.marker('41'); -verify.quickInfoIs("(n: number) => IFoo"); +verify.quickInfoIs("(var) c6t5: (n: number) => IFoo"); goTo.marker('42'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('43'); -verify.quickInfoIs("IFoo[]"); +verify.quickInfoIs("(var) c7t2: IFoo[]"); goTo.marker('44'); -verify.quickInfoIs("IFoo[]"); +verify.quickInfoIs("(var) c7t2: IFoo[]"); goTo.marker('45'); -verify.quickInfoIs("(s: string) => string"); +verify.quickInfoIs("(property) t1: (s: string) => string"); goTo.marker('46'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) s: any"); goTo.marker('47'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(property) t2: IFoo"); goTo.marker('48'); -verify.quickInfoIs("number[]"); +verify.quickInfoIs("(property) t3: number[]"); goTo.marker('49'); -verify.quickInfoIs("() => IFoo"); +verify.quickInfoIs("(property) t4: () => IFoo"); goTo.marker('50'); -verify.quickInfoIs("(n: number) => IFoo"); +verify.quickInfoIs("(property) t5: (n: number) => IFoo"); goTo.marker('51'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('52'); -verify.quickInfoIs("(n: number, s: string) => IFoo"); +verify.quickInfoIs("(property) t6: (n: number, s: string) => IFoo"); goTo.marker('53'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('54'); -verify.quickInfoIs("string"); +verify.quickInfoIs("(parameter) s: string"); goTo.marker('55'); -verify.quickInfoIs("(n: number, s: string) => number"); +verify.quickInfoIs("(property) t7: (n: number, s: string) => number"); goTo.marker('56'); -verify.quickInfoIs("(n: number, s: string) => number"); +verify.quickInfoIs("(property) t8: (n: number, s: string) => number"); goTo.marker('57'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('58'); -verify.quickInfoIs("number[][]"); +verify.quickInfoIs("(property) t9: number[][]"); goTo.marker('59'); -verify.quickInfoIs("IFoo[]"); +verify.quickInfoIs("(property) t10: IFoo[]"); goTo.marker('60'); -verify.quickInfoIs("{ (n: number, s: string): string; }[]"); +verify.quickInfoIs("(property) t11: {\n (n: number, s: string): string;\n}[]"); goTo.marker('61'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('62'); -verify.quickInfoIs("string"); +verify.quickInfoIs("(parameter) s: string"); goTo.marker('63'); -verify.quickInfoIs("IBar"); +verify.quickInfoIs("(property) t12: IBar"); goTo.marker('64'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(property) foo: IFoo"); goTo.marker('65'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(property) t13: IFoo"); goTo.marker('66'); -verify.quickInfoIs("(i: any, s: any) => any"); +verify.quickInfoIs("(property) f: (i: any, s: any) => any"); goTo.marker('67'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) i: any"); goTo.marker('68'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) s: any"); goTo.marker('69'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(property) t14: IFoo"); goTo.marker('70'); -verify.quickInfoIs("any[]"); +verify.quickInfoIs("(property) a: undefined[]"); goTo.marker('71'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('72'); -verify.quickInfoIs("() => (n: number) => IFoo"); +verify.quickInfoIs("(var) c10t5: () => (n: number) => IFoo"); goTo.marker('73'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('74'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('75'); -verify.quickInfoIs("(s: string) => string"); +verify.quickInfoIs("(var) c12t1: (s: string) => string"); goTo.marker('76'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) s: any"); goTo.marker('77'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(var) c12t2: IFoo"); goTo.marker('78'); -verify.quickInfoIs("number[]"); +verify.quickInfoIs("(var) c12t3: number[]"); goTo.marker('79'); -verify.quickInfoIs("() => IFoo"); +verify.quickInfoIs("(var) c12t4: () => IFoo"); goTo.marker('80'); -verify.quickInfoIs("(n: number) => IFoo"); +verify.quickInfoIs("(var) c12t5: (n: number) => IFoo"); goTo.marker('81'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('82'); -verify.quickInfoIs("(n: number, s: string) => IFoo"); +verify.quickInfoIs("(var) c12t6: (n: number, s: string) => IFoo"); goTo.marker('83'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('84'); -verify.quickInfoIs("string"); +verify.quickInfoIs("(parameter) s: string"); goTo.marker('85'); -verify.quickInfoIs("(n: number, s: string) => number"); +verify.quickInfoIs("(var) c12t7: (n: number, s: string) => number"); goTo.marker('86'); -verify.quickInfoIs("(n: number, s: string) => number"); +verify.quickInfoIs("(var) c12t8: (n: number, s: string) => number"); goTo.marker('87'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('88'); -verify.quickInfoIs("number[][]"); +verify.quickInfoIs("(var) c12t9: number[][]"); goTo.marker('89'); -verify.quickInfoIs("IFoo[]"); +verify.quickInfoIs("(var) c12t10: IFoo[]"); goTo.marker('90'); -verify.quickInfoIs("{ (n: number, s: string): string; }[]"); +verify.quickInfoIs("(var) c12t11: {\n (n: number, s: string): string;\n}[]"); goTo.marker('91'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) n: number"); goTo.marker('92'); -verify.quickInfoIs("string"); +verify.quickInfoIs("(parameter) s: string"); goTo.marker('93'); -verify.quickInfoIs("IBar"); +verify.quickInfoIs("(var) c12t12: IBar"); goTo.marker('94'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(property) foo: IFoo"); goTo.marker('95'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(var) c12t13: IFoo"); goTo.marker('96'); -verify.quickInfoIs("(i: any, s: any) => any"); +verify.quickInfoIs("(property) f: (i: any, s: any) => any"); goTo.marker('97'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) i: any"); goTo.marker('98'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) s: any"); goTo.marker('99'); -verify.quickInfoIs("IFoo"); +verify.quickInfoIs("(var) c12t14: IFoo"); goTo.marker('100'); -verify.quickInfoIs("any[]"); +verify.quickInfoIs("(property) a: undefined[]"); goTo.marker('101'); -verify.quickInfoIs("(a: number, b: number): number (+ 0 overload(s))"); +verify.quickInfoIs("(function) EF1(a: number, b: number): number"); goTo.marker('102'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) a: any"); goTo.marker('103'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(parameter) b: any"); goTo.marker('110'); -verify.quickInfoIs("Point"); +verify.quickInfoIs("(property) Point.origin: Point"); goTo.marker('111'); -verify.quickInfoIs("(x: number, y: number): Point"); +verify.quickInfoIs("(constructor) Point(x: number, y: number): Point"); goTo.marker('112'); -verify.quickInfoIs("(dx: number, dy: number): Point"); +verify.quickInfoIs("(method) Point.add(dx: number, dy: number): Point"); goTo.marker('113'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) dx: number"); goTo.marker('114'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) dy: number"); goTo.marker('115'); -verify.quickInfoIs("(dx: number, dy: number) => Point"); +verify.quickInfoIs("(property) add: (dx: number, dy: number) => Point"); goTo.marker('116'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) dx: number"); goTo.marker('117'); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) dy: number"); diff --git a/tests/cases/fourslash/contextualTypingFromTypeAssertion1.ts b/tests/cases/fourslash/contextualTypingFromTypeAssertion1.ts new file mode 100644 index 00000000000..3167b847b18 --- /dev/null +++ b/tests/cases/fourslash/contextualTypingFromTypeAssertion1.ts @@ -0,0 +1,7 @@ +/// + +////var f3 = <(x: string) => string> function (/**/x) { return x.toLowerCase(); }; + +goTo.marker(); +verify.quickInfoIs('(parameter) x: string'); + diff --git a/tests/cases/fourslash/contextualTypingGenericFunction1.ts b/tests/cases/fourslash/contextualTypingGenericFunction1.ts new file mode 100644 index 00000000000..c7e409820d4 --- /dev/null +++ b/tests/cases/fourslash/contextualTypingGenericFunction1.ts @@ -0,0 +1,20 @@ +/// + +// should not contextually type the RHS because it introduces type parameters +////var obj: { f(x: T): T } = { f: (/*1*/x) => x }; +////var obj2: (x: T) => T = (/*2*/x) => x; +//// +////class C { +//// obj: (x: T) => T +////} +////var c = new C(); +////c.obj = (/*3*/x) => x; + +goTo.marker('1'); +verify.quickInfoIs('(parameter) x: any'); + +goTo.marker('2'); +verify.quickInfoIs('(parameter) x: any'); + +goTo.marker('3'); +verify.quickInfoIs('(parameter) x: any'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/contextualTypingOfArrayLiterals1.ts b/tests/cases/fourslash/contextualTypingOfArrayLiterals1.ts similarity index 58% rename from tests/cases/fourslash_old/contextualTypingOfArrayLiterals1.ts rename to tests/cases/fourslash/contextualTypingOfArrayLiterals1.ts index 917ada8693f..9e59d21c53b 100644 --- a/tests/cases/fourslash_old/contextualTypingOfArrayLiterals1.ts +++ b/tests/cases/fourslash/contextualTypingOfArrayLiterals1.ts @@ -9,9 +9,9 @@ //// [x: number]: C; ////} -////var x/*1*/ = [null, null]; +////var /*1*/x = [null, null]; ////var x2: I = [null, null]; -////var r/*2*/ = x2[0]; +////var /*2*/r = x2[0]; ////var a = { name: 'bob', age: 20 }; ////var b = { name: 'jim', age: 20, dob: new Date() }; @@ -19,31 +19,31 @@ ////var d = { name: 'jim', age: 20, address: 'springfield' }; ////var x3: I = [a, b]; -////var r3/*3*/ = x3[1]; +////var /*3*/r3 = x3[1]; ////var x4: I = [a, b, c]; -////var r4/*4*/ = x4[1]; +////var /*4*/r4 = x4[1]; -////var x5/*5*/ = [a, b, c, d]; -////var r5/*6*/ = x5[1]; +////var /*5*/x5 = [a, b, c, d]; +////var /*6*/r5 = x5[1]; // the above code should have a couple errors that will need to be updated with appropriate new (non-error) code and quick info checks verify.not.errorExistsBetweenMarkers('1', '6'); goTo.marker('1'); -verify.quickInfoIs('any[]'); +verify.quickInfoIs('(var) x: any[]'); goTo.marker('2'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) r: C'); goTo.marker('3'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) r3: C'); goTo.marker('4'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) r4: C'); goTo.marker('5'); -verify.quickInfoIs('{ name: string; age: number; }[]'); +verify.quickInfoIs('(var) x5: {\n name: string;\n age: number;\n}[]'); goTo.marker('6'); -verify.quickInfoIs('{ name: string; age: number; }'); \ No newline at end of file +verify.quickInfoIs('(var) r5: {\n name: string;\n age: number;\n}'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/contextualTypingOfGenericCallSignatures1.ts b/tests/cases/fourslash/contextualTypingOfGenericCallSignatures1.ts similarity index 60% rename from tests/cases/fourslash_old/contextualTypingOfGenericCallSignatures1.ts rename to tests/cases/fourslash/contextualTypingOfGenericCallSignatures1.ts index 1c2497f5fec..4f7f2baf8e0 100644 --- a/tests/cases/fourslash_old/contextualTypingOfGenericCallSignatures1.ts +++ b/tests/cases/fourslash/contextualTypingOfGenericCallSignatures1.ts @@ -4,8 +4,8 @@ //// (x: T): U ////}; ////// x should not be contextually typed -////var f24 = (x/**/) => { return 1 }; +////var f24 = (/**/x) => { return 1 }; goTo.marker(); -verify.quickInfoIs('any'); +verify.quickInfoIs('(parameter) x: any'); diff --git a/tests/cases/fourslash_old/contextualTypingOfGenericCallSignatures2.ts b/tests/cases/fourslash/contextualTypingOfGenericCallSignatures2.ts similarity index 75% rename from tests/cases/fourslash_old/contextualTypingOfGenericCallSignatures2.ts rename to tests/cases/fourslash/contextualTypingOfGenericCallSignatures2.ts index 1889a22ea66..33a1167c9f5 100644 --- a/tests/cases/fourslash_old/contextualTypingOfGenericCallSignatures2.ts +++ b/tests/cases/fourslash/contextualTypingOfGenericCallSignatures2.ts @@ -5,8 +5,8 @@ ////} ////function f6(x: (p: T) => void) { } ////// x should not be contextually typed so this should be an error -////f6(x/**/ => x()) +////f6(/**/x => x()) goTo.marker(); -verify.quickInfoIs('any'); +verify.quickInfoIs('(parameter) x: any'); verify.numberOfErrorsInCurrentFile(1); diff --git a/tests/cases/fourslash/contextualTypingReturnExpressions.ts b/tests/cases/fourslash/contextualTypingReturnExpressions.ts new file mode 100644 index 00000000000..a36e2a7fcd9 --- /dev/null +++ b/tests/cases/fourslash/contextualTypingReturnExpressions.ts @@ -0,0 +1,13 @@ +/// + +////interface A { } +////var f44: (x: A) => (y: A) => A = /*1*/x => /*2*/y => /*3*/x; + +goTo.marker('1'); +verify.quickInfoIs('(parameter) x: A'); + +goTo.marker('2'); +verify.quickInfoIs('(parameter) y: A'); + +goTo.marker('3'); +verify.quickInfoIs('(parameter) x: A'); \ No newline at end of file diff --git a/tests/cases/fourslash/contextuallyTypedFunctionExpressionGeneric1.ts b/tests/cases/fourslash/contextuallyTypedFunctionExpressionGeneric1.ts index 0204003e192..ff21d10aae8 100644 --- a/tests/cases/fourslash/contextuallyTypedFunctionExpressionGeneric1.ts +++ b/tests/cases/fourslash/contextuallyTypedFunctionExpressionGeneric1.ts @@ -10,13 +10,13 @@ ////var max2: Comparer = (x/*1*/x, y/*2*/y) => { return x/*3*/x.compareTo(y/*4*/y) }; goTo.marker('1'); -verify.quickInfoIs('any', null, 'xx'); +verify.quickInfoIs('(parameter) xx: any', null); goTo.marker('2'); -verify.quickInfoIs('any', null, 'yy'); +verify.quickInfoIs('(parameter) yy: any', null); goTo.marker('3'); -verify.quickInfoIs('any', null, 'xx'); +verify.quickInfoIs('(parameter) xx: any', null); goTo.marker('4'); -verify.quickInfoIs('any', null, 'yy'); +verify.quickInfoIs('(parameter) yy: any', null); diff --git a/tests/cases/fourslash_old/defaultParamsAndContextualTypes.ts b/tests/cases/fourslash/defaultParamsAndContextualTypes.ts similarity index 76% rename from tests/cases/fourslash_old/defaultParamsAndContextualTypes.ts rename to tests/cases/fourslash/defaultParamsAndContextualTypes.ts index 7aa300d6f3b..865f007a718 100644 --- a/tests/cases/fourslash_old/defaultParamsAndContextualTypes.ts +++ b/tests/cases/fourslash/defaultParamsAndContextualTypes.ts @@ -13,6 +13,6 @@ ////} goTo.marker('1'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(parameter) xy: string'); goTo.marker('2'); -verify.quickInfoIs('FooOptions'); +verify.quickInfoIs('(parameter) options: FooOptions'); diff --git a/tests/cases/fourslash_old/derivedTypeIndexerWithGenericConstraints.ts b/tests/cases/fourslash/derivedTypeIndexerWithGenericConstraints.ts similarity index 82% rename from tests/cases/fourslash_old/derivedTypeIndexerWithGenericConstraints.ts rename to tests/cases/fourslash/derivedTypeIndexerWithGenericConstraints.ts index 22602fc991e..5a62cac01fe 100644 --- a/tests/cases/fourslash_old/derivedTypeIndexerWithGenericConstraints.ts +++ b/tests/cases/fourslash/derivedTypeIndexerWithGenericConstraints.ts @@ -17,7 +17,7 @@ ////} ////var a: BaseCollection; -////var r/**/ = a._itemsByKey['x']; // should just say CollectionItem not TItem extends CollectionItem +////var /**/r = a._itemsByKey['x']; // should just say CollectionItem not TItem extends CollectionItem ////var result = r.x; ////a = new DbSet(); @@ -25,5 +25,5 @@ ////var result2 = r2.x; goTo.marker(''); -verify.quickInfoIs('CollectionItem'); +verify.quickInfoIs('(var) r: CollectionItem'); verify.numberOfErrorsInCurrentFile(0); \ No newline at end of file diff --git a/tests/cases/fourslash_old/distinctTypesInCallbacksWithSameNames.ts b/tests/cases/fourslash/distinctTypesInCallbacksWithSameNames.ts similarity index 100% rename from tests/cases/fourslash_old/distinctTypesInCallbacksWithSameNames.ts rename to tests/cases/fourslash/distinctTypesInCallbacksWithSameNames.ts diff --git a/tests/cases/fourslash_old/duplicateIndexers.ts b/tests/cases/fourslash/duplicateIndexers.ts similarity index 68% rename from tests/cases/fourslash_old/duplicateIndexers.ts rename to tests/cases/fourslash/duplicateIndexers.ts index bb4626c41b4..9c25994c347 100644 --- a/tests/cases/fourslash_old/duplicateIndexers.ts +++ b/tests/cases/fourslash/duplicateIndexers.ts @@ -6,7 +6,7 @@ ////} ////var i: I; -////var r/**/ = i[1]; +////var /**/r = i[1]; goTo.marker(); -verify.quickInfoIs('string'); \ No newline at end of file +verify.quickInfoIs('(var) r: string'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/duplicateTypeParameters.ts b/tests/cases/fourslash/duplicateTypeParameters.ts similarity index 73% rename from tests/cases/fourslash_old/duplicateTypeParameters.ts rename to tests/cases/fourslash/duplicateTypeParameters.ts index e57c950f03b..40b0441606e 100644 --- a/tests/cases/fourslash_old/duplicateTypeParameters.ts +++ b/tests/cases/fourslash/duplicateTypeParameters.ts @@ -1,6 +1,6 @@ /// -//// class A { } +//// class A { } goTo.marker(); verify.quickInfoExists(); diff --git a/tests/cases/fourslash/emptyArrayInference.ts b/tests/cases/fourslash/emptyArrayInference.ts new file mode 100644 index 00000000000..71f80653420 --- /dev/null +++ b/tests/cases/fourslash/emptyArrayInference.ts @@ -0,0 +1,10 @@ +/// + +////var x/*1*/x = true ? [1] : [undefined]; +////var y/*2*/y = true ? [1] : []; + +goTo.marker('1'); +verify.quickInfoIs('(var) xx: number[]'); + +goTo.marker('2'); +verify.quickInfoIs('(var) yy: number[]'); diff --git a/tests/cases/fourslash/enumAddition.ts b/tests/cases/fourslash/enumAddition.ts index c548c280020..a2f2efd38d6 100644 --- a/tests/cases/fourslash/enumAddition.ts +++ b/tests/cases/fourslash/enumAddition.ts @@ -5,4 +5,4 @@ goTo.marker(); verify.quickInfoExists(); -verify.quickInfoIs('number'); +verify.quickInfoIs('(var) t: number'); diff --git a/tests/cases/fourslash_old/errorsAfterResolvingVariableDeclOfMergedVariableAndClassDecl.ts b/tests/cases/fourslash/errorsAfterResolvingVariableDeclOfMergedVariableAndClassDecl.ts similarity index 84% rename from tests/cases/fourslash_old/errorsAfterResolvingVariableDeclOfMergedVariableAndClassDecl.ts rename to tests/cases/fourslash/errorsAfterResolvingVariableDeclOfMergedVariableAndClassDecl.ts index 802296e5a7f..9287414584e 100644 --- a/tests/cases/fourslash_old/errorsAfterResolvingVariableDeclOfMergedVariableAndClassDecl.ts +++ b/tests/cases/fourslash/errorsAfterResolvingVariableDeclOfMergedVariableAndClassDecl.ts @@ -18,7 +18,7 @@ verify.numberOfErrorsInCurrentFile(0); goTo.marker("1"); edit.backspace(1); edit.insert(" "); -verify.quickInfoIs("typeof C", undefined, "M.C.C", "var"); +verify.quickInfoIs("(var) M.C.C: typeof M.C"); // Verify there are no errors verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash_old/exportEqualCallableInterface.ts b/tests/cases/fourslash/exportEqualCallableInterface.ts similarity index 100% rename from tests/cases/fourslash_old/exportEqualCallableInterface.ts rename to tests/cases/fourslash/exportEqualCallableInterface.ts diff --git a/tests/cases/fourslash_old/exportEqualTypes.ts b/tests/cases/fourslash/exportEqualTypes.ts similarity index 60% rename from tests/cases/fourslash_old/exportEqualTypes.ts rename to tests/cases/fourslash/exportEqualTypes.ts index 80b3c6010e8..47a266f7f39 100644 --- a/tests/cases/fourslash_old/exportEqualTypes.ts +++ b/tests/cases/fourslash/exportEqualTypes.ts @@ -10,16 +10,16 @@ // @Filename: exportEqualTypes_file1.ts /////// ////import test = require('exportEqualTypes_file0'); -////var t: test/*1*/; // var 't' should be of type 'test' -////var r1/*2*/ = t(); // Should return a Date -////var r2/*3*/ = t.foo/*4*/; // t should have 'foo' in dropdown list and be of type 'string' +////var t: /*1*/test; // var 't' should be of type 'test' +////var /*2*/r1 = t(); // Should return a Date +////var /*3*/r2 = t./*4*/foo; // t should have 'foo' in dropdown list and be of type 'string' goTo.marker('1'); -verify.quickInfoIs('test'); +verify.quickInfoIs('(alias) test'); goTo.marker('2'); -verify.quickInfoIs('Date'); +verify.quickInfoIs('(var) r1: Date'); goTo.marker('3'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) r2: string'); goTo.marker('4'); verify.memberListContains('foo'); verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash_old/extendArray.ts b/tests/cases/fourslash/extendArray.ts similarity index 59% rename from tests/cases/fourslash_old/extendArray.ts rename to tests/cases/fourslash/extendArray.ts index f985a8b7fcc..7c7c15475e4 100644 --- a/tests/cases/fourslash_old/extendArray.ts +++ b/tests/cases/fourslash/extendArray.ts @@ -2,14 +2,14 @@ ////interface Foo extends Array { } ////var x: Foo; -////var r/*1*/ = x[0]; +////var /*1*/r = x[0]; ////interface Foo2 extends Array { } ////var x2: Foo2; -////var r2/*2*/ = x2[0]; +////var /*2*/r2 = x2[0]; goTo.marker('1'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) r: string'); goTo.marker('2'); -verify.quickInfoIs('string'); \ No newline at end of file +verify.quickInfoIs('(var) r2: string'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/extendArrayInterfaceMember.ts b/tests/cases/fourslash/extendArrayInterfaceMember.ts similarity index 72% rename from tests/cases/fourslash_old/extendArrayInterfaceMember.ts rename to tests/cases/fourslash/extendArrayInterfaceMember.ts index 255b35d594f..6795dfd5144 100644 --- a/tests/cases/fourslash_old/extendArrayInterfaceMember.ts +++ b/tests/cases/fourslash/extendArrayInterfaceMember.ts @@ -1,22 +1,22 @@ /// ////var x = [1, 2, 3]; -////var y/*y*/ = x./*1*/pop/*2*/(5); +////var /*y*/y = /*1*/x.pop(5)/*2*/; //// verify.errorExistsBetweenMarkers("1", "2"); -verify.numberOfErrorsInCurrentFile(2); +verify.numberOfErrorsInCurrentFile(1); // Expected errors are: // - Supplied parameters do not match any signature of call target. // - Could not select overload for 'call' expression. goTo.marker("y"); -verify.quickInfoIs("any"); +verify.quickInfoIs("(var) y: any"); goTo.eof(); edit.insert("interface Array { pop(def: T): T; }"); verify.not.errorExistsBetweenMarkers("1", "2"); goTo.marker("y"); -verify.quickInfoIs("number"); +verify.quickInfoIs("(var) y: number"); verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash_old/extendInterfaceOverloadedMethod.ts b/tests/cases/fourslash/extendInterfaceOverloadedMethod.ts similarity index 76% rename from tests/cases/fourslash_old/extendInterfaceOverloadedMethod.ts rename to tests/cases/fourslash/extendInterfaceOverloadedMethod.ts index 075f3e040ca..5cd1d8d94a5 100644 --- a/tests/cases/fourslash_old/extendInterfaceOverloadedMethod.ts +++ b/tests/cases/fourslash/extendInterfaceOverloadedMethod.ts @@ -9,11 +9,11 @@ //// bar(): void ; ////} ////var b: B; -////var x/**/ = b.foo2().foo(5).foo(); // 'x' is of type 'void' +////var /**/x = b.foo2().foo(5).foo(); // 'x' is of type 'void' // this line triggers a semantic/syntactic error check, remove line when 788570 is fixed edit.insert(''); goTo.marker(); -verify.quickInfoIs('void'); +verify.quickInfoIs('(var) x: void'); verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash_old/extendsTArray.ts b/tests/cases/fourslash/extendsTArray.ts similarity index 67% rename from tests/cases/fourslash_old/extendsTArray.ts rename to tests/cases/fourslash/extendsTArray.ts index 13de36dc04e..5bf798358fd 100644 --- a/tests/cases/fourslash_old/extendsTArray.ts +++ b/tests/cases/fourslash/extendsTArray.ts @@ -7,9 +7,9 @@ //// b: T; ////} ////var x: I2; -////var y/**/ = x(undefined); // Typeof y should be Date[] +////var /**/y = x(undefined); // Typeof y should be Date[] ////y.length; goTo.marker(); -verify.quickInfoIs('Date[]'); +verify.quickInfoIs('(var) y: Date[]'); verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash_old/externalModuleIntellisense.ts b/tests/cases/fourslash/externalModuleIntellisense.ts similarity index 100% rename from tests/cases/fourslash_old/externalModuleIntellisense.ts rename to tests/cases/fourslash/externalModuleIntellisense.ts diff --git a/tests/cases/fourslash/externalModuleWithExportAssignment.ts b/tests/cases/fourslash/externalModuleWithExportAssignment.ts index 0a5da79aad6..952640f2c6c 100644 --- a/tests/cases/fourslash/externalModuleWithExportAssignment.ts +++ b/tests/cases/fourslash/externalModuleWithExportAssignment.ts @@ -28,19 +28,19 @@ ////var /*14*/r4 = a1(/*13*/); ////var v1: a1./*15*/connectExport; -//goTo.file("externalModuleWithExportAssignment_file1.ts"); -//goTo.marker('1'); -//verify.quickInfoIs("a1"); +goTo.file("externalModuleWithExportAssignment_file1.ts"); +goTo.marker('1'); +verify.quickInfoIs("(alias) a1"); -//goTo.marker('2'); -//verify.quickInfoIs("{ test1: a1.connectModule; test2(): a1.connectModule; (): a1.connectExport; }", undefined, "a", "var"); +goTo.marker('2'); +verify.quickInfoIs("(var) a: {\n (): a1.connectExport;\n test1: a1.connectModule;\n test2(): a1.connectModule;\n}", undefined); -//goTo.marker('3'); -//verify.quickInfoIs("(res: any, req: any, next: any): void", undefined, "a1.connectModule", "function"); -//verify.completionListContains("test1", "a1.connectModule", undefined, "test1", "property"); -//verify.completionListContains("test2", "(): a1.connectModule", undefined, "test2", "method"); -//verify.not.completionListContains("connectModule"); -//verify.not.completionListContains("connectExport"); +goTo.marker('3'); +verify.quickInfoIs("(property) test1: a1.connectModule(res: any, req: any, next: any) => void", undefined); +verify.completionListContains("test1", "(property) test1: a1.connectModule", undefined); +verify.completionListContains("test2", "(method) test2(): a1.connectModule", undefined); +verify.not.completionListContains("connectModule"); +verify.not.completionListContains("connectExport"); goTo.marker('4'); verify.currentSignatureHelpIs("test1(res: any, req: any, next: any): void"); @@ -48,21 +48,21 @@ verify.currentSignatureHelpIs("test1(res: any, req: any, next: any): void"); goTo.marker('5'); verify.currentSignatureHelpIs("test2(): a1.connectModule"); -//goTo.marker('6'); -//verify.quickInfoIs("a1.connectModule", undefined, "r1", "var"); +goTo.marker('6'); +verify.quickInfoIs("(var) r1: a1.connectModule", undefined); goTo.marker('7'); verify.currentSignatureHelpIs("a(): a1.connectExport"); -//goTo.marker('8'); -//verify.quickInfoIs("a1.connectExport", undefined, "r2", "var"); +goTo.marker('8'); +verify.quickInfoIs("(var) r2: a1.connectExport", undefined); -//goTo.marker('9'); -//verify.quickInfoIs("(res: any, req: any, next: any): void", undefined, "a1.connectModule", "function"); -//verify.completionListContains("test1", "a1.connectModule", undefined, "test1", "property"); -//verify.completionListContains("test2", "(): a1.connectModule", undefined, "test2", "method"); -//verify.not.completionListContains("connectModule"); -//verify.not.completionListContains("connectExport"); +goTo.marker('9'); +verify.quickInfoIs("(property) test1: a1.connectModule(res: any, req: any, next: any) => void", undefined); +verify.completionListContains("test1", "(property) test1: a1.connectModule", undefined); +verify.completionListContains("test2", "(method) test2(): a1.connectModule", undefined); +verify.completionListContains("connectModule"); +verify.completionListContains("connectExport"); goTo.marker('10'); verify.currentSignatureHelpIs("test1(res: any, req: any, next: any): void"); @@ -70,18 +70,18 @@ verify.currentSignatureHelpIs("test1(res: any, req: any, next: any): void"); goTo.marker('11'); verify.currentSignatureHelpIs("test2(): a1.connectModule"); -//goTo.marker('12'); -//verify.quickInfoIs("a1.connectModule", undefined, "r3", "var"); +goTo.marker('12'); +verify.quickInfoIs("(var) r3: a1.connectModule", undefined); goTo.marker('13'); verify.currentSignatureHelpIs("a1(): a1.connectExport"); -//goTo.marker('14'); -//verify.quickInfoIs("a1.connectExport", undefined, "r4", "var"); +goTo.marker('14'); +verify.quickInfoIs("(var) r4: a1.connectExport", undefined); -//goTo.marker('15'); -//verify.not.completionListContains("test1", "a1.connectModule", undefined, "test1", "property"); -//verify.not.completionListContains("test2", "(): a1.connectModule", undefined, "test2", "method"); -//verify.completionListContains("connectModule", "a1.connectModule", undefined, "a1.connectModule", "interface"); -//verify.completionListContains("connectExport", "a1.connectExport", undefined, "a1.connectExport", "interface"); +goTo.marker('15'); +verify.not.completionListContains("test1", "(property) test1: a1.connectModule", undefined); +verify.not.completionListContains("test2", "(method) test2(): a1.connectModule", undefined); +verify.completionListContains("connectModule", "interface a1.connectModule", undefined); +verify.completionListContains("connectExport", "interface a1.connectExport", undefined); diff --git a/tests/cases/fourslash/forIn.ts b/tests/cases/fourslash/forIn.ts index 14c01ad8969..87eb1ea356b 100644 --- a/tests/cases/fourslash/forIn.ts +++ b/tests/cases/fourslash/forIn.ts @@ -5,4 +5,4 @@ goTo.marker(); -verify.quickInfoIs('any', "", "p", "var"); \ No newline at end of file +verify.quickInfoIs('(var) p: any', ""); \ No newline at end of file diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index f57a910245d..7be7dd63c92 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -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,8 @@ 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 quickInfoSymbolNameIs(symbolName) { - FourSlash.currentTestState.verifyQuickInfo(this.negative, undefined, undefined, symbolName, undefined); + public quickInfoIs(expectedText?: string, expectedDocumentation?: string) { + FourSlash.currentTestState.verifyQuickInfo(this.negative, expectedText, expectedDocumentation); } public quickInfoExists() { @@ -286,11 +282,11 @@ module FourSlashInterface { } public currentParameterHelpArgumentDocCommentIs(docComment: string) { - // FourSlash.currentTestState.verifyCurrentParameterHelpDocComment(docComment); + FourSlash.currentTestState.verifyCurrentParameterHelpDocComment(docComment); } public currentSignatureHelpDocCommentIs(docComment: string) { - // FourSlash.currentTestState.verifyCurrentSignatureHelpDocComment(docComment); + FourSlash.currentTestState.verifyCurrentSignatureHelpDocComment(docComment); } public signatureHelpCountIs(expected: number) { @@ -401,8 +397,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 }[]) { diff --git a/tests/cases/fourslash/functionProperty.ts b/tests/cases/fourslash/functionProperty.ts index 4f089d95cf3..e9ffdcf2cdf 100644 --- a/tests/cases/fourslash/functionProperty.ts +++ b/tests/cases/fourslash/functionProperty.ts @@ -30,20 +30,20 @@ verify.currentSignatureHelpIs('x(a: number): void'); goTo.marker('signatureC'); verify.currentSignatureHelpIs('x(a: number): void'); -//goTo.marker('completionA'); -//verify.completionListContains("x", "(a: number): void"); +goTo.marker('completionA'); +verify.completionListContains("x", "(property) x: (a: number) => void"); -//goTo.marker('completionB'); -//verify.completionListContains("x", "(a: number) => void"); +goTo.marker('completionB'); +verify.completionListContains("x", "(property) x: (a: number) => void"); -//goTo.marker('completionC'); -//verify.completionListContains("x", "(a: number) => void"); +goTo.marker('completionC'); +verify.completionListContains("x", "(property) x: (a: number) => void"); -//goTo.marker('quickInfoA'); -//verify.quickInfoIs("(a: number): void", undefined, "x", "local function"); +goTo.marker('quickInfoA'); +verify.quickInfoIs("(property) x: (a: number) => void", undefined); -//goTo.marker('quickInfoB'); -//verify.quickInfoIs("(a: number) => void", undefined, "x", "property"); +goTo.marker('quickInfoB'); +verify.quickInfoIs("(property) x: (a: number) => void", undefined); -//goTo.marker('quickInfoC'); -//verify.quickInfoIs("(a: number) => void", undefined, "x", "property"); \ No newline at end of file +goTo.marker('quickInfoC'); +verify.quickInfoIs("(property) x: (a: number) => void", undefined); \ No newline at end of file diff --git a/tests/cases/fourslash_old/funduleWithRecursiveReference.ts b/tests/cases/fourslash/funduleWithRecursiveReference.ts similarity index 75% rename from tests/cases/fourslash_old/funduleWithRecursiveReference.ts rename to tests/cases/fourslash/funduleWithRecursiveReference.ts index 04ecae10790..c3aaf36317d 100644 --- a/tests/cases/fourslash_old/funduleWithRecursiveReference.ts +++ b/tests/cases/fourslash/funduleWithRecursiveReference.ts @@ -3,7 +3,7 @@ ////module M { //// export function C() {} //// export module C { -//// export var C/**/ = M.C +//// export var /**/C = M.C //// } ////} @@ -11,5 +11,5 @@ edit.insert(''); goTo.marker(); -verify.quickInfoIs('typeof C'); +verify.quickInfoIs('(var) M.C.C: typeof M.C'); verify.numberOfErrorsInCurrentFile(0); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericCallSignaturesInNonGenericTypes1.ts b/tests/cases/fourslash/genericCallSignaturesInNonGenericTypes1.ts similarity index 75% rename from tests/cases/fourslash_old/genericCallSignaturesInNonGenericTypes1.ts rename to tests/cases/fourslash/genericCallSignaturesInNonGenericTypes1.ts index 9bc2c4f8d3c..c3e3fccbc76 100644 --- a/tests/cases/fourslash_old/genericCallSignaturesInNonGenericTypes1.ts +++ b/tests/cases/fourslash/genericCallSignaturesInNonGenericTypes1.ts @@ -13,7 +13,7 @@ ////var a: number[]; -////var b/**/ = _(a); +////var /**/b = _(a); goTo.marker(); -verify.quickInfoIs('WrappedArray'); +verify.quickInfoIs('(var) b: WrappedArray'); diff --git a/tests/cases/fourslash_old/genericCallSignaturesInNonGenericTypes2.ts b/tests/cases/fourslash/genericCallSignaturesInNonGenericTypes2.ts similarity index 62% rename from tests/cases/fourslash_old/genericCallSignaturesInNonGenericTypes2.ts rename to tests/cases/fourslash/genericCallSignaturesInNonGenericTypes2.ts index 2a978c641c2..7f3d1c4a654 100644 --- a/tests/cases/fourslash_old/genericCallSignaturesInNonGenericTypes2.ts +++ b/tests/cases/fourslash/genericCallSignaturesInNonGenericTypes2.ts @@ -10,7 +10,7 @@ ////var a: number[]; -////var b/**/ = _(a); // WrappedArray, should be WrappedArray +////var /**/b = _(a); // WrappedArray, should be WrappedArray goTo.marker(); -verify.quickInfoIs('WrappedArray'); \ No newline at end of file +verify.quickInfoIs('(var) b: WrappedArray'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericCallsWithOptionalParams1.ts b/tests/cases/fourslash/genericCallsWithOptionalParams1.ts similarity index 61% rename from tests/cases/fourslash_old/genericCallsWithOptionalParams1.ts rename to tests/cases/fourslash/genericCallsWithOptionalParams1.ts index 1d720fa5537..1f5ec1562c5 100644 --- a/tests/cases/fourslash_old/genericCallsWithOptionalParams1.ts +++ b/tests/cases/fourslash/genericCallsWithOptionalParams1.ts @@ -9,11 +9,11 @@ ////} ////var c = new Collection(); ////var utils: Utils; -////var r/*1*/ = utils.fold(c, (s, t) => t, ""); -////var r2/*2*/ = utils.fold(c, (s, t) => t); +////var /*1*/r = utils.fold(c, (s, t) => t, ""); +////var /*2*/r2 = utils.fold(c, (s, t) => t); goTo.marker('1'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) r: string'); goTo.marker('2'); -verify.quickInfoIs('string'); \ No newline at end of file +verify.quickInfoIs('(var) r2: string'); \ No newline at end of file diff --git a/tests/cases/fourslash/genericCombinatorWithConstraints1.ts b/tests/cases/fourslash/genericCombinatorWithConstraints1.ts new file mode 100644 index 00000000000..3c8db44afca --- /dev/null +++ b/tests/cases/fourslash/genericCombinatorWithConstraints1.ts @@ -0,0 +1,13 @@ +/// + +////function apply(source: T[], selector: (x: T) => U) { +//// var /*1*/xs = source.map(selector); // any[] +//// var /*2*/xs2 = source.map((x: T, a, b): U => { return null }); // any[] +////} + +goTo.marker('1'); +verify.quickInfoIs('(local var) xs: U[]'); + +goTo.marker('2'); +verify.quickInfoIs('(local var) xs2: U[]'); + diff --git a/tests/cases/fourslash/genericCombinators1.ts b/tests/cases/fourslash/genericCombinators1.ts new file mode 100644 index 00000000000..8d10869fa41 --- /dev/null +++ b/tests/cases/fourslash/genericCombinators1.ts @@ -0,0 +1,101 @@ +/// +////interface Collection { +//// length: number; +//// add(x: T): void; +//// remove(x: T): boolean; +////} + +////interface Combinators { +//// map(c: Collection, f: (x: T) => U): Collection; +//// map(c: Collection, f: (x: T) => any): Collection; +////} + +////class A { +//// foo() { return this; } +////} + +////class B { +//// foo(x: T): T { return null; } +////} + +////var c2: Collection; +////var c3: Collection>; +////var c4: Collection; +////var c5: Collection>; + +////var _: Combinators; +////var rf1 = (x: number) => { return x.toFixed() }; +////var rf2 = (x: Collection) => { return x.length }; +////var rf3 = (x: A) => { return x.foo() }; + +////var /*9*/r1a = _.map(c2, (/*1*/x) => { return x.toFixed() }); +////var /*10*/r1b = _.map(c2, rf1); + +////var /*11*/r2a = _.map(c3, (/*2*/x: Collection) => { return x.length }); +////var /*12*/r2b = _.map(c3, rf2); + +////var /*13*/r3a = _.map(c4, (/*3*/x) => { return x.foo() }); +////var /*14*/r3b = _.map(c4, rf3); + +////var /*15*/r4a = _.map(c5, (/*4*/x) => { return x.foo(1) }); + +////var /*17*/r5a = _.map(c2, (/*5*/x) => { return x.toFixed() }); +////var /*18*/r5b = _.map(c2, rf1); + +////var /*19*/r6a = _.map, number>(/*6*/c3, (x: Collection) => { return x.length }); +////var /*20*/r6b = _.map, number>(c3, rf2); + +////var /*21*/r7a = _.map(c4, (/*7*/x: A) => { return x.foo() }); +////var /*22*/r7b = _.map(c4, rf3); + +////var /*23*/r8a = _.map(c5, (/*8*/x) => { return x.foo() }); + +// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed +edit.insert(''); + +goTo.marker('1'); +verify.quickInfoIs('(parameter) x: number'); +goTo.marker('2'); +verify.quickInfoIs('(parameter) x: Collection'); +goTo.marker('3'); +verify.quickInfoIs('(parameter) x: A'); +goTo.marker('4'); +verify.quickInfoIs('(parameter) x: B'); +goTo.marker('5'); +verify.quickInfoIs('(parameter) x: number'); +goTo.marker('6'); +verify.quickInfoIs('(var) c3: Collection>'); +goTo.marker('7'); +verify.quickInfoIs('(parameter) x: A'); +goTo.marker('8'); +verify.quickInfoIs('(parameter) x: any'); // Specialized to any because no type argument was specified +goTo.marker('9'); +verify.quickInfoIs('(var) r1a: Collection'); +goTo.marker('10'); +verify.quickInfoIs('(var) r1b: Collection'); +goTo.marker('11'); +verify.quickInfoIs('(var) r2a: Collection'); +goTo.marker('12'); +verify.quickInfoIs('(var) r2b: Collection'); +goTo.marker('13'); +verify.quickInfoIs('(var) r3a: Collection'); +goTo.marker('14'); +verify.quickInfoIs('(var) r3b: Collection'); +goTo.marker('15'); +verify.quickInfoIs('(var) r4a: Collection'); +goTo.marker('17'); +verify.quickInfoIs('(var) r5a: Collection'); +goTo.marker('18'); +verify.quickInfoIs('(var) r5b: Collection'); +goTo.marker('19'); +verify.quickInfoIs('(var) r6a: Collection'); +goTo.marker('20'); +verify.quickInfoIs('(var) r6b: Collection'); +goTo.marker('21'); +verify.quickInfoIs('(var) r7a: Collection'); +goTo.marker('22'); +verify.quickInfoIs('(var) r7b: Collection'); +goTo.marker('23'); +verify.quickInfoIs('(var) r8a: Collection'); + +verify.errorExistsBetweenMarkers('error1', 'error2'); \ No newline at end of file diff --git a/tests/cases/fourslash/genericCombinators2.ts b/tests/cases/fourslash/genericCombinators2.ts new file mode 100644 index 00000000000..73adb487e2d --- /dev/null +++ b/tests/cases/fourslash/genericCombinators2.ts @@ -0,0 +1,136 @@ +/// + +////interface Collection { +//// length: number; +//// add(x: T, y: U): void ; +//// remove(x: T, y: U): boolean; +////} +////} +////interface Combinators { +//// map(c: Collection, f: (x: T, y: U) => V): Collection; +//// map(c: Collection, f: (x: T, y: U) => any): Collection; +////} +////} +////class A { +//// foo(): T { return null; } +////} +////} +////class B { +//// foo(x: T): T { return null; } +////} +////} +////var c1: Collection; +////var c2: Collection; +////var c3: Collection, string>; +////var c4: Collection; +////var c5: Collection>; +////} +////var _: Combinators; +////// param help on open paren for arg 2 should show 'number' not T or 'any' +////// x should be contextually typed to number +////var rf1 = (x: number, y: string) => { return x.toFixed() }; +////var rf2 = (x: Collection, y: string) => { return x.length }; +////var rf3 = (x: number, y: A) => { return y.foo() }; +////} +////var /*9*/r1a = _.map/*1c*/(c2, (/*1a*/x, /*1b*/y) => { return x.toFixed() }); +////var /*10*/r1b = _.map(c2, rf1); +////} +////var /*11*/r2a = _.map(c3, (/*2a*/x, /*2b*/y) => { return x.length }); +////var /*12*/r2b = _.map(c3, rf2); +////} +////var /*13*/r3a = _.map(c4, (/*3a*/x, /*3b*/y) => { return y.foo() }); +////var /*14*/r3b = _.map(c4, rf3); +////} +////var /*15*/r4a = _.map(c5, (/*4a*/x, /*4b*/y) => { return y.foo() }); +////} +////var /*17*/r5a = _.map(c2, /*17error1*/(/*5a*/x, /*5b*/y) => { return x.toFixed() }/*17error2*/); +////var rf1b = (x: number, y: string) => { return new Date() }; +////var /*18*/r5b = _.map(c2, rf1b); +//// +////var /*19*/r6a = _.map, string, Date>(c3, (/*6a*/x,/*6b*/y) => { return new Date(); }); +////var rf2b = (x: Collection, y: string) => { return new Date(); }; +////var /*20*/r6b = _.map, string, Date>(c3, rf2b); +//// +////var /*21*/r7a = _.map(c4, /*21error1*/(/*7a*/x,/*7b*/y) => { return y.foo() }/*21error2*/); +////var /*22*/r7b = _.map(c4, /*22error1*/rf3/*22error2*/); +//// +////var /*23*/r8a = _.map(c5, (/*8a*/x,/*8b*/y) => { return y.foo() }); + +// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed +edit.insert(''); + +goTo.marker('2a'); +verify.quickInfoIs('(parameter) x: Collection'); +goTo.marker('2b'); +verify.quickInfoIs('(parameter) y: string'); + +goTo.marker('3a'); +verify.quickInfoIs('(parameter) x: number'); +goTo.marker('3b'); +verify.quickInfoIs('(parameter) y: A'); + +goTo.marker('4a'); +verify.quickInfoIs('(parameter) x: number'); +goTo.marker('4b'); +verify.quickInfoIs('(parameter) y: B'); + +goTo.marker('5a'); +verify.quickInfoIs('(parameter) x: number'); +goTo.marker('5b'); +verify.quickInfoIs('(parameter) y: string'); + +goTo.marker('6a'); +verify.quickInfoIs('(parameter) x: Collection'); +goTo.marker('6b'); +verify.quickInfoIs('(parameter) y: string'); + +goTo.marker('7a'); +verify.quickInfoIs('(parameter) x: number'); +goTo.marker('7b'); +verify.quickInfoIs('(parameter) y: A'); + +goTo.marker('8a'); +verify.quickInfoIs('(parameter) x: number'); +goTo.marker('8b'); +verify.quickInfoIs('(parameter) y: any'); // Specialized to any because no type argument was specified + +goTo.marker('9'); +verify.quickInfoIs('(var) r1a: Collection'); +goTo.marker('10'); +verify.quickInfoIs('(var) r1b: Collection'); +goTo.marker('11'); +verify.quickInfoIs('(var) r2a: Collection, number>'); +goTo.marker('12'); +verify.quickInfoIs('(var) r2b: Collection, number>'); +goTo.marker('13'); +verify.quickInfoIs('(var) r3a: Collection'); +goTo.marker('14'); +verify.quickInfoIs('(var) r3b: Collection'); +goTo.marker('15'); +verify.quickInfoIs('(var) r4a: Collection'); + +goTo.marker('17'); +verify.quickInfoIs('(var) r5a: Collection'); // This is actually due to an error because toFixed does not return a Date + +goTo.marker('18'); +verify.quickInfoIs('(var) r5b: Collection'); + +goTo.marker('19'); +verify.quickInfoIs('(var) r6a: Collection, Date>'); + +goTo.marker('20'); +verify.quickInfoIs('(var) r6b: Collection, Date>'); + +goTo.marker('21'); +verify.quickInfoIs('(var) r7a: Collection'); // This call is an error because y.foo() does not return a string + +goTo.marker('22'); +verify.quickInfoIs('(var) r7b: Collection'); // This call is an error because y.foo() does not return a string + +goTo.marker('23'); +verify.quickInfoIs('(var) r8a: Collection'); + +verify.errorExistsBetweenMarkers('error1', 'error2'); +verify.errorExistsBetweenMarkers('17error1', '17error2'); +verify.errorExistsBetweenMarkers('21error1', '21error2'); +verify.errorExistsBetweenMarkers('22error1', '22error2'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericCombinators3.ts b/tests/cases/fourslash/genericCombinators3.ts similarity index 53% rename from tests/cases/fourslash_old/genericCombinators3.ts rename to tests/cases/fourslash/genericCombinators3.ts index 9a65762a657..6871614d868 100644 --- a/tests/cases/fourslash_old/genericCombinators3.ts +++ b/tests/cases/fourslash/genericCombinators3.ts @@ -12,16 +12,16 @@ //// ////var _: Combinators; //// -////var r1a/*9*/ = _.ma/*1c*/p(c2, (x/*1a*/,y/*1b*/) => { return x + "" }); // check quick info of map here +////var /*9*/r1a = _.ma/*1c*/p(c2, (/*1a*/x,/*1b*/y) => { return x + "" }); // check quick info of map here goTo.marker('1a'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(parameter) x: number'); goTo.marker('1b'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(parameter) y: string'); goTo.marker('1c'); -verify.quickInfoIs('(c: Collection, f: (x: number, y: string) => string): Collection (+ 1 overload(s))'); +verify.quickInfoIs('(method) Combinators.map(c: Collection, f: (x: number, y: string) => string): Collection (+1 overload)'); goTo.marker('9'); -verify.quickInfoIs('Collection'); +verify.quickInfoIs('(var) r1a: Collection'); diff --git a/tests/cases/fourslash_old/genericDerivedTypeAcrossModuleBoundary1.ts b/tests/cases/fourslash/genericDerivedTypeAcrossModuleBoundary1.ts similarity index 64% rename from tests/cases/fourslash_old/genericDerivedTypeAcrossModuleBoundary1.ts rename to tests/cases/fourslash/genericDerivedTypeAcrossModuleBoundary1.ts index aea8aaa52fb..ca44ceb765c 100644 --- a/tests/cases/fourslash_old/genericDerivedTypeAcrossModuleBoundary1.ts +++ b/tests/cases/fourslash/genericDerivedTypeAcrossModuleBoundary1.ts @@ -13,11 +13,11 @@ ////} ////var n = new N.D1(); -////var n2/*1*/ = new N.D2(); -////var n3/*2*/ = new N.D2(); +////var /*1*/n2 = new N.D2(); +////var /*2*/n3 = new N.D2(); goTo.marker('1'); -verify.quickInfoIs('N.D2'); +verify.quickInfoIs('(var) n2: N.D2'); goTo.marker('2') -verify.quickInfoIs('N.D2<{}>'); \ No newline at end of file +verify.quickInfoIs('(var) n3: N.D2<{}>'); \ No newline at end of file diff --git a/tests/cases/fourslash/genericFunctionReturnType.ts b/tests/cases/fourslash/genericFunctionReturnType.ts index 3be60777b1f..737c26744c5 100644 --- a/tests/cases/fourslash/genericFunctionReturnType.ts +++ b/tests/cases/fourslash/genericFunctionReturnType.ts @@ -5,17 +5,17 @@ //// return (z) => x; ////} -////var r/*2*/ = foo(/*1*/1, ""); -////var r2/*4*/ = r(/*3*/""); +////var /*2*/r = foo(/*1*/1, ""); +////var /*4*/r2 = r(/*3*/""); // goTo.marker('1'); // verify.currentSignatureHelpIs('foo(x: number, y: string): (a: string) => number'); -//goTo.marker('2'); -//verify.quickInfoIs('(a: string) => number'); +goTo.marker('2'); +verify.quickInfoIs('(var) r: (a: string) => number'); goTo.marker('3'); verify.currentSignatureHelpIs('r(a: string): number'); -//goTo.marker('4'); -//verify.quickInfoIs('number'); \ No newline at end of file +goTo.marker('4'); +verify.quickInfoIs('(var) r2: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/genericFunctionReturnType2.ts b/tests/cases/fourslash/genericFunctionReturnType2.ts index 35b4b0af32d..9658d72c676 100644 --- a/tests/cases/fourslash/genericFunctionReturnType2.ts +++ b/tests/cases/fourslash/genericFunctionReturnType2.ts @@ -8,17 +8,17 @@ ////} ////var x = new C(1); -////var r/*2*/ = x.foo(/*1*/3); -////var r2/*4*/ = r(/*3*/4); +////var /*2*/r = x.foo(/*1*/3); +////var /*4*/r2 = r(/*3*/4); goTo.marker('1'); verify.currentSignatureHelpIs('foo(x: number): (a: number) => number'); -//goTo.marker('2'); -//verify.quickInfoIs('(a: number) => number'); +goTo.marker('2'); +verify.quickInfoIs('(var) r: (a: number) => number'); goTo.marker('3'); verify.currentSignatureHelpIs('r(a: number): number'); -//goTo.marker('4'); -//verify.quickInfoIs('number'); \ No newline at end of file +goTo.marker('4'); +verify.quickInfoIs('(var) r2: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/genericFunctionWithGenericParams1.ts b/tests/cases/fourslash/genericFunctionWithGenericParams1.ts index 8b6e1c888e2..e57da708412 100644 --- a/tests/cases/fourslash/genericFunctionWithGenericParams1.ts +++ b/tests/cases/fourslash/genericFunctionWithGenericParams1.ts @@ -6,4 +6,4 @@ ////}; goTo.marker(); -verify.quickInfoIs('T', null, 'xx') +verify.quickInfoIs('(local var) xx: T', null); diff --git a/tests/cases/fourslash/genericInterfacePropertyInference1.ts b/tests/cases/fourslash/genericInterfacePropertyInference1.ts index 8cb94f50869..c7a644a201d 100644 --- a/tests/cases/fourslash/genericInterfacePropertyInference1.ts +++ b/tests/cases/fourslash/genericInterfacePropertyInference1.ts @@ -90,98 +90,98 @@ verify.numberOfErrorsInCurrentFile(0); goTo.marker('a1'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(var) f_r1: number'); goTo.marker('a2'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) f_r2: string'); goTo.marker('a3'); -verify.quickInfoIs('any'); +verify.quickInfoIs('(var) f_r3: any'); goTo.marker('a4'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) f_r5: Foo'); goTo.marker('a5'); -verify.quickInfoIs('I'); +verify.quickInfoIs('(var) f_r8: I'); goTo.marker('a6'); -verify.quickInfoIs('{ x: number; }'); +verify.quickInfoIs('(var) f_r12: {\n x: number;\n}'); goTo.marker('a7'); -verify.quickInfoIs('{ x: any; }'); +verify.quickInfoIs('(var) f_r14: {\n x: any;\n}'); goTo.marker('a8'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) f_r18: C'); goTo.marker('a9'); -verify.quickInfoIs('C<{ x: any; }>'); +verify.quickInfoIs('(var) f_r20: C<{\n x: any;\n}>'); goTo.marker('b1'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(var) f2_r1: number'); goTo.marker('b2'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) f2_r2: string'); goTo.marker('b3'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(var) f2_r3: number'); goTo.marker('b4'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) f2_r5: Foo'); goTo.marker('b5'); -verify.quickInfoIs('I'); +verify.quickInfoIs('(var) f2_r8: I'); goTo.marker('b6'); -verify.quickInfoIs('{ x: number; }'); +verify.quickInfoIs('(var) f2_r12: {\n x: number;\n}'); goTo.marker('b7'); -verify.quickInfoIs('{ x: number; }'); +verify.quickInfoIs('(var) f2_r14: {\n x: number;\n}'); goTo.marker('b8'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) f2_r18: C'); goTo.marker('b9'); -verify.quickInfoIs('C<{ x: number; }>'); +verify.quickInfoIs('(var) f2_r20: C<{\n x: number;\n}>'); goTo.marker('c1'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(var) f3_r1: number'); goTo.marker('c2'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) f3_r2: string'); goTo.marker('c3'); -verify.quickInfoIs('I'); +verify.quickInfoIs('(var) f3_r3: I'); goTo.marker('c4'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) f3_r5: Foo'); goTo.marker('c5'); -verify.quickInfoIs('I'); +verify.quickInfoIs('(var) f3_r8: I'); goTo.marker('c6'); -verify.quickInfoIs('{ x: number; }'); +verify.quickInfoIs('(var) f3_r12: {\n x: number;\n}'); goTo.marker('c7'); -verify.quickInfoIs('{ x: I; }'); +verify.quickInfoIs('(var) f3_r14: {\n x: I;\n}'); goTo.marker('c8'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) f3_r18: C'); goTo.marker('c9'); -verify.quickInfoIs('C<{ x: I; }>'); +verify.quickInfoIs('(var) f3_r20: C<{\n x: I;\n}>'); goTo.marker('d1'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(var) f4_r1: number'); goTo.marker('d2'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) f4_r2: string'); goTo.marker('d3'); -verify.quickInfoIs('{ x: number; }'); +verify.quickInfoIs('(var) f4_r3: {\n x: number;\n}'); goTo.marker('d4'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) f4_r5: Foo'); goTo.marker('d5'); -verify.quickInfoIs('I'); +verify.quickInfoIs('(var) f4_r8: I'); goTo.marker('d6'); -verify.quickInfoIs('{ x: number; }'); +verify.quickInfoIs('(var) f4_r12: {\n x: number;\n}'); goTo.marker('d7'); -verify.quickInfoIs('{ x: { x: number; }; }'); +verify.quickInfoIs('(var) f4_r14: {\n x: {\n x: number;\n };\n}'); goTo.marker('d8'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) f4_r18: C'); goTo.marker('d9'); -verify.quickInfoIs('C<{ x: { x: number; }; }>'); +verify.quickInfoIs('(var) f4_r20: C<{\n x: {\n x: number;\n };\n}>'); goTo.marker('e1'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(var) f5_r1: number'); goTo.marker('e2'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) f5_r2: string'); goTo.marker('e3'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) f5_r3: Foo'); goTo.marker('e4'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) f5_r5: Foo'); goTo.marker('e5'); -verify.quickInfoIs('I'); +verify.quickInfoIs('(var) f5_r8: I'); goTo.marker('e6'); -verify.quickInfoIs('{ x: number; }'); +verify.quickInfoIs('(var) f5_r12: {\n x: number;\n}'); goTo.marker('e7'); -verify.quickInfoIs('{ x: Foo; }'); +verify.quickInfoIs('(var) f5_r14: {\n x: Foo;\n}'); goTo.marker('e8'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) f5_r18: C'); goTo.marker('e9'); -verify.quickInfoIs('C<{ x: Foo; }>'); +verify.quickInfoIs('(var) f5_r20: C<{\n x: Foo;\n}>'); diff --git a/tests/cases/fourslash/genericInterfacePropertyInference2.ts b/tests/cases/fourslash/genericInterfacePropertyInference2.ts index dd244235fab..edfc0db3ba4 100644 --- a/tests/cases/fourslash/genericInterfacePropertyInference2.ts +++ b/tests/cases/fourslash/genericInterfacePropertyInference2.ts @@ -66,56 +66,56 @@ verify.numberOfErrorsInCurrentFile(0); goTo.marker('a1'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) f_r4: Foo'); goTo.marker('a2'); -verify.quickInfoIs('Foo>'); +verify.quickInfoIs('(var) f_r7: Foo>'); goTo.marker('a3'); -verify.quickInfoIs('IG'); +verify.quickInfoIs('(var) f_r9: IG'); goTo.marker('a5'); -verify.quickInfoIs('{ x: Foo; }'); +verify.quickInfoIs('(var) f_r13: {\n x: Foo;\n}'); goTo.marker('a7'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) f_r17: C'); goTo.marker('b1'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) f2_r4: Foo'); goTo.marker('b2'); -verify.quickInfoIs('Foo>'); +verify.quickInfoIs('(var) f2_r7: Foo>'); goTo.marker('b3'); -verify.quickInfoIs('IG'); +verify.quickInfoIs('(var) f2_r9: IG'); goTo.marker('b5'); -verify.quickInfoIs('{ x: Foo; }'); +verify.quickInfoIs('(var) f2_r13: {\n x: Foo;\n}'); goTo.marker('b7'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) f2_r17: C'); goTo.marker('c1'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) f3_r4: Foo'); goTo.marker('c2'); -verify.quickInfoIs('Foo>'); +verify.quickInfoIs('(var) f3_r7: Foo>'); goTo.marker('c3'); -verify.quickInfoIs('IG'); +verify.quickInfoIs('(var) f3_r9: IG'); goTo.marker('c5'); -verify.quickInfoIs('{ x: Foo; }'); +verify.quickInfoIs('(var) f3_r13: {\n x: Foo;\n}'); goTo.marker('c7'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) f3_r17: C'); goTo.marker('d1'); -verify.quickInfoIs('Foo<{ x: number; }>'); +verify.quickInfoIs('(var) f4_r4: Foo<{\n x: number;\n}>'); goTo.marker('d2'); -verify.quickInfoIs('Foo>'); +verify.quickInfoIs('(var) f4_r7: Foo>'); goTo.marker('d3'); -verify.quickInfoIs('IG<{ x: number; }>'); +verify.quickInfoIs('(var) f4_r9: IG<{\n x: number;\n}>'); goTo.marker('d5'); -verify.quickInfoIs('{ x: Foo<{ x: number; }>; }'); +verify.quickInfoIs('(var) f4_r13: {\n x: Foo<{\n x: number;\n }>;\n}'); goTo.marker('d7'); -verify.quickInfoIs('C<{ x: number; }>'); +verify.quickInfoIs('(var) f4_r17: C<{\n x: number;\n}>'); goTo.marker('e1'); -verify.quickInfoIs('Foo>'); +verify.quickInfoIs('(var) f5_r4: Foo>'); goTo.marker('e2'); -verify.quickInfoIs('Foo>'); +verify.quickInfoIs('(var) f5_r7: Foo>'); goTo.marker('e3'); -verify.quickInfoIs('IG>'); +verify.quickInfoIs('(var) f5_r9: IG>'); goTo.marker('e5'); -verify.quickInfoIs('{ x: Foo>; }'); +verify.quickInfoIs('(var) f5_r13: {\n x: Foo>;\n}'); goTo.marker('e7'); -verify.quickInfoIs('C>'); \ No newline at end of file +verify.quickInfoIs('(var) f5_r17: C>'); \ No newline at end of file diff --git a/tests/cases/fourslash/genericInterfacesWithConstraints1.ts b/tests/cases/fourslash/genericInterfacesWithConstraints1.ts index 882d92d847c..b75c364855c 100644 --- a/tests/cases/fourslash/genericInterfacesWithConstraints1.ts +++ b/tests/cases/fourslash/genericInterfacesWithConstraints1.ts @@ -12,8 +12,8 @@ ////var v/*3*/3: G, C>; // Ok goTo.marker('1'); -verify.quickInfoIs('G', null, 'v1'); +verify.quickInfoIs('(var) v1: G', null); goTo.marker('2'); -verify.quickInfoIs('G<{ a: string; }, C>', null, 'v2'); +verify.quickInfoIs('(var) v2: G<{\n a: string;\n}, C>', null); goTo.marker('3'); -verify.quickInfoIs('G, C>', null, 'v3'); \ No newline at end of file +verify.quickInfoIs('(var) v3: G, C>', null); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericMapTyping1.ts b/tests/cases/fourslash/genericMapTyping1.ts similarity index 72% rename from tests/cases/fourslash_old/genericMapTyping1.ts rename to tests/cases/fourslash/genericMapTyping1.ts index 9ad74f614f8..ecddc229ac2 100644 --- a/tests/cases/fourslash_old/genericMapTyping1.ts +++ b/tests/cases/fourslash/genericMapTyping1.ts @@ -22,28 +22,28 @@ verify.numberOfErrorsInCurrentFile(0); goTo.marker('1'); -verify.quickInfoIs('number[]'); +verify.quickInfoIs('(var) bb: number[]'); goTo.marker('2'); -verify.quickInfoIs('number[]'); +verify.quickInfoIs('(var) cc: number[]'); goTo.marker('3'); -verify.quickInfoIs('number[]'); +verify.quickInfoIs('(var) dd: number[]'); goTo.marker('4'); -verify.quickInfoIs('any[]'); +verify.quickInfoIs('(var) bbb: any[]'); goTo.marker('5'); -verify.quickInfoIs('any[]'); +verify.quickInfoIs('(var) ccc: any[]'); goTo.marker('6'); -verify.quickInfoIs('any[]'); +verify.quickInfoIs('(var) ddd: any[]'); goTo.marker('7'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(parameter) xx: string'); goTo.marker('8'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(parameter) xx: string'); goTo.marker('9'); -verify.quickInfoIs('string'); \ No newline at end of file +verify.quickInfoIs('(parameter) xx: string'); \ No newline at end of file diff --git a/tests/cases/fourslash/genericTypeArgumentInference1.ts b/tests/cases/fourslash/genericTypeArgumentInference1.ts new file mode 100644 index 00000000000..96d603b939c --- /dev/null +++ b/tests/cases/fourslash/genericTypeArgumentInference1.ts @@ -0,0 +1,40 @@ +/// + +////module Underscore { +//// export interface Iterator { +//// (value: T, index: any, list: any): U; +//// } +//// +//// export interface Static { +//// all(list: T[], iterator?: Iterator, context?: any): T; +//// identity(value: T): T; +//// } +////} +//// +////declare var _: Underscore.Static; +////var /*1*/r = _./*11*/all([true, 1, null, 'yes'], _.identity); +////var /*2*/r2 = _./*21*/all([true], _.identity); +////var /*3*/r3 = _./*31*/all([], _.identity); +////var /*4*/r4 = _./*41*/all([true], _.identity); + +goTo.marker('1'); +verify.quickInfoIs('(var) r: {}'); +goTo.marker('11'); +verify.quickInfoIs('(method) Underscore.Static.all<{}>(list: {}[], iterator?: Underscore.Iterator<{}, boolean>, context?: any): {}'); + +goTo.marker('2'); +verify.quickInfoIs('(var) r2: boolean'); +goTo.marker('21'); +verify.quickInfoIs('(method) Underscore.Static.all(list: boolean[], iterator?: Underscore.Iterator, context?: any): boolean'); + +goTo.marker('3'); +verify.quickInfoIs('(var) r3: any'); +goTo.marker('31'); +verify.quickInfoIs('(method) Underscore.Static.all(list: any[], iterator?: Underscore.Iterator, context?: any): any'); + +goTo.marker('4'); +verify.quickInfoIs('(var) r4: any'); +goTo.marker('41'); +verify.quickInfoIs('(method) Underscore.Static.all(list: any[], iterator?: Underscore.Iterator, context?: any): any'); + +verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash/genericTypeArgumentInference2.ts b/tests/cases/fourslash/genericTypeArgumentInference2.ts new file mode 100644 index 00000000000..0ae5114b133 --- /dev/null +++ b/tests/cases/fourslash/genericTypeArgumentInference2.ts @@ -0,0 +1,40 @@ +/// + +////module Underscore { +//// export interface Iterator { +//// (value: T, index: any, list: any): U; +//// } +//// +//// export interface Static { +//// all(list: T[], iterator?: Iterator, context?: any): T; +//// identity(value: T): T; +//// } +////} +//// +////declare var _: Underscore.Static; +////var /*1*/r = _./*11*/all([true, 1, null, 'yes'], _.identity); +////var /*2*/r2 = _./*21*/all([true], _.identity); +////var /*3*/r3 = _./*31*/all([], _.identity); +////var /*4*/r4 = _./*41*/all([true], _.identity); + +goTo.marker('1'); +verify.quickInfoIs('(var) r: {}'); +goTo.marker('11'); +verify.quickInfoIs('(method) Underscore.Static.all<{}>(list: {}[], iterator?: Underscore.Iterator<{}, boolean>, context?: any): {}'); + +goTo.marker('2'); +verify.quickInfoIs('(var) r2: boolean'); +goTo.marker('21'); +verify.quickInfoIs('(method) Underscore.Static.all(list: boolean[], iterator?: Underscore.Iterator, context?: any): boolean'); + +goTo.marker('3'); +verify.quickInfoIs('(var) r3: any'); +goTo.marker('31'); +verify.quickInfoIs('(method) Underscore.Static.all(list: any[], iterator?: Underscore.Iterator, context?: any): any'); + +goTo.marker('4'); +verify.quickInfoIs('(var) r4: any'); +goTo.marker('41'); +verify.quickInfoIs('(method) Underscore.Static.all(list: any[], iterator?: Underscore.Iterator, context?: any): any'); + +verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash_old/genericTypeParamUnrelatedToArguments1.ts b/tests/cases/fourslash/genericTypeParamUnrelatedToArguments1.ts similarity index 58% rename from tests/cases/fourslash_old/genericTypeParamUnrelatedToArguments1.ts rename to tests/cases/fourslash/genericTypeParamUnrelatedToArguments1.ts index e20e9e3b819..f7e2d7d27fb 100644 --- a/tests/cases/fourslash_old/genericTypeParamUnrelatedToArguments1.ts +++ b/tests/cases/fourslash/genericTypeParamUnrelatedToArguments1.ts @@ -11,19 +11,19 @@ ////var f/*6*/6: Foo = new Foo(3); goTo.marker('1'); -verify.quickInfoIs('Foo', null, 'f1'); +verify.quickInfoIs('(var) f1: Foo', null); goTo.marker('2'); -verify.quickInfoIs('Foo', null, 'f2'); +verify.quickInfoIs('(var) f2: Foo', null); goTo.marker('3'); -verify.quickInfoIs('any', null, 'f3'); +verify.quickInfoIs('(var) f3: any', null); goTo.marker('4'); -verify.quickInfoIs('Foo', null, 'f4'); +verify.quickInfoIs('(var) f4: Foo', null); goTo.marker('5'); -verify.quickInfoIs('any', null, 'f5'); +verify.quickInfoIs('(var) f5: any', null); goTo.marker('6'); -verify.quickInfoIs('Foo', null, 'f6'); \ No newline at end of file +verify.quickInfoIs('(var) f6: Foo', null); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericTypeWithMultipleBases1.ts b/tests/cases/fourslash/genericTypeWithMultipleBases1.ts similarity index 54% rename from tests/cases/fourslash_old/genericTypeWithMultipleBases1.ts rename to tests/cases/fourslash/genericTypeWithMultipleBases1.ts index 7812d645dd8..867cea490ef 100644 --- a/tests/cases/fourslash_old/genericTypeWithMultipleBases1.ts +++ b/tests/cases/fourslash/genericTypeWithMultipleBases1.ts @@ -13,6 +13,6 @@ ////x./**/ goTo.marker(); -verify.completionListContains('watch', '() => void'); -verify.completionListContains('moveUp', '() => void'); -verify.completionListContains('family', 'TModel'); \ No newline at end of file +verify.completionListContains('watch', '(property) iBaseScope.watch: () => void'); +verify.completionListContains('moveUp', '(property) iMover.moveUp: () => void'); +verify.completionListContains('family', '(property) iScope.family: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/genericTypeWithMultipleBases1MultiFile.ts b/tests/cases/fourslash/genericTypeWithMultipleBases1MultiFile.ts index a2b32a6f383..6c15a5a5c01 100644 --- a/tests/cases/fourslash/genericTypeWithMultipleBases1MultiFile.ts +++ b/tests/cases/fourslash/genericTypeWithMultipleBases1MultiFile.ts @@ -18,6 +18,6 @@ ////x./**/ goTo.marker(); -verify.completionListContains('watch', '() => void'); -verify.completionListContains('moveUp', '() => void'); -verify.completionListContains('family', 'number'); \ No newline at end of file +verify.completionListContains('watch', '(property) iBaseScope.watch: () => void'); +verify.completionListContains('moveUp', '(property) iMover.moveUp: () => void'); +verify.completionListContains('family', '(property) iScope.family: number'); diff --git a/tests/cases/fourslash/genericWithSpecializedProperties1.ts b/tests/cases/fourslash/genericWithSpecializedProperties1.ts new file mode 100644 index 00000000000..ea6df9a034e --- /dev/null +++ b/tests/cases/fourslash/genericWithSpecializedProperties1.ts @@ -0,0 +1,24 @@ +/// + +////interface Foo { +//// x: Foo; +//// y: Foo; +////} + +////var f: Foo; +////var /*1*/xx = f.x; +////var /*2*/yy = f.y; + +////var f2: Foo; +////var /*3*/x2 = f2.x; +////var /*4*/y2 = f2.y; + +goTo.marker('1'); +verify.quickInfoIs('(var) xx: Foo'); +goTo.marker('2'); +verify.quickInfoIs('(var) yy: Foo'); + +goTo.marker('3'); +verify.quickInfoIs('(var) x2: Foo'); +goTo.marker('4'); +verify.quickInfoIs('(var) y2: Foo'); \ No newline at end of file diff --git a/tests/cases/fourslash/genericWithSpecializedProperties2.ts b/tests/cases/fourslash/genericWithSpecializedProperties2.ts new file mode 100644 index 00000000000..21754c9ec9a --- /dev/null +++ b/tests/cases/fourslash/genericWithSpecializedProperties2.ts @@ -0,0 +1,23 @@ +/// + +////interface Foo { +//// y: Foo; +//// x: Foo; +////} +////var f: Foo; +////var /*1*/x = f.x; +////var /*2*/y = f.y; + +////var f2: Foo; +////var /*3*/x2 = f2.x; +////var /*4*/y2 = f2.y; + +goTo.marker('1'); +verify.quickInfoIs('(var) x: Foo'); +goTo.marker('2'); +verify.quickInfoIs('(var) y: Foo'); + +goTo.marker('3'); +verify.quickInfoIs('(var) x2: Foo'); +goTo.marker('4'); +verify.quickInfoIs('(var) y2: Foo'); \ No newline at end of file diff --git a/tests/cases/fourslash/genericWithSpecializedProperties3.ts b/tests/cases/fourslash/genericWithSpecializedProperties3.ts new file mode 100644 index 00000000000..d5f02813de4 --- /dev/null +++ b/tests/cases/fourslash/genericWithSpecializedProperties3.ts @@ -0,0 +1,24 @@ +/// + +////interface Foo { +//// x: Foo; +//// y: Foo; +////} + +////var f: Foo; +////var /*1*/xx = f.x; +////var /*2*/yy = f.y; + +////var f2: Foo; +////var /*3*/x2 = f2.x; +////var /*4*/y2 = f2.y; + +goTo.marker('1'); +verify.quickInfoIs('(var) xx: Foo'); +goTo.marker('2'); +verify.quickInfoIs('(var) yy: Foo'); + +goTo.marker('3'); +verify.quickInfoIs('(var) x2: Foo'); +goTo.marker('4'); +verify.quickInfoIs('(var) y2: Foo'); \ No newline at end of file diff --git a/tests/cases/fourslash/getCompletionEntryDetails.ts b/tests/cases/fourslash/getCompletionEntryDetails.ts index 23196f3c204..47465464576 100644 --- a/tests/cases/fourslash/getCompletionEntryDetails.ts +++ b/tests/cases/fourslash/getCompletionEntryDetails.ts @@ -17,17 +17,17 @@ verify.completionListContains("ccc"); verify.completionListContains("ddd"); // Checking for completion details before edit should work -verify.completionEntryDetailIs("aaa", "number"); -verify.completionEntryDetailIs("ccc", "number"); +verify.completionEntryDetailIs("aaa", "(var) aaa: number"); +verify.completionEntryDetailIs("ccc", "(var) ccc: number"); // Make an edit edit.insert("a"); edit.backspace(); // Checking for completion details after edit should work too -verify.completionEntryDetailIs("bbb", "string"); -verify.completionEntryDetailIs("ddd", "string"); +verify.completionEntryDetailIs("bbb", "(var) bbb: string"); +verify.completionEntryDetailIs("ddd", "(var) ddd: string"); // Checking for completion details again before edit should work -verify.completionEntryDetailIs("aaa", "number"); -verify.completionEntryDetailIs("ccc", "number"); +verify.completionEntryDetailIs("aaa", "(var) aaa: number"); +verify.completionEntryDetailIs("ccc", "(var) ccc: number"); diff --git a/tests/cases/fourslash/getCompletionEntryDetails2.ts b/tests/cases/fourslash/getCompletionEntryDetails2.ts index 07958aabd8a..b34aad66ba2 100644 --- a/tests/cases/fourslash/getCompletionEntryDetails2.ts +++ b/tests/cases/fourslash/getCompletionEntryDetails2.ts @@ -15,4 +15,4 @@ edit.insert("a"); edit.backspace(); // Checking for completion details after edit should work too -verify.completionEntryDetailIs("x", "number"); +verify.completionEntryDetailIs("x", "(var) Foo.x: number"); diff --git a/tests/cases/fourslash_old/incrementalResolveAccessor.ts b/tests/cases/fourslash/incrementalResolveAccessor.ts similarity index 87% rename from tests/cases/fourslash_old/incrementalResolveAccessor.ts rename to tests/cases/fourslash/incrementalResolveAccessor.ts index 82b1612e014..92c00f353c8 100644 --- a/tests/cases/fourslash_old/incrementalResolveAccessor.ts +++ b/tests/cases/fourslash/incrementalResolveAccessor.ts @@ -16,7 +16,7 @@ diagnostics.setEditValidation(IncrementalEditValidation.None); // Resolve without typeCheck goTo.marker('1'); -verify.quickInfoIs("any"); +verify.quickInfoIs("(var) b: string"); // TypeCheck verify.numberOfErrorsInCurrentFile(3); \ No newline at end of file diff --git a/tests/cases/fourslash/incrementalResolveConstructorDeclaration.ts b/tests/cases/fourslash/incrementalResolveConstructorDeclaration.ts index 01ee2d7c856..fd0c9efd8ab 100644 --- a/tests/cases/fourslash/incrementalResolveConstructorDeclaration.ts +++ b/tests/cases/fourslash/incrementalResolveConstructorDeclaration.ts @@ -13,7 +13,7 @@ diagnostics.setEditValidation(IncrementalEditValidation.None); // Do resolve without typeCheck goTo.marker('1'); -verify.quickInfoIs("c1"); +verify.quickInfoIs("(var) val: c1"); // TypeCheck verify.numberOfErrorsInCurrentFile(1); diff --git a/tests/cases/fourslash/incrementalResolveFunctionPropertyAssignment.ts b/tests/cases/fourslash/incrementalResolveFunctionPropertyAssignment.ts index 2afbac59885..0799279c6e7 100644 --- a/tests/cases/fourslash/incrementalResolveFunctionPropertyAssignment.ts +++ b/tests/cases/fourslash/incrementalResolveFunctionPropertyAssignment.ts @@ -25,7 +25,7 @@ diagnostics.setEditValidation(IncrementalEditValidation.None); // Do resolve without typeCheck goTo.marker('1'); -verify.quickInfoIs("string"); +verify.quickInfoIs("(var) val: string"); // TypeCheck verify.numberOfErrorsInCurrentFile(1); diff --git a/tests/cases/fourslash/indexerReturnTypes1.ts b/tests/cases/fourslash/indexerReturnTypes1.ts new file mode 100644 index 00000000000..f94a1151b13 --- /dev/null +++ b/tests/cases/fourslash/indexerReturnTypes1.ts @@ -0,0 +1,111 @@ +/// + +////interface Numeric { +//// [x: number]: Date; +////} +////} +////interface Stringy { +//// [x: string]: RegExp; +////} +////} +////interface NumericPlus { +//// [x: number]: Date; +//// foo(): Date; +////} +////} +////interface StringyPlus { +//// [x: string]: RegExp; +//// foo(): RegExp; +////} +////} +////interface NumericG { +//// [x: number]: T; +////} +////} +////interface StringyG { +//// [x: string]: T; +////} +////} +////interface Ty { +//// [x: number]: Ty; +////} +////interface Ty2 { +//// [x: number]: { [x: number]: T }; +////} +//// +//// +////} +////var numeric: Numeric; +////var stringy: Stringy; +////var numericPlus: NumericPlus; +////var stringPlus: StringyPlus; +////var numericG: NumericG; +////var stringyG: StringyG; +////var ty: Ty; +////var ty2: Ty2; +//// +////var /*1*/r1 = numeric[1]; +////var /*2*/r2 = numeric['1']; +////var /*3*/r3 = stringy[1]; +////var /*4*/r4 = stringy['1']; +////var /*5*/r5 = numericPlus[1]; +////var /*6*/r6 = numericPlus['1']; +////var /*7*/r7 = stringPlus[1]; +////var /*8*/r8 = stringPlus['1']; +////var /*9*/r9 = numericG[1]; +////var /*10*/r10 = numericG['1']; +////var /*11*/r11 = stringyG[1]; +////var /*12*/r12 = stringyG['1']; +////var /*13*/r13 = ty[1]; +////var /*14*/r14 = ty['1']; +////var /*15*/r15 = ty2[1]; +////var /*16*/r16 = ty2['1']; + + +goTo.marker('1'); +verify.quickInfoIs('(var) r1: Date'); + +goTo.marker('2'); +verify.quickInfoIs('(var) r2: any'); + +goTo.marker('3'); +verify.quickInfoIs('(var) r3: RegExp'); + +goTo.marker('4'); +verify.quickInfoIs('(var) r4: RegExp'); + +goTo.marker('5'); +verify.quickInfoIs('(var) r5: Date'); + +goTo.marker('6'); +verify.quickInfoIs('(var) r6: any'); + +goTo.marker('7'); +verify.quickInfoIs('(var) r7: RegExp'); + +goTo.marker('8'); +verify.quickInfoIs('(var) r8: RegExp'); + +goTo.marker('9'); +verify.quickInfoIs('(var) r9: Date'); + +goTo.marker('10'); +verify.quickInfoIs('(var) r10: any'); + +goTo.marker('11'); +verify.quickInfoIs('(var) r11: Date'); + +goTo.marker('12'); +verify.quickInfoIs('(var) r12: Date'); + +goTo.marker('13'); +verify.quickInfoIs('(var) r13: Ty'); + +goTo.marker('14'); +verify.quickInfoIs('(var) r14: any'); + +goTo.marker('15'); +verify.quickInfoIs('(var) r15: {\n [x: number]: Date;\n}'); + +goTo.marker('16'); +verify.quickInfoIs('(var) r16: any'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/instanceTypesForGenericType1.ts b/tests/cases/fourslash/instanceTypesForGenericType1.ts similarity index 62% rename from tests/cases/fourslash_old/instanceTypesForGenericType1.ts rename to tests/cases/fourslash/instanceTypesForGenericType1.ts index b691993436c..96ee175383e 100644 --- a/tests/cases/fourslash_old/instanceTypesForGenericType1.ts +++ b/tests/cases/fourslash/instanceTypesForGenericType1.ts @@ -3,12 +3,12 @@ ////class G { // Introduce type parameter T //// self: G; // Use T as type argument to form instance type //// f() { -//// this.self/*1*/ = /*2*/this; // self and this are both of type G +//// this./*1*/self = /*2*/this; // self and this are both of type G //// } ////} goTo.marker('1'); -verify.quickInfoIs('G'); +verify.quickInfoIs('(property) G.self: G'); goTo.marker('2'); -verify.quickInfoIs('G'); \ No newline at end of file +verify.quickInfoIs('class G'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/intellisenseInObjectLiteral.ts b/tests/cases/fourslash/intellisenseInObjectLiteral.ts similarity index 60% rename from tests/cases/fourslash_old/intellisenseInObjectLiteral.ts rename to tests/cases/fourslash/intellisenseInObjectLiteral.ts index e2a605a2d08..f3a5cacefb6 100644 --- a/tests/cases/fourslash_old/intellisenseInObjectLiteral.ts +++ b/tests/cases/fourslash/intellisenseInObjectLiteral.ts @@ -4,9 +4,9 @@ //// //// class Foo { //// static something() { -//// return { "prop": x/**/ }; +//// return { "prop": /**/x }; //// } //// } goTo.marker(); -verify.quickInfoIs("number", "", "x"); \ No newline at end of file +verify.quickInfoIs("(var) x: number", ""); \ No newline at end of file diff --git a/tests/cases/fourslash/localFunction.ts b/tests/cases/fourslash/localFunction.ts new file mode 100644 index 00000000000..d0227c83a8c --- /dev/null +++ b/tests/cases/fourslash/localFunction.ts @@ -0,0 +1,20 @@ +/// + +////function /*1*/foo() { +//// function /*2*/bar2() { +//// } +//// var y = function /*3*/bar3() { +//// } +////} +////var x = function /*4*/bar4() { +////} + +goTo.marker("1"); +verify.quickInfoIs('(function) foo(): void'); +goTo.marker("2"); +debugger; +verify.quickInfoIs('(local function) bar2(): void'); +goTo.marker("3"); +verify.quickInfoIs('(local function) bar3(): void'); +goTo.marker("4"); +verify.quickInfoIs('(local function) bar4(): void'); diff --git a/tests/cases/fourslash/memberCompletionOnTypeParameters.ts b/tests/cases/fourslash/memberCompletionOnTypeParameters.ts index 7b415c4b3ed..6092e1e280a 100644 --- a/tests/cases/fourslash/memberCompletionOnTypeParameters.ts +++ b/tests/cases/fourslash/memberCompletionOnTypeParameters.ts @@ -17,17 +17,17 @@ goTo.marker("S"); verify.memberListIsEmpty(); goTo.marker("T"); -verify.memberListContains("x", "number"); -verify.memberListContains("y", "string"); +verify.memberListContains("x", "(property) IFoo.x: number"); +verify.memberListContains("y", "(property) IFoo.y: string"); verify.memberListCount(2); goTo.marker("U"); -verify.memberListContains("toString", "() => string"); +verify.memberListContains("toString", "(method) Object.toString(): string"); verify.memberListCount(7); // constructor, toString, toLocaleString, valueOf, hasOwnProperty, isPrototypeOf, propertyIsEnumerable goTo.marker("V"); -verify.memberListContains("x", "number"); -verify.memberListContains("y", "string"); +verify.memberListContains("x", "(property) IFoo.x: number"); +verify.memberListContains("y", "(property) IFoo.y: string"); verify.memberListCount(2); diff --git a/tests/cases/fourslash/memberListInReopenedEnum.ts b/tests/cases/fourslash/memberListInReopenedEnum.ts index ede924b678f..5101cb46f89 100644 --- a/tests/cases/fourslash/memberListInReopenedEnum.ts +++ b/tests/cases/fourslash/memberListInReopenedEnum.ts @@ -12,7 +12,7 @@ goTo.marker('1'); -verify.memberListContains('A', 'E', undefined, "E.A"); -verify.memberListContains('B', 'E', undefined, "E.B"); -verify.memberListContains('C', 'E', undefined, "E.C"); -verify.memberListContains('D', 'E', undefined, "E.D"); \ No newline at end of file +verify.memberListContains('A', '(enum member) E.A = 0'); +verify.memberListContains('B', '(enum member) E.B = 1'); +verify.memberListContains('C', '(enum member) E.C = 0'); +verify.memberListContains('D', '(enum member) E.D = 1'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListInsideObjectLiterals.ts b/tests/cases/fourslash/memberListInsideObjectLiterals.ts index 51da70ebc56..6da0ac5b562 100644 --- a/tests/cases/fourslash/memberListInsideObjectLiterals.ts +++ b/tests/cases/fourslash/memberListInsideObjectLiterals.ts @@ -26,16 +26,16 @@ // Literal member completion inside empty literal. goTo.marker("1"); -verify.memberListContains("x1", "number"); -verify.memberListContains("y1", "number"); +verify.memberListContains("x1", "(property) MyPoint.x1: number"); +verify.memberListContains("y1", "(property) MyPoint.y1: number"); // Literal member completion for 2nd member name. goTo.marker("2"); -verify.memberListContains("y1", "number"); +verify.memberListContains("y1", "(property) MyPoint.y1: number"); // Literal member completion at existing member name location. goTo.marker("3"); -verify.memberListContains("y1", "number"); +verify.memberListContains("y1", "(property) MyPoint.y1: number"); goTo.marker("4"); -verify.memberListContains("x1", "number"); \ No newline at end of file +verify.memberListContains("x1", "(property) MyPoint.x1: number"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfClass.ts b/tests/cases/fourslash/memberListOfClass.ts index 567dfc0ddcd..c12e781a852 100644 --- a/tests/cases/fourslash/memberListOfClass.ts +++ b/tests/cases/fourslash/memberListOfClass.ts @@ -11,5 +11,5 @@ goTo.marker(); verify.memberListCount(2); -verify.memberListContains('pubMeth', '() => void'); -verify.memberListContains('pubProp', 'number'); \ No newline at end of file +verify.memberListContains('pubMeth', '(method) C1.pubMeth(): void'); +verify.memberListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfExportedClass.ts b/tests/cases/fourslash/memberListOfExportedClass.ts index a564504e7ef..eaebab14f27 100644 --- a/tests/cases/fourslash/memberListOfExportedClass.ts +++ b/tests/cases/fourslash/memberListOfExportedClass.ts @@ -12,4 +12,4 @@ goTo.marker(); verify.memberListCount(1); -verify.memberListContains('pub', 'number'); \ No newline at end of file +verify.memberListContains('pub', '(property) M.C.pub: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfModuleAfterInvalidCharater.ts b/tests/cases/fourslash/memberListOfModuleAfterInvalidCharater.ts index 88b7c0a5d9d..a571c519c0f 100644 --- a/tests/cases/fourslash/memberListOfModuleAfterInvalidCharater.ts +++ b/tests/cases/fourslash/memberListOfModuleAfterInvalidCharater.ts @@ -7,4 +7,4 @@ ////testModule./**/ goTo.marker(); -verify.completionListContains('foo', 'number'); \ No newline at end of file +verify.completionListContains('foo', '(var) testModule.foo: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfModuleInAnotherModule.ts b/tests/cases/fourslash/memberListOfModuleInAnotherModule.ts new file mode 100644 index 00000000000..96044ffcc8a --- /dev/null +++ b/tests/cases/fourslash/memberListOfModuleInAnotherModule.ts @@ -0,0 +1,37 @@ +/// + +////module mod1 { +//// var mX = 1; +//// function mFunc() { } +//// class mClass { } +//// module mMod { } +//// interface mInt {} +//// export var meX = 1; +//// export function meFunc() { } +//// export class meClass { } +//// export module meMod { export var iMex = 1; } +//// export interface meInt {} +////} +//// +////module frmConfirm { +//// import Mod1 = mod1; +//// import iMod1 = mod1./*1*/meMod; +//// Mod1./*2*/meX = 1; +//// iMod1./*3*/iMex = 1; +////} + +goTo.marker('1'); +verify.completionListContains('meX', '(var) mod1.meX: number'); +verify.completionListContains('meFunc', '(function) mod1.meFunc(): void'); +verify.completionListContains('meClass', 'class mod1.meClass'); +verify.completionListContains('meMod', 'module mod1.meMod'); +verify.completionListContains('meInt', 'interface mod1.meInt'); + +goTo.marker('2'); +verify.completionListContains('meX', '(var) mod1.meX: number'); +verify.completionListContains('meFunc', '(function) mod1.meFunc(): void'); +verify.completionListContains('meClass', 'class mod1.meClass'); +verify.completionListContains('meMod', 'module mod1.meMod'); + +goTo.marker('3'); +verify.completionListContains('iMex', '(var) mod1.meMod.iMex: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts b/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts index 6df5b555778..15686b4f7b8 100644 --- a/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts +++ b/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts @@ -8,6 +8,6 @@ ////} goTo.marker(); -verify.memberListContains('privMeth', '() => void'); -verify.memberListContains('pubMeth', '() => void'); -verify.memberListContains('pubProp', 'number'); \ No newline at end of file +verify.memberListContains('privMeth', '(method) C1.privMeth(): void'); +verify.memberListContains('pubMeth', '(method) C1.pubMeth(): void'); +verify.memberListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/mergedDeclarationsWithExportAssignment1.ts b/tests/cases/fourslash/mergedDeclarationsWithExportAssignment1.ts similarity index 70% rename from tests/cases/fourslash_old/mergedDeclarationsWithExportAssignment1.ts rename to tests/cases/fourslash/mergedDeclarationsWithExportAssignment1.ts index f04a1e63c8a..be5376d5de5 100644 --- a/tests/cases/fourslash_old/mergedDeclarationsWithExportAssignment1.ts +++ b/tests/cases/fourslash/mergedDeclarationsWithExportAssignment1.ts @@ -11,25 +11,25 @@ // @Filename: mergedDeclarationsWithExportAssignment1_file1.ts /////// -////import Foo/*1*/ = require('mergedDeclarationsWithExportAssignment1_file0'); -////var z/*3*/ = new /*2*/Foo(); -////var r2/*5*/ = Foo./*4*/x; +////import /*1*/Foo = require('mergedDeclarationsWithExportAssignment1_file0'); +////var /*3*/z = new /*2*/Foo(); +////var /*5*/r2 = Foo./*4*/x; // this line triggers a semantic/syntactic error check, remove line when 788570 is fixed edit.insert(''); goTo.marker('1'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(alias) Foo'); goTo.marker('2'); verify.completionListContains('Foo'); goTo.marker('3'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) z: Foo'); goTo.marker('4'); verify.completionListContains('x'); goTo.marker('5'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(var) r2: number'); diff --git a/tests/cases/fourslash_old/missingMethodAfterEditAfterImport.ts b/tests/cases/fourslash/missingMethodAfterEditAfterImport.ts similarity index 79% rename from tests/cases/fourslash_old/missingMethodAfterEditAfterImport.ts rename to tests/cases/fourslash/missingMethodAfterEditAfterImport.ts index afa90de8d86..442ea89f0a3 100644 --- a/tests/cases/fourslash_old/missingMethodAfterEditAfterImport.ts +++ b/tests/cases/fourslash/missingMethodAfterEditAfterImport.ts @@ -10,7 +10,7 @@ // Sanity check goTo.marker('foo'); -verify.quickInfoSymbolNameIs('foo'); +verify.quickInfoIs('module foo'); // Delete some code goTo.marker('delete'); @@ -18,4 +18,4 @@ edit.deleteAtCaret('var x;'.length); // Pull on the RHS of an import goTo.marker('foo'); -verify.quickInfoSymbolNameIs('foo'); +verify.quickInfoIs('module foo'); diff --git a/tests/cases/fourslash/moduleMembersOfGenericType.ts b/tests/cases/fourslash/moduleMembersOfGenericType.ts index 40085bbe1f7..57c08c90066 100644 --- a/tests/cases/fourslash/moduleMembersOfGenericType.ts +++ b/tests/cases/fourslash/moduleMembersOfGenericType.ts @@ -6,4 +6,4 @@ ////var r = M./**/; goTo.marker(); -verify.completionListContains('x', '(x: T) => T'); \ No newline at end of file +verify.completionListContains('x', '(var) M.x: (x: T) => T'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/moduleVariables.ts b/tests/cases/fourslash/moduleVariables.ts similarity index 63% rename from tests/cases/fourslash_old/moduleVariables.ts rename to tests/cases/fourslash/moduleVariables.ts index d7cf32fff63..d949bf677b1 100644 --- a/tests/cases/fourslash_old/moduleVariables.ts +++ b/tests/cases/fourslash/moduleVariables.ts @@ -14,10 +14,10 @@ ////} goTo.marker('1'); -verify.quickInfoIs("number", undefined, "M.x", "var"); +verify.quickInfoIs("(var) M.x: number", undefined); goTo.marker('2'); -verify.quickInfoIs("number", undefined, "M.x", "var"); +verify.quickInfoIs("(var) M.x: number", undefined); goTo.marker('3'); -verify.quickInfoIs("number", undefined, "x", "var"); \ No newline at end of file +verify.quickInfoIs("(var) x: number", undefined); \ No newline at end of file diff --git a/tests/cases/fourslash_old/multiModuleFundule1.ts b/tests/cases/fourslash/multiModuleFundule1.ts similarity index 73% rename from tests/cases/fourslash_old/multiModuleFundule1.ts rename to tests/cases/fourslash/multiModuleFundule1.ts index 44d06c08271..50acd8b495d 100644 --- a/tests/cases/fourslash_old/multiModuleFundule1.ts +++ b/tests/cases/fourslash/multiModuleFundule1.ts @@ -9,8 +9,8 @@ //// export function foo() { } ////} //// -////var r/*2*/ = C(/*1*/ -////var r2/*4*/ = new C(/*3*/ // using void returning function as constructor +////var /*2*/r = C(/*1*/ +////var /*4*/r2 = new C(/*3*/ // using void returning function as constructor ////var r3 = C./*5*/ goTo.marker('1'); @@ -18,14 +18,14 @@ verify.completionListContains('C'); edit.insert('C.x);'); goTo.marker('2'); -verify.quickInfoIs('void'); +verify.quickInfoIs('(var) r: void'); goTo.marker('3'); verify.completionListContains('C'); edit.insert('C.x);'); goTo.marker('4'); -verify.quickInfoIs('any'); +verify.quickInfoIs('(var) r2: any'); goTo.marker('5'); verify.completionListContains('x'); diff --git a/tests/cases/fourslash_old/nameOfRetypedClassInModule.ts b/tests/cases/fourslash/nameOfRetypedClassInModule.ts similarity index 50% rename from tests/cases/fourslash_old/nameOfRetypedClassInModule.ts rename to tests/cases/fourslash/nameOfRetypedClassInModule.ts index 44c97a40aab..4faddd2b686 100644 --- a/tests/cases/fourslash_old/nameOfRetypedClassInModule.ts +++ b/tests/cases/fourslash/nameOfRetypedClassInModule.ts @@ -6,27 +6,27 @@ //// module M { //// /*A*/class A {} //// /*B*/export class B {} -//// class Check { constructor/*check*/(val) {} } -//// export class Check2 { constructor/*check2*/(val) {} } +//// class Check { /*check*/constructor(val) {} } +//// export class Check2 { /*check2*/constructor(val) {} } //// } //// edit.disableFormatting(); goTo.marker('check'); -verify.quickInfoSymbolNameIs('Check'); +verify.quickInfoIs('(constructor) Check(val: any): Check'); goTo.marker('check2'); -verify.quickInfoSymbolNameIs('M.Check2'); +verify.quickInfoIs('(constructor) M.Check2(val: any): Check2'); goTo.marker('A'); edit.deleteAtCaret('class A {}'.length); edit.insert('class A { constructor(val) {} }'); -edit.moveLeft('(val) {} }'.length); -verify.quickInfoSymbolNameIs('A'); +edit.moveLeft('constructor(val) {} }'.length); +verify.quickInfoIs('(constructor) A(val: any): A'); goTo.marker('B'); edit.deleteAtCaret('export class B {}'.length); edit.insert('export class B { constructor(val) {} }'); -edit.moveLeft('(val) {} }'.length); -verify.quickInfoSymbolNameIs('M.B'); +edit.moveLeft('constructor(val) {} }'.length); +verify.quickInfoIs('(constructor) M.B(val: any): B'); diff --git a/tests/cases/fourslash/noTypeParameterInLHS.ts b/tests/cases/fourslash/noTypeParameterInLHS.ts new file mode 100644 index 00000000000..729532a6699 --- /dev/null +++ b/tests/cases/fourslash/noTypeParameterInLHS.ts @@ -0,0 +1,11 @@ +/// + +////interface I { } +////class C {} +////var /*1*/i: I; +////var /*2*/c: C; + +goTo.marker('1'); +verify.quickInfoIs('(var) i: I'); +goTo.marker('2'); +verify.quickInfoIs('(var) c: C'); diff --git a/tests/cases/fourslash/numericPropertyNames.ts b/tests/cases/fourslash/numericPropertyNames.ts new file mode 100644 index 00000000000..58130856074 --- /dev/null +++ b/tests/cases/fourslash/numericPropertyNames.ts @@ -0,0 +1,6 @@ +/// + +////var /**/t2 = { 0: 1, 1: "" }; + +goTo.marker(); +verify.quickInfoIs('(var) t2: {\n 0: number;\n 1: string;\n}'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/objectLiteralCallSignatures.ts b/tests/cases/fourslash/objectLiteralCallSignatures.ts similarity index 60% rename from tests/cases/fourslash_old/objectLiteralCallSignatures.ts rename to tests/cases/fourslash/objectLiteralCallSignatures.ts index 9520ac83e3a..d1bc9195086 100644 --- a/tests/cases/fourslash_old/objectLiteralCallSignatures.ts +++ b/tests/cases/fourslash/objectLiteralCallSignatures.ts @@ -1,6 +1,6 @@ /// -////var x/*1*/: { +////var /*1*/x: { //// func1(x: number): number; // Method signature //// func2: (x: number) => number; // Function type literal //// func3: { (x: number): number }; // Object type literal @@ -8,7 +8,7 @@ //// ////x.func1 = x.func2 = x.func3; //// -////var y/*2*/: { +////var /*2*/y: { //// func4(x: number): number; //// func4(s: string): string; //// func5: { @@ -22,8 +22,8 @@ verify.not.errorExistsAfterMarker('1'); goTo.marker('1'); -verify.quickInfoIs('{ func1(x: number): number; func2: (x: number) => number; func3: (x: number) => number; }'); +verify.quickInfoIs('(var) x: {\n func1(x: number): number;\n func2: (x: number) => number;\n func3: (x: number) => number;\n}'); goTo.marker('2'); -verify.quickInfoIs('{ func4(x: number): number; func4(s: string): string; func5: { (x: number): number; (s: string): string; }; }'); +verify.quickInfoIs('(var) y: {\n func4(x: number): number;\n func4(s: string): string;\n func5: {\n (x: number): number;\n (s: string): string;\n };\n}'); diff --git a/tests/cases/fourslash/overloadOnConstCallSignature.ts b/tests/cases/fourslash/overloadOnConstCallSignature.ts index 757e96f162b..52e0f3c02e0 100644 --- a/tests/cases/fourslash/overloadOnConstCallSignature.ts +++ b/tests/cases/fourslash/overloadOnConstCallSignature.ts @@ -7,12 +7,12 @@ //// (name: 'done'): string; ////} -////var x/*2*/ = foo(/*1*/ +////var /*2*/x = foo(/*1*/ goTo.marker('1'); verify.signatureHelpCountIs(4); verify.currentSignatureHelpIs('foo(name: string): string'); edit.insert('"hi"'); -//goTo.marker('2'); -//verify.quickInfoIs('string'); \ No newline at end of file +goTo.marker('2'); +verify.quickInfoIs('(var) x: string'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/overloadQuickInfo.ts b/tests/cases/fourslash/overloadQuickInfo.ts similarity index 90% rename from tests/cases/fourslash_old/overloadQuickInfo.ts rename to tests/cases/fourslash/overloadQuickInfo.ts index 7d366c849f7..41cba67b391 100644 --- a/tests/cases/fourslash_old/overloadQuickInfo.ts +++ b/tests/cases/fourslash/overloadQuickInfo.ts @@ -18,6 +18,6 @@ ////Fo/**/o(); goTo.marker(); -verify.quickInfoIs("(): any (+ 12 overload(s))", "", "Foo", "function"); +verify.quickInfoIs("(function) Foo(): any (+12 overloads)"); diff --git a/tests/cases/fourslash_old/promiseTyping1.ts b/tests/cases/fourslash/promiseTyping1.ts similarity index 84% rename from tests/cases/fourslash_old/promiseTyping1.ts rename to tests/cases/fourslash/promiseTyping1.ts index 56e62d83893..9a79c0eb7a9 100644 --- a/tests/cases/fourslash_old/promiseTyping1.ts +++ b/tests/cases/fourslash/promiseTyping1.ts @@ -15,10 +15,10 @@ //// } ); goTo.marker("1"); -verify.quickInfoIs('IPromise'); +verify.quickInfoIs('(var) p2: IPromise'); goTo.marker("2"); -verify.quickInfoIs('string'); +verify.quickInfoIs('(parameter) xx: string'); goTo.marker("3"); -verify.quickInfoIs('string'); +verify.quickInfoIs('(parameter) xx: string'); diff --git a/tests/cases/fourslash_old/promiseTyping2.ts b/tests/cases/fourslash/promiseTyping2.ts similarity index 74% rename from tests/cases/fourslash_old/promiseTyping2.ts rename to tests/cases/fourslash/promiseTyping2.ts index 9f888423ec7..e4e80395199 100644 --- a/tests/cases/fourslash_old/promiseTyping2.ts +++ b/tests/cases/fourslash/promiseTyping2.ts @@ -16,22 +16,22 @@ goTo.marker("1"); -verify.quickInfoIs('IPromise'); +verify.quickInfoIs('(var) p1: IPromise'); goTo.marker("2"); -verify.quickInfoIs('number'); +verify.quickInfoIs('(parameter) xx: number'); goTo.marker("3"); -verify.quickInfoIs('IPromise'); +verify.quickInfoIs('(var) p2: IPromise'); goTo.marker("4"); -verify.quickInfoIs('number'); +verify.quickInfoIs('(parameter) xx: number'); goTo.marker("5"); -verify.quickInfoIs('IPromise'); +verify.quickInfoIs('(var) p3: IPromise'); goTo.marker("6"); -verify.quickInfoIs('string'); +verify.quickInfoIs('(parameter) xx: string'); goTo.marker("7"); -verify.quickInfoIs('string'); \ No newline at end of file +verify.quickInfoIs('(parameter) xx: string'); \ No newline at end of file diff --git a/tests/cases/fourslash/proto.ts b/tests/cases/fourslash/proto.ts new file mode 100644 index 00000000000..73f23dea64f --- /dev/null +++ b/tests/cases/fourslash/proto.ts @@ -0,0 +1,20 @@ +/// + +////module M { +//// export interface /*1*/__proto__ {} +////} +////var /*2*/__proto__: M.__proto__; +/////*3*/ +////var /*4*/fun: (__proto__: any) => boolean; + +goTo.marker('1'); +verify.quickInfoIs("interface M.__proto__", ""); +goTo.marker('2'); +verify.quickInfoIs("(var) __proto__: M.__proto__", ""); +goTo.marker('3'); +//verify.completionListContains("__proto__", "(var) __proto__: M.__proto__", ""); +edit.insert("__proto__"); +//goTo.definition(); +//verify.caretAtMarker('2'); +goTo.marker('4'); +verify.quickInfoIs("(var) fun: (__proto__: any) => boolean", ""); \ No newline at end of file diff --git a/tests/cases/fourslash/prototypeProperty.ts b/tests/cases/fourslash/prototypeProperty.ts new file mode 100644 index 00000000000..d4f9390c205 --- /dev/null +++ b/tests/cases/fourslash/prototypeProperty.ts @@ -0,0 +1,11 @@ +/// + +////class A {} +////A./*1*/prototype; +////A./*2*/ + +goTo.marker('1'); +verify.quickInfoIs('(property) A.prototype: A'); + +goTo.marker('2'); +verify.completionListContains('prototype', '(property) A.prototype: A'); diff --git a/tests/cases/fourslash_old/qualifiedName_import-declaration-with-variable-entity-names.ts b/tests/cases/fourslash/qualifiedName_import-declaration-with-variable-entity-names.ts similarity index 91% rename from tests/cases/fourslash_old/qualifiedName_import-declaration-with-variable-entity-names.ts rename to tests/cases/fourslash/qualifiedName_import-declaration-with-variable-entity-names.ts index 7148cd10619..fa57a17f98a 100644 --- a/tests/cases/fourslash_old/qualifiedName_import-declaration-with-variable-entity-names.ts +++ b/tests/cases/fourslash/qualifiedName_import-declaration-with-variable-entity-names.ts @@ -11,7 +11,7 @@ ////var x = Alpha.[|{| "name" : "mem" |}x|] goTo.marker('import'); -verify.completionListContains('x', 'number'); +verify.completionListContains('x', '(var) Alpha.x: number'); var def: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "def")[0]; var imp: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "import")[0]; diff --git a/tests/cases/fourslash_old/quickInfoExportAssignmentOfGenericInterface.ts b/tests/cases/fourslash/quickInfoExportAssignmentOfGenericInterface.ts similarity index 85% rename from tests/cases/fourslash_old/quickInfoExportAssignmentOfGenericInterface.ts rename to tests/cases/fourslash/quickInfoExportAssignmentOfGenericInterface.ts index 1dce46ce0c7..7a3b3b9d603 100644 --- a/tests/cases/fourslash_old/quickInfoExportAssignmentOfGenericInterface.ts +++ b/tests/cases/fourslash/quickInfoExportAssignmentOfGenericInterface.ts @@ -13,4 +13,4 @@ goTo.file("quickInfoExportAssignmentOfGenericInterface_1.ts"); goTo.marker('1'); -verify.quickInfoIs("a>", undefined, "x", "var"); \ No newline at end of file +verify.quickInfoIs("(var) x: a>", undefined); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoForAliasedGeneric.ts b/tests/cases/fourslash/quickInfoForAliasedGeneric.ts similarity index 59% rename from tests/cases/fourslash_old/quickInfoForAliasedGeneric.ts rename to tests/cases/fourslash/quickInfoForAliasedGeneric.ts index 4e4849b978d..30b8a16ba89 100644 --- a/tests/cases/fourslash_old/quickInfoForAliasedGeneric.ts +++ b/tests/cases/fourslash/quickInfoForAliasedGeneric.ts @@ -7,11 +7,11 @@ //// } ////} ////import d = M.N; -////var aa/*1*/: d.C; -////var bb/*2*/: d.D; +////var /*1*/aa: d.C; +////var /*2*/bb: d.D; goTo.marker('1'); -verify.quickInfoIs('M.N.C'); +verify.quickInfoIs('(var) aa: d.C'); goTo.marker('2'); -verify.quickInfoIs('M.N.D'); \ No newline at end of file +verify.quickInfoIs('(var) bb: d.D'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoForContextuallyTypedFunctionInReturnStatement.ts b/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInReturnStatement.ts similarity index 86% rename from tests/cases/fourslash_old/quickInfoForContextuallyTypedFunctionInReturnStatement.ts rename to tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInReturnStatement.ts index e4f5003ad04..5075829f7a1 100644 --- a/tests/cases/fourslash_old/quickInfoForContextuallyTypedFunctionInReturnStatement.ts +++ b/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInReturnStatement.ts @@ -17,4 +17,4 @@ goTo.marker(); -verify.quickInfoIs("number"); +verify.quickInfoIs("(parameter) value: number"); diff --git a/tests/cases/fourslash_old/quickInfoForDerivedGenericTypeWithConstructor.ts b/tests/cases/fourslash/quickInfoForDerivedGenericTypeWithConstructor.ts similarity index 62% rename from tests/cases/fourslash_old/quickInfoForDerivedGenericTypeWithConstructor.ts rename to tests/cases/fourslash/quickInfoForDerivedGenericTypeWithConstructor.ts index 61f55eba772..34274a9c643 100644 --- a/tests/cases/fourslash_old/quickInfoForDerivedGenericTypeWithConstructor.ts +++ b/tests/cases/fourslash/quickInfoForDerivedGenericTypeWithConstructor.ts @@ -10,12 +10,11 @@ ////class B2 extends A { //// bar() { } ////} - -////var b/*1*/: B; -////var b2/*2*/: B; +////var /*1*/b: B; +////var /*2*/b2: B; goTo.marker('1'); -verify.quickInfoIs('B'); +verify.quickInfoIs('(var) b: B'); goTo.marker('2'); -verify.quickInfoIs('B'); \ No newline at end of file +verify.quickInfoIs('(var) b2: B'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoForFunctionDeclaration.ts b/tests/cases/fourslash/quickInfoForFunctionDeclaration.ts similarity index 56% rename from tests/cases/fourslash_old/quickInfoForFunctionDeclaration.ts rename to tests/cases/fourslash/quickInfoForFunctionDeclaration.ts index 3e0d7a6c460..525959adc9a 100644 --- a/tests/cases/fourslash_old/quickInfoForFunctionDeclaration.ts +++ b/tests/cases/fourslash/quickInfoForFunctionDeclaration.ts @@ -4,17 +4,15 @@ //// ////function ma/*makeA*/keA(t: T): A { return null; } //// -////function f/*f*/(t: T) { +////function /*f*/f(t: T) { //// return makeA(t); ////} //// ////var x = f(0); ////var y = makeA(0); - - goTo.marker("makeA"); -verify.quickInfoIs("(t: T): A", undefined, "makeA", "function"); +verify.quickInfoIs("(function) makeA(t: T): A", undefined); goTo.marker("f"); -verify.quickInfoIs("(t: T): A", undefined, "f", "function"); +verify.quickInfoIs("(function) f(t: T): A", undefined); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoForGenericConstraints1.ts b/tests/cases/fourslash/quickInfoForGenericConstraints1.ts similarity index 73% rename from tests/cases/fourslash_old/quickInfoForGenericConstraints1.ts rename to tests/cases/fourslash/quickInfoForGenericConstraints1.ts index 589b56033e9..86571f2be7c 100644 --- a/tests/cases/fourslash_old/quickInfoForGenericConstraints1.ts +++ b/tests/cases/fourslash/quickInfoForGenericConstraints1.ts @@ -4,4 +4,4 @@ ////function foo4(test: any): any { return null; } goTo.marker(); -verify.quickInfoIs('T extends Date'); \ No newline at end of file +verify.quickInfoIs('(parameter) test: T extends Date'); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoForGenericPrototypeMember.ts b/tests/cases/fourslash/quickInfoForGenericPrototypeMember.ts new file mode 100644 index 00000000000..895a897452d --- /dev/null +++ b/tests/cases/fourslash/quickInfoForGenericPrototypeMember.ts @@ -0,0 +1,13 @@ +/// + +////class C { +//// foo(x: T) { } +////} +////var x = new /*1*/C(); +////var y = C.proto/*2*/type; + +goTo.marker('1'); +verify.quickInfoIs('(constructor) C(): C'); + +goTo.marker('2'); +verify.quickInfoIs('(property) C.prototype: C'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoForIndexerResultWithConstraint.ts b/tests/cases/fourslash/quickInfoForIndexerResultWithConstraint.ts similarity index 62% rename from tests/cases/fourslash_old/quickInfoForIndexerResultWithConstraint.ts rename to tests/cases/fourslash/quickInfoForIndexerResultWithConstraint.ts index e0f6c8ca89a..31e58f51152 100644 --- a/tests/cases/fourslash_old/quickInfoForIndexerResultWithConstraint.ts +++ b/tests/cases/fourslash/quickInfoForIndexerResultWithConstraint.ts @@ -6,8 +6,8 @@ ////function other2(arg: T) { //// var b: { [x: string]: T }; -//// var r2/*1*/ = foo(b); // just shows T +//// var /*1*/r2 = foo(b); // just shows T ////} goTo.marker('1'); -verify.quickInfoIs('{ [x: string]: T; }'); \ No newline at end of file +verify.quickInfoIs('(local var) r2: {\n [x: string]: T;\n}'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoForOverloadOnConst1.ts b/tests/cases/fourslash/quickInfoForOverloadOnConst1.ts similarity index 51% rename from tests/cases/fourslash_old/quickInfoForOverloadOnConst1.ts rename to tests/cases/fourslash/quickInfoForOverloadOnConst1.ts index 9d91eee2184..f2ee37aa675 100644 --- a/tests/cases/fourslash_old/quickInfoForOverloadOnConst1.ts +++ b/tests/cases/fourslash/quickInfoForOverloadOnConst1.ts @@ -20,22 +20,22 @@ ////c.x1(1, (x/*10*/x) => { return 1; } ); goTo.marker('1'); -verify.quickInfoIs("(a: number, callback: (x: 'hi') => number): any"); +verify.quickInfoIs("(method) I.x1(a: number, callback: (x: 'hi') => number): any"); goTo.marker('2'); -verify.quickInfoIs("(a: number, callback: (x: 'hi') => number): any (+ 0 overload(s))"); +verify.quickInfoIs("(method) C.x1(a: number, callback: (x: 'hi') => number): any"); goTo.marker('3'); -verify.quickInfoIs("(x: 'hi') => number"); +verify.quickInfoIs("(parameter) callback: (x: 'hi') => number"); goTo.marker('4'); -verify.quickInfoIs("(a: number, callback: (x: 'hi') => number): any (+ 0 overload(s))"); +verify.quickInfoIs("(method) C.x1(a: number, callback: (x: 'hi') => number): any"); goTo.marker('5'); -verify.quickInfoIs('(x: string) => number'); +verify.quickInfoIs('(parameter) callback: (x: string) => number'); goTo.marker('6'); -verify.quickInfoIs('(x: string): number'); +verify.quickInfoIs('(parameter) callback: (x: string) => number'); goTo.marker('7'); -verify.quickInfoIs("(a: number, callback: (x: 'hi') => number): any (+ 0 overload(s))"); +verify.quickInfoIs("(method) C.x1(a: number, callback: (x: 'hi') => number): any"); goTo.marker('8'); -verify.quickInfoIs("'hi'"); +verify.quickInfoIs("(parameter) xx: 'hi'"); goTo.marker('9'); -verify.quickInfoIs("'bye'"); +verify.quickInfoIs("(parameter) xx: 'bye'"); goTo.marker('10'); -verify.quickInfoIs("'hi'"); \ No newline at end of file +verify.quickInfoIs("(parameter) xx: 'hi'"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoForTypeofParameter.ts b/tests/cases/fourslash/quickInfoForTypeofParameter.ts similarity index 50% rename from tests/cases/fourslash_old/quickInfoForTypeofParameter.ts rename to tests/cases/fourslash/quickInfoForTypeofParameter.ts index 794fdbe8144..1d96ae9ee96 100644 --- a/tests/cases/fourslash_old/quickInfoForTypeofParameter.ts +++ b/tests/cases/fourslash/quickInfoForTypeofParameter.ts @@ -6,10 +6,10 @@ ////} goTo.marker('ref2'); -verify.quickInfoIs("string", undefined, "y1", "local var"); +verify.quickInfoIs("(local var) y1: string", undefined); goTo.marker('ref1'); -verify.quickInfoIs("string", undefined, "y1", "local var"); +verify.quickInfoIs("(local var) y1: string", undefined); goTo.marker('ref2'); -verify.quickInfoIs("string", undefined, "y1", "local var"); +verify.quickInfoIs("(local var) y1: string", undefined); diff --git a/tests/cases/fourslash/quickInfoFromEmptyBlockComment.ts b/tests/cases/fourslash/quickInfoFromEmptyBlockComment.ts index 71c66db1775..39da310bb25 100644 --- a/tests/cases/fourslash/quickInfoFromEmptyBlockComment.ts +++ b/tests/cases/fourslash/quickInfoFromEmptyBlockComment.ts @@ -7,4 +7,4 @@ ////var f/*A*/ff = new Foo(); goTo.marker('A'); -verify.quickInfoIs('Foo'); +verify.quickInfoIs('(var) fff: Foo'); diff --git a/tests/cases/fourslash/quickInfoGenerics.ts b/tests/cases/fourslash/quickInfoGenerics.ts new file mode 100644 index 00000000000..7b34ad173e9 --- /dev/null +++ b/tests/cases/fourslash/quickInfoGenerics.ts @@ -0,0 +1,57 @@ +/// + +////class Con/*1*/tainer { +//// x: T; +////} +////interface IList { +//// getItem(i: number): /*3*/T; +////} +////class List2> implements IList { +//// private __it/*6*/em: /*5*/T[]; +//// public get/*7*/Item(i: number) { +//// return this.__item[i]; +//// } +//// public /*8*/method>(s: S, p: /*10*/T[]) { +//// return s; +//// } +////} +////function foo4(test: T): T; +////function foo4(test: S): S; +////function foo4(test: any): any; +////function foo4(test: any): any { return null; } +////var x: List2>; +////var y = x./*14*/getItem(10); +////var x2: IList>; +////var x3: IList; +////var y2 = x./*15*/method(x2, [x3, x3]); + +goTo.marker("1"); +verify.quickInfoIs("class Container", undefined); +goTo.marker("2"); +verify.quickInfoIs("(type parameter) T in IList", undefined); +goTo.marker("3"); +verify.quickInfoIs("(type parameter) T in IList", undefined); +goTo.marker("4"); +verify.quickInfoIs("(type parameter) T in List2>", undefined); +goTo.marker("5"); +verify.quickInfoIs("(type parameter) T in List2>", undefined); +goTo.marker("6"); +verify.quickInfoIs("(property) List2>.__item: T[]", undefined); +goTo.marker("7"); +verify.quickInfoIs("(method) List2>.getItem(i: number): T", undefined); +goTo.marker("8"); +verify.quickInfoIs("(method) List2>.method>(s: S, p: T[]): S", undefined); +goTo.marker("9"); +verify.quickInfoIs("(type parameter) S in List2>.method>(s: S, p: T[]): S", undefined); +goTo.marker("10"); +verify.quickInfoIs("(type parameter) T in List2>", undefined); +goTo.marker("11"); +verify.quickInfoIs("(type parameter) T in foo4(test: T): T", undefined); +goTo.marker("12"); +verify.quickInfoIs("(type parameter) S in foo4(test: S): S", undefined); +goTo.marker("13"); +verify.quickInfoIs("(type parameter) T in foo4(test: any): any", undefined); +goTo.marker("14"); +verify.quickInfoIs("(method) List2>.getItem(i: number): IList", undefined); +goTo.marker("15"); +verify.quickInfoIs("(method) List2>.method>>(s: IList>, p: IList[]): IList>", undefined); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoInFunctionTypeReference.ts b/tests/cases/fourslash/quickInfoInFunctionTypeReference.ts similarity index 69% rename from tests/cases/fourslash_old/quickInfoInFunctionTypeReference.ts rename to tests/cases/fourslash/quickInfoInFunctionTypeReference.ts index c5804fc076d..e8430d3fabe 100644 --- a/tests/cases/fourslash_old/quickInfoInFunctionTypeReference.ts +++ b/tests/cases/fourslash/quickInfoInFunctionTypeReference.ts @@ -8,7 +8,7 @@ edit.insert(''); goTo.marker("1"); -verify.quickInfoIs("string", undefined, "variable1", "parameter"); +verify.quickInfoIs("(parameter) variable1: string", undefined); goTo.marker("2"); -verify.quickInfoIs("string", undefined, "variable2", "parameter"); +verify.quickInfoIs("(parameter) variable2: string", undefined); diff --git a/tests/cases/fourslash/quickInfoInFunctionTypeReference2.ts b/tests/cases/fourslash/quickInfoInFunctionTypeReference2.ts index 608dbba56c3..fe67c341d46 100644 --- a/tests/cases/fourslash/quickInfoInFunctionTypeReference2.ts +++ b/tests/cases/fourslash/quickInfoInFunctionTypeReference2.ts @@ -1,18 +1,18 @@ /// ////class C { -//// map(fn: (k/*1*/: string, value/*2*/: T, context: any) => void, context: any) { +//// map(fn: (/*1*/k: string, /*2*/value: T, context: any) => void, context: any) { //// } ////} ////var c: C; ////c.map(/*3*/ -//goTo.marker('1'); -//verify.quickInfoIs('string'); +goTo.marker('1'); +verify.quickInfoIs('(parameter) k: string'); -//goTo.marker('2'); -//verify.quickInfoIs('T'); +goTo.marker('2'); +verify.quickInfoIs('(parameter) value: T'); goTo.marker('3'); verify.currentSignatureHelpIs('map(fn: (k: string, value: number, context: any) => void, context: any): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoInInvalidIndexSignature.ts b/tests/cases/fourslash/quickInfoInInvalidIndexSignature.ts new file mode 100644 index 00000000000..b08fb92b8b6 --- /dev/null +++ b/tests/cases/fourslash/quickInfoInInvalidIndexSignature.ts @@ -0,0 +1,6 @@ +/// + +//// function method() { var /**/dictionary = <{ [index]: string; }>{}; } + +goTo.marker(); +verify.quickInfoIs('(local var) dictionary: {}'); diff --git a/tests/cases/fourslash_old/quickInfoInObjectLiteral.ts b/tests/cases/fourslash/quickInfoInObjectLiteral.ts similarity index 78% rename from tests/cases/fourslash_old/quickInfoInObjectLiteral.ts rename to tests/cases/fourslash/quickInfoInObjectLiteral.ts index 7d0c21930fa..94afb172be9 100644 --- a/tests/cases/fourslash_old/quickInfoInObjectLiteral.ts +++ b/tests/cases/fourslash/quickInfoInObjectLiteral.ts @@ -19,7 +19,7 @@ ////} goTo.marker("1"); -verify.quickInfoIs("() => string", undefined, "y1", "property"); +verify.quickInfoIs("(property) y1: () => string", undefined); goTo.marker("2"); -verify.quickInfoIs("number"); +verify.quickInfoIs("(var) value: number"); diff --git a/tests/cases/fourslash/quickInfoInWithBlock.ts b/tests/cases/fourslash/quickInfoInWithBlock.ts index 7da483172f6..9a765251f6f 100644 --- a/tests/cases/fourslash/quickInfoInWithBlock.ts +++ b/tests/cases/fourslash/quickInfoInWithBlock.ts @@ -7,10 +7,10 @@ goTo.marker('1'); -verify.not.quickInfoExists(); +verify.quickInfoIs(""); goTo.marker('2'); -verify.not.quickInfoExists(); +verify.quickInfoIs(""); goTo.marker('3'); -verify.not.quickInfoExists(); +verify.quickInfoIs(""); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOfGenericTypeAssertions1.ts b/tests/cases/fourslash/quickInfoOfGenericTypeAssertions1.ts new file mode 100644 index 00000000000..b08026970b9 --- /dev/null +++ b/tests/cases/fourslash/quickInfoOfGenericTypeAssertions1.ts @@ -0,0 +1,17 @@ +/// + +////function f(x: T): T { return null; } +////var /*1*/r = (x: T) => x; +////var /*2*/r2 = < (x: T) => T>f; + +////var a; +////var /*3*/r3 = < (x: (y: A) => A) => T>a; + +goTo.marker('1'); +verify.quickInfoIs('(var) r: (x: T) => T'); + +goTo.marker('2'); +verify.quickInfoIs('(var) r2: (x: T) => T'); + +goTo.marker('3'); +verify.quickInfoIs('(var) r3: (x: (y: A) => A) => T'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoOfStringPropertyNames1.ts b/tests/cases/fourslash/quickInfoOfStringPropertyNames1.ts similarity index 52% rename from tests/cases/fourslash_old/quickInfoOfStringPropertyNames1.ts rename to tests/cases/fourslash/quickInfoOfStringPropertyNames1.ts index 8e671246bb1..e44e5eb213b 100644 --- a/tests/cases/fourslash_old/quickInfoOfStringPropertyNames1.ts +++ b/tests/cases/fourslash/quickInfoOfStringPropertyNames1.ts @@ -5,7 +5,7 @@ ////} ////var f: foo; -////var r/*1*/ = f['foo bar']; +////var /*1*/r = f['foo bar']; ////class bar { //// 'hello world': number; @@ -16,18 +16,18 @@ ////} ////var b: bar; -////var r2/*2*/ = b["hello world"]; -////var r4/*3*/ = b['1']; -////var r5/*4*/ = b[1]; +////var /*2*/r2 = b["hello world"]; +////var /*3*/r4 = b['1']; +////var /*4*/r5 = b[1]; goTo.marker('1'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) r: string'); goTo.marker('2'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(var) r2: number'); goTo.marker('3'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) r4: string'); goTo.marker('4'); -verify.quickInfoIs('string'); +verify.quickInfoIs('(var) r5: string'); diff --git a/tests/cases/fourslash_old/quickInfoOnCatchVariable.ts b/tests/cases/fourslash/quickInfoOnCatchVariable.ts similarity index 79% rename from tests/cases/fourslash_old/quickInfoOnCatchVariable.ts rename to tests/cases/fourslash/quickInfoOnCatchVariable.ts index 459919c5686..d03b5d7b8b6 100644 --- a/tests/cases/fourslash_old/quickInfoOnCatchVariable.ts +++ b/tests/cases/fourslash/quickInfoOnCatchVariable.ts @@ -6,3 +6,4 @@ goTo.marker(); verify.quickInfoExists(); +verify.quickInfoIs("(var) e: any"); diff --git a/tests/cases/fourslash/quickInfoOnCircularTypes.ts b/tests/cases/fourslash/quickInfoOnCircularTypes.ts index 3885ff4eb7f..e6a52773087 100644 --- a/tests/cases/fourslash/quickInfoOnCircularTypes.ts +++ b/tests/cases/fourslash/quickInfoOnCircularTypes.ts @@ -15,7 +15,7 @@ ////x/*B*/x = y/*C*/y; goTo.marker('B'); -verify.quickInfoIs('B'); +verify.quickInfoIs('(var) xx: B'); goTo.marker('C'); -verify.quickInfoIs('C'); +verify.quickInfoIs('(var) yy: C'); diff --git a/tests/cases/fourslash_old/quickInfoOnClassMergedWithFunction.ts b/tests/cases/fourslash/quickInfoOnClassMergedWithFunction.ts similarity index 80% rename from tests/cases/fourslash_old/quickInfoOnClassMergedWithFunction.ts rename to tests/cases/fourslash/quickInfoOnClassMergedWithFunction.ts index 7a8c66a206e..65b84a6541f 100644 --- a/tests/cases/fourslash_old/quickInfoOnClassMergedWithFunction.ts +++ b/tests/cases/fourslash/quickInfoOnClassMergedWithFunction.ts @@ -14,4 +14,4 @@ ////} goTo.marker(); -verify.quickInfoIs("string", undefined, "myProp", "property"); \ No newline at end of file +verify.quickInfoIs("(property) myProp: string", undefined); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnConstructorWithGenericParameter.ts b/tests/cases/fourslash/quickInfoOnConstructorWithGenericParameter.ts index 056ba5300c7..83cbd2bddb0 100644 --- a/tests/cases/fourslash/quickInfoOnConstructorWithGenericParameter.ts +++ b/tests/cases/fourslash/quickInfoOnConstructorWithGenericParameter.ts @@ -25,5 +25,5 @@ edit.insert("null,"); verify.currentSignatureHelpIs("B(a: Foo, b: number): B"); edit.insert("10);"); -//goTo.marker("2"); -//verify.quickInfoIs("(a: Foo, b: number): B", undefined, "B", "constructor"); \ No newline at end of file +goTo.marker("2"); +verify.quickInfoIs("(constructor) B(a: Foo, b: number): B", undefined); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoOnErrorTypes1.ts b/tests/cases/fourslash/quickInfoOnErrorTypes1.ts similarity index 58% rename from tests/cases/fourslash_old/quickInfoOnErrorTypes1.ts rename to tests/cases/fourslash/quickInfoOnErrorTypes1.ts index 9c0b26cda63..097c9ff15d3 100644 --- a/tests/cases/fourslash_old/quickInfoOnErrorTypes1.ts +++ b/tests/cases/fourslash/quickInfoOnErrorTypes1.ts @@ -6,4 +6,4 @@ ////}; goTo.marker('A'); -verify.quickInfoIs('{ x: number; (): any; }', "", "f", "var"); +verify.quickInfoIs('(var) f: {\n (): any;\n x: number;\n}', ""); diff --git a/tests/cases/fourslash_old/quickInfoOnGenericClass.ts b/tests/cases/fourslash/quickInfoOnGenericClass.ts similarity index 61% rename from tests/cases/fourslash_old/quickInfoOnGenericClass.ts rename to tests/cases/fourslash/quickInfoOnGenericClass.ts index c3eab77354d..d05a509973c 100644 --- a/tests/cases/fourslash_old/quickInfoOnGenericClass.ts +++ b/tests/cases/fourslash/quickInfoOnGenericClass.ts @@ -5,4 +5,4 @@ ////} goTo.marker(); -verify.quickInfoIs('Container', null, 'Container'); \ No newline at end of file +verify.quickInfoIs('class Container', null); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnGenericWithConstraints1.ts b/tests/cases/fourslash/quickInfoOnGenericWithConstraints1.ts new file mode 100644 index 00000000000..2f4fe31fdcf --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnGenericWithConstraints1.ts @@ -0,0 +1,9 @@ +/// + +////interface Fo/*1*/o {} + +goTo.marker('1'); +verify.quickInfoIs('interface Foo', null); + +goTo.marker('2'); +verify.quickInfoIs('(type parameter) TT in Foo', null); diff --git a/tests/cases/fourslash/quickInfoOnMergedInterfaces.ts b/tests/cases/fourslash/quickInfoOnMergedInterfaces.ts index 210d37eacb0..7d6e7ef3f2d 100644 --- a/tests/cases/fourslash/quickInfoOnMergedInterfaces.ts +++ b/tests/cases/fourslash/quickInfoOnMergedInterfaces.ts @@ -19,4 +19,4 @@ diagnostics.setEditValidation(IncrementalEditValidation.None); goTo.marker('1'); -verify.quickInfoIs("number", undefined, "r4", "var"); +verify.quickInfoIs("(var) r4: number"); diff --git a/tests/cases/fourslash_old/quickInfoOnMergedInterfacesWithIncrementalEdits.ts b/tests/cases/fourslash/quickInfoOnMergedInterfacesWithIncrementalEdits.ts similarity index 60% rename from tests/cases/fourslash_old/quickInfoOnMergedInterfacesWithIncrementalEdits.ts rename to tests/cases/fourslash/quickInfoOnMergedInterfacesWithIncrementalEdits.ts index 684604e6c41..e14d08ccd69 100644 --- a/tests/cases/fourslash_old/quickInfoOnMergedInterfacesWithIncrementalEdits.ts +++ b/tests/cases/fourslash/quickInfoOnMergedInterfacesWithIncrementalEdits.ts @@ -9,20 +9,20 @@ //// } //// var b: B; //// var r3 = b.foo; // number -//// var r/*2*/4 = b.ba/*1*/r; // string +//// var r/*2*/4 = b.b/*1*/ar; // string ////} diagnostics.setEditValidation(IncrementalEditValidation.None); goTo.marker('1'); -verify.quickInfoIs("string", undefined, "MM.B.bar", "property"); +verify.quickInfoIs("(property) B.bar: string", undefined); edit.deleteAtCaret(1); edit.insert('z'); -verify.quickInfoIs("any"); +verify.quickInfoIs(""); verify.numberOfErrorsInCurrentFile(1); edit.backspace(1); -edit.insert('r'); -verify.quickInfoIs("string", undefined, "MM.B.bar", "property"); +edit.insert('a'); +verify.quickInfoIs("(property) B.bar: string", undefined); goTo.marker('2'); -verify.quickInfoIs("string", undefined, "r4", "var"); +verify.quickInfoIs("(var) r4: string", undefined); verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash_old/quickInfoOnMergedModule.ts b/tests/cases/fourslash/quickInfoOnMergedModule.ts similarity index 83% rename from tests/cases/fourslash_old/quickInfoOnMergedModule.ts rename to tests/cases/fourslash/quickInfoOnMergedModule.ts index aac91509174..abf12a65dbf 100644 --- a/tests/cases/fourslash_old/quickInfoOnMergedModule.ts +++ b/tests/cases/fourslash/quickInfoOnMergedModule.ts @@ -18,5 +18,5 @@ diagnostics.setEditValidation(IncrementalEditValidation.None); goTo.marker('1'); -verify.quickInfoIs("string", undefined, "M2.A.foo", "property"); +verify.quickInfoIs("(property) M2.A.foo: string", undefined); verify.numberOfErrorsInCurrentFile(0); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts b/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts new file mode 100644 index 00000000000..0803bc69109 --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts @@ -0,0 +1,26 @@ +/// + +////function /*1*/makePoint(x: number) { +//// return { +//// b: 10, +//// get x() { return x; }, +//// set x(a: number) { this.b = a; } +//// }; +////}; +////var /*4*/point = makePoint(2); +////var /*2*/x = point.x; +////point./*3*/x = 30; + +goTo.marker('1'); +verify.quickInfoIs("(function) makePoint(x: number): {\n b: number;\n x: number;\n}", undefined); + +goTo.marker('2'); +verify.quickInfoIs("(var) x: number", undefined); + +goTo.marker('3'); +verify.memberListContains("x", "(property) x: number", undefined); +verify.memberListContains("b", "(property) b: number", undefined); +verify.quickInfoIs("(property) x: number", undefined); + +goTo.marker('4'); +verify.quickInfoIs("(var) point: {\n b: number;\n x: number;\n}", undefined); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts new file mode 100644 index 00000000000..b85a82c63d5 --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts @@ -0,0 +1,21 @@ +/// + +////function /*1*/makePoint(x: number) { +//// return { +//// get x() { return x; }, +//// }; +////}; +////var /*4*/point = makePoint(2); +////var /*2*/x = point./*3*/x; + +goTo.marker('1'); +verify.quickInfoIs("(function) makePoint(x: number): {\n x: number;\n}", undefined); + +goTo.marker('2'); +verify.quickInfoIs("(var) x: number", undefined); + +goTo.marker('3'); +verify.memberListContains("x", "(property) x: number", undefined); + +goTo.marker('4'); +verify.quickInfoIs("(var) point: {\n x: number;\n}", undefined); diff --git a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts new file mode 100644 index 00000000000..0cc7b6d0ed3 --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts @@ -0,0 +1,21 @@ +/// + +////function /*1*/makePoint(x: number) { +//// return { +//// b: 10, +//// set x(a: number) { this.b = a; } +//// }; +////}; +////var /*3*/point = makePoint(2); +////point./*2*/x = 30; + +goTo.marker('1'); +verify.quickInfoIs("(function) makePoint(x: number): {\n b: number;\n x: number;\n}", undefined); + +goTo.marker('2'); +verify.memberListContains("x", "(property) x: number", undefined); +verify.memberListContains("b", "(property) b: number", undefined); +verify.quickInfoIs("(property) x: number", undefined); + +goTo.marker('3'); +verify.quickInfoIs("(var) point: {\n b: number;\n x: number;\n}", undefined); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoOnThis.ts b/tests/cases/fourslash/quickInfoOnThis.ts similarity index 87% rename from tests/cases/fourslash_old/quickInfoOnThis.ts rename to tests/cases/fourslash/quickInfoOnThis.ts index c4eecfca5d5..daf34fd5764 100644 --- a/tests/cases/fourslash_old/quickInfoOnThis.ts +++ b/tests/cases/fourslash/quickInfoOnThis.ts @@ -12,4 +12,4 @@ ////} goTo.marker(); -verify.quickInfoIs('any'); +verify.quickInfoIs(''); diff --git a/tests/cases/fourslash/quickInfoOnUndefined.ts b/tests/cases/fourslash/quickInfoOnUndefined.ts new file mode 100644 index 00000000000..252da49d4fe --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnUndefined.ts @@ -0,0 +1,8 @@ +/// + +////function foo(a: string) { +////} +////foo(/*1*/undefined); + +goTo.marker('1'); +verify.quickInfoIs('(var) undefined'); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoShowsGenericSpecialization.ts b/tests/cases/fourslash/quickInfoShowsGenericSpecialization.ts new file mode 100644 index 00000000000..ab8454a3a27 --- /dev/null +++ b/tests/cases/fourslash/quickInfoShowsGenericSpecialization.ts @@ -0,0 +1,7 @@ +/// + +////class A { } +////var /**/foo = new A(); + +goTo.marker(); +verify.quickInfoIs('(var) foo: A'); diff --git a/tests/cases/fourslash/quickinfoIsConsistent.ts b/tests/cases/fourslash/quickinfoIsConsistent.ts index a048b3819ed..cc27e698d34 100644 --- a/tests/cases/fourslash/quickinfoIsConsistent.ts +++ b/tests/cases/fourslash/quickinfoIsConsistent.ts @@ -8,5 +8,5 @@ [1, 2, 3].forEach((val) => { goTo.marker("" + val); - verify.quickInfoIs("(x: number) => number", "", "f", "var"); + verify.quickInfoIs("(var) f: (x: number) => number", ""); } ); \ No newline at end of file diff --git a/tests/cases/fourslash_old/recursiveClassReference.ts b/tests/cases/fourslash/recursiveClassReference.ts similarity index 84% rename from tests/cases/fourslash_old/recursiveClassReference.ts rename to tests/cases/fourslash/recursiveClassReference.ts index 8604fbc26d8..d0e96ac90e3 100644 --- a/tests/cases/fourslash_old/recursiveClassReference.ts +++ b/tests/cases/fourslash/recursiveClassReference.ts @@ -3,7 +3,7 @@ //// declare module Thing { } //// //// module Thing { -//// var x/**/: Mode; +//// var /**/x: Mode; //// } //// //// module Thing { diff --git a/tests/cases/fourslash/recursiveObjectLiteral.ts b/tests/cases/fourslash/recursiveObjectLiteral.ts new file mode 100644 index 00000000000..c384ab135c5 --- /dev/null +++ b/tests/cases/fourslash/recursiveObjectLiteral.ts @@ -0,0 +1,6 @@ +/// + +////var a = { f: /**/a + +goTo.marker(); +verify.quickInfoIs("(var) a: any", null); \ No newline at end of file diff --git a/tests/cases/fourslash/recursiveWrappedTypeParameters1.ts b/tests/cases/fourslash/recursiveWrappedTypeParameters1.ts index d5dc27bdf23..c7794b66747 100644 --- a/tests/cases/fourslash/recursiveWrappedTypeParameters1.ts +++ b/tests/cases/fourslash/recursiveWrappedTypeParameters1.ts @@ -15,22 +15,22 @@ ////var f/*7*/f = x.c.c; goTo.marker('1'); -verify.quickInfoIs('I>>>>>'); +verify.quickInfoIs('(var) yy: I>>>>>'); goTo.marker('2'); -verify.quickInfoIs('number'); +verify.quickInfoIs('(var) aa: number'); goTo.marker('3'); -verify.quickInfoIs('I'); +verify.quickInfoIs('(var) bb: I'); goTo.marker('4'); -verify.quickInfoIs('I>'); +verify.quickInfoIs('(var) cc: I>'); goTo.marker('5'); -verify.quickInfoIs('I'); +verify.quickInfoIs('(var) dd: I'); goTo.marker('6'); -verify.quickInfoIs('I>'); +verify.quickInfoIs('(var) ee: I>'); goTo.marker('7'); -verify.quickInfoIs('I>>'); \ No newline at end of file +verify.quickInfoIs('(var) ff: I>>'); \ No newline at end of file diff --git a/tests/cases/fourslash/regexp.ts b/tests/cases/fourslash/regexp.ts new file mode 100644 index 00000000000..6aae13993f3 --- /dev/null +++ b/tests/cases/fourslash/regexp.ts @@ -0,0 +1,6 @@ +/// + +////var /**/x = /aa/; + +goTo.marker(); +verify.quickInfoIs("(var) x: RegExp"); diff --git a/tests/cases/fourslash/restArgType.ts b/tests/cases/fourslash/restArgType.ts new file mode 100644 index 00000000000..7be10d6411b --- /dev/null +++ b/tests/cases/fourslash/restArgType.ts @@ -0,0 +1,80 @@ +/// + +////class Test { +//// private _priv(.../*1*/restArgs) { +//// } +//// public pub(.../*2*/restArgs) { +//// var x = restArgs[2]; +//// } +////} +////var x: (...y: string[]) => void = function (.../*3*/y) { +//// var t = y; +////}; +////function foo(x: (...y: string[]) => void ) { } +////foo((.../*4*/y1) => { +//// var t = y; +////}); +////foo((/*5*/y2) => { +//// var t = y; +////}); +////var t1 :(a1: string, a2: string) => void = (.../*t1*/f1) => { } // f1 => any[]; +////var t2: (a1: string, ...a2: string[]) => void = (.../*t2*/f1) => { } // f1 => any[]; +////var t3: (a1: number, a2: boolean, ...c: string[]) => void = (/*t31*/f1, .../*t32*/f2) => { }; // f1 => number, f2 => any[] +////var t4: (...a1: string[]) => void = (.../*t4*/f1) => { }; // f1 => string[] +////var t5: (...a1: string[]) => void = (/*t5*/f1) => { }; // f1 => string +////var t6: (...a1: string[]) => void = (/*t61*/f1, .../*t62*/f2) => { }; // f1 => string, f2 => string[] +////var t7: (...a1: string[]) => void = (/*t71*/f1, /*t72*/f2, /*t73*/f3) => { }; // fa => string, f2 => string, f3 => string +////// Explicit type annotation +////var t8: (...a1: string[]) => void = (/*t8*/f1: number[]) => { }; +////// Explicit initialization value +////var t9: (a1: string[], a2: string[]) => void = (/*t91*/f1 = 4, /*t92*/f2 = [false, true]) => { }; + +goTo.marker("1"); +verify.quickInfoIs("(parameter) restArgs: any[]", ""); +goTo.marker("2"); +verify.quickInfoIs("(parameter) restArgs: any[]", ""); + +goTo.marker("3"); +verify.quickInfoIs("(parameter) y: string[]", ""); + +goTo.marker("4"); +verify.quickInfoIs("(parameter) y1: string[]", ""); +goTo.marker("5"); +verify.quickInfoIs("(parameter) y2: string", ""); + +goTo.marker("t1"); +verify.quickInfoIs("(parameter) f1: any[]", ""); + +goTo.marker("t2"); +verify.quickInfoIs("(parameter) f1: any[]", ""); + +goTo.marker("t31"); +verify.quickInfoIs("(parameter) f1: number", ""); +goTo.marker("t32"); +verify.quickInfoIs("(parameter) f2: any[]", ""); + +goTo.marker("t4"); +verify.quickInfoIs("(parameter) f1: string[]", ""); + +goTo.marker("t5"); +verify.quickInfoIs("(parameter) f1: string", ""); + +goTo.marker("t61"); +verify.quickInfoIs("(parameter) f1: string", ""); +goTo.marker("t62"); +verify.quickInfoIs("(parameter) f2: string[]", ""); + +goTo.marker("t71"); +verify.quickInfoIs("(parameter) f1: string", ""); +goTo.marker("t72"); +verify.quickInfoIs("(parameter) f2: string", ""); +goTo.marker("t73"); +verify.quickInfoIs("(parameter) f3: string", ""); + +goTo.marker("t8"); +verify.quickInfoIs("(parameter) f1: number[]", ""); + +goTo.marker("t91"); +verify.quickInfoIs("(parameter) f1: string[]", ""); +goTo.marker("t92"); +verify.quickInfoIs("(parameter) f2: string[]", ""); \ No newline at end of file diff --git a/tests/cases/fourslash_old/restParamsContextuallyTyped.ts b/tests/cases/fourslash/restParamsContextuallyTyped.ts similarity index 50% rename from tests/cases/fourslash_old/restParamsContextuallyTyped.ts rename to tests/cases/fourslash/restParamsContextuallyTyped.ts index 11f4396ed25..cd53ba68e1c 100644 --- a/tests/cases/fourslash_old/restParamsContextuallyTyped.ts +++ b/tests/cases/fourslash/restParamsContextuallyTyped.ts @@ -3,8 +3,8 @@ ////var foo: Function = function (/*1*/a, /*2*/b, /*3*/c) { }; goTo.marker('1'); -verify.quickInfoIs('any', "", "a", "parameter"); +verify.quickInfoIs('(parameter) a: any', ""); goTo.marker('2'); -verify.quickInfoIs('any', "", "b", "parameter"); +verify.quickInfoIs('(parameter) b: any', ""); goTo.marker('3'); -verify.quickInfoIs('any', "", "c", "parameter"); +verify.quickInfoIs('(parameter) c: any', ""); diff --git a/tests/cases/fourslash/returnRecursiveType.ts b/tests/cases/fourslash/returnRecursiveType.ts index a5fe69b576f..d87eac63f68 100644 --- a/tests/cases/fourslash/returnRecursiveType.ts +++ b/tests/cases/fourslash/returnRecursiveType.ts @@ -8,4 +8,4 @@ ////var My/**/Var = MyFn(); goTo.marker(); -verify.quickInfoIs('MyInt'); \ No newline at end of file +verify.quickInfoIs('(var) MyVar: MyInt'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/returnTypeOfGenericFunction1.ts b/tests/cases/fourslash/returnTypeOfGenericFunction1.ts similarity index 67% rename from tests/cases/fourslash_old/returnTypeOfGenericFunction1.ts rename to tests/cases/fourslash/returnTypeOfGenericFunction1.ts index 5876b16cce5..7d8d7e335c5 100644 --- a/tests/cases/fourslash_old/returnTypeOfGenericFunction1.ts +++ b/tests/cases/fourslash/returnTypeOfGenericFunction1.ts @@ -4,7 +4,7 @@ //// map(iterator: (value: T) => U, context?: any): U[]; ////} ////var x: WrappedArray; -////var y/**/ = x.map(s => s.length); +////var /**/y = x.map(s => s.length); goTo.marker(); -verify.quickInfoIs('number[]'); +verify.quickInfoIs('(var) y: number[]'); diff --git a/tests/cases/fourslash_old/selfReferencedExternalModule.ts b/tests/cases/fourslash/selfReferencedExternalModule.ts similarity index 56% rename from tests/cases/fourslash_old/selfReferencedExternalModule.ts rename to tests/cases/fourslash/selfReferencedExternalModule.ts index cfabf52b59b..ec312ccb1e5 100644 --- a/tests/cases/fourslash_old/selfReferencedExternalModule.ts +++ b/tests/cases/fourslash/selfReferencedExternalModule.ts @@ -5,5 +5,5 @@ ////A./**/I goTo.marker(); -verify.completionListContains("A", "A"); -verify.completionListContains("I", "number"); \ No newline at end of file +verify.completionListContains("A", "(alias) A"); +verify.completionListContains("I", "(var) I: number"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/selfReferencedExternalModule2.ts b/tests/cases/fourslash/selfReferencedExternalModule2.ts similarity index 62% rename from tests/cases/fourslash_old/selfReferencedExternalModule2.ts rename to tests/cases/fourslash/selfReferencedExternalModule2.ts index 950a91cb514..9b1c4470c99 100644 --- a/tests/cases/fourslash_old/selfReferencedExternalModule2.ts +++ b/tests/cases/fourslash/selfReferencedExternalModule2.ts @@ -2,15 +2,15 @@ // @Filename: app.ts ////export import A = require('app2'); ////export var I = 1; -////A.Y/*1*/; -////A.B.A.B.I/*2*/; +////A./*1*/Y; +////A.B.A.B./*2*/I; // @Filename: app2.ts ////export import B = require('app'); ////export var Y = 1; goTo.marker("1"); -verify.quickInfoIs("number", undefined, "A.Y"); +verify.quickInfoIs("(var) A.Y: number"); goTo.marker("2"); -verify.quickInfoIs("number", undefined "A.B.I"); +verify.quickInfoIs("(var) I: number"); diff --git a/tests/cases/fourslash_old/staticPrototypePropertyOnClass.ts b/tests/cases/fourslash/staticPrototypePropertyOnClass.ts similarity index 59% rename from tests/cases/fourslash_old/staticPrototypePropertyOnClass.ts rename to tests/cases/fourslash/staticPrototypePropertyOnClass.ts index cbf85a9a944..875f8fdb369 100644 --- a/tests/cases/fourslash_old/staticPrototypePropertyOnClass.ts +++ b/tests/cases/fourslash/staticPrototypePropertyOnClass.ts @@ -20,10 +20,10 @@ ////c4./*4*/prototype; goTo.marker('1'); -verify.quickInfoIs("c1", undefined, "c1.prototype", "property"); +verify.quickInfoIs("(property) c1.prototype: c1"); goTo.marker('2'); -verify.quickInfoIs("c2", undefined, "c2.prototype", "property"); +verify.quickInfoIs("(property) c2.prototype: c2"); goTo.marker('3'); -verify.quickInfoIs("c3", undefined, "c3.prototype", "property"); +verify.quickInfoIs("(property) c3.prototype: c3"); goTo.marker('4'); -verify.quickInfoIs("c4", undefined, "c4.prototype", "property"); \ No newline at end of file +verify.quickInfoIs("(property) c4.prototype: c4"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/stringPropertyNames1.ts b/tests/cases/fourslash/stringPropertyNames1.ts similarity index 63% rename from tests/cases/fourslash_old/stringPropertyNames1.ts rename to tests/cases/fourslash/stringPropertyNames1.ts index 6f8fa740307..e3def4e34d5 100644 --- a/tests/cases/fourslash_old/stringPropertyNames1.ts +++ b/tests/cases/fourslash/stringPropertyNames1.ts @@ -4,7 +4,7 @@ //// "artist": number; ////} ////var a: Album; -////var x/**/ = a['artist']; +////var /**/x = a['artist']; goTo.marker(); -verify.quickInfoIs('number'); \ No newline at end of file +verify.quickInfoIs('(var) x: number'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/stringPropertyNames2.ts b/tests/cases/fourslash/stringPropertyNames2.ts similarity index 64% rename from tests/cases/fourslash_old/stringPropertyNames2.ts rename to tests/cases/fourslash/stringPropertyNames2.ts index f960f2c3c66..b9250bc7616 100644 --- a/tests/cases/fourslash_old/stringPropertyNames2.ts +++ b/tests/cases/fourslash/stringPropertyNames2.ts @@ -4,7 +4,7 @@ //// "artist": T; ////} ////var a: Album; -////var x/**/ = a['artist']; +////var /**/x = a['artist']; goTo.marker(); -verify.quickInfoIs('number'); \ No newline at end of file +verify.quickInfoIs('(var) x: number'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/symbolNameAtUnparseableFunctionOverload.ts b/tests/cases/fourslash/symbolNameAtUnparseableFunctionOverload.ts similarity index 89% rename from tests/cases/fourslash_old/symbolNameAtUnparseableFunctionOverload.ts rename to tests/cases/fourslash/symbolNameAtUnparseableFunctionOverload.ts index a0bed116e3b..cda1084bf79 100644 --- a/tests/cases/fourslash_old/symbolNameAtUnparseableFunctionOverload.ts +++ b/tests/cases/fourslash/symbolNameAtUnparseableFunctionOverload.ts @@ -10,4 +10,4 @@ //// goTo.marker(); -verify.quickInfoExists(); +verify.not.quickInfoExists(); diff --git a/tests/cases/fourslash_old/thisBindingInLambda.ts b/tests/cases/fourslash/thisBindingInLambda.ts similarity index 78% rename from tests/cases/fourslash_old/thisBindingInLambda.ts rename to tests/cases/fourslash/thisBindingInLambda.ts index 4e73daeecaf..f6dfdbdec08 100644 --- a/tests/cases/fourslash_old/thisBindingInLambda.ts +++ b/tests/cases/fourslash/thisBindingInLambda.ts @@ -9,4 +9,4 @@ ////} goTo.marker(); -verify.quickInfoIs('Greeter'); +verify.quickInfoIs('class Greeter'); diff --git a/tests/cases/fourslash_old/transitiveExportImports.ts b/tests/cases/fourslash/transitiveExportImports.ts similarity index 86% rename from tests/cases/fourslash_old/transitiveExportImports.ts rename to tests/cases/fourslash/transitiveExportImports.ts index d3644efab87..6ac905f017d 100644 --- a/tests/cases/fourslash_old/transitiveExportImports.ts +++ b/tests/cases/fourslash/transitiveExportImports.ts @@ -10,7 +10,7 @@ // @Filename: c.ts ////import b = require('./b'); -////var a = new b.a/**/(); +////var a = new b./**/a(); goTo.marker(); verify.quickInfoExists(); diff --git a/tests/cases/fourslash_old/typeCheckAfterResolve.ts b/tests/cases/fourslash/typeCheckAfterResolve.ts similarity index 93% rename from tests/cases/fourslash_old/typeCheckAfterResolve.ts rename to tests/cases/fourslash/typeCheckAfterResolve.ts index 20fbb529eb1..21ea8f88356 100644 --- a/tests/cases/fourslash_old/typeCheckAfterResolve.ts +++ b/tests/cases/fourslash/typeCheckAfterResolve.ts @@ -15,7 +15,7 @@ edit.insertLine(""); // Attempt to resolve a symbol goTo.marker("IPointRef"); -verify.quickInfoIs("any"); // not found +verify.quickInfoIs(""); // not found // trigger typecheck after the partial resolve, we should see errors verify.errorExistsAfterMarker("IPointRef"); diff --git a/tests/cases/fourslash_old/typeOfAFundule.ts b/tests/cases/fourslash/typeOfAFundule.ts similarity index 67% rename from tests/cases/fourslash_old/typeOfAFundule.ts rename to tests/cases/fourslash/typeOfAFundule.ts index 6084a5e64e2..d2ddb4e6df5 100644 --- a/tests/cases/fourslash_old/typeOfAFundule.ts +++ b/tests/cases/fourslash/typeOfAFundule.ts @@ -5,7 +5,7 @@ ////function foo13() { //// return m1; ////} -////var r13/**/ = foo13(); +////var /**/r13 = foo13(); goTo.marker(); -verify.quickInfoIs('typeof m1'); +verify.quickInfoIs('(var) r13: typeof m1'); diff --git a/tests/cases/fourslash_old/typeOfThisInStatics.ts b/tests/cases/fourslash/typeOfThisInStatics.ts similarity index 52% rename from tests/cases/fourslash_old/typeOfThisInStatics.ts rename to tests/cases/fourslash/typeOfThisInStatics.ts index 7df64859854..a14d15d3f57 100644 --- a/tests/cases/fourslash_old/typeOfThisInStatics.ts +++ b/tests/cases/fourslash/typeOfThisInStatics.ts @@ -2,16 +2,16 @@ ////class C { //// static foo() { -//// var r/*1*/ = this; +//// var /*1*/r = this; //// } //// static get x() { -//// var r/*2*/ = this; +//// var /*2*/r = this; //// return 1; //// } ////} goTo.marker('1'); -verify.quickInfoIs('typeof C'); +verify.quickInfoIs('(local var) r: typeof C'); goTo.marker('2'); -verify.quickInfoIs('typeof C'); \ No newline at end of file +verify.quickInfoIs('(local var) r: typeof C'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/typeParameterListInQuickInfoAfterEdit.ts b/tests/cases/fourslash/typeParameterListInQuickInfoAfterEdit.ts similarity index 82% rename from tests/cases/fourslash_old/typeParameterListInQuickInfoAfterEdit.ts rename to tests/cases/fourslash/typeParameterListInQuickInfoAfterEdit.ts index 7d157130cd8..c5abd2e0279 100644 --- a/tests/cases/fourslash_old/typeParameterListInQuickInfoAfterEdit.ts +++ b/tests/cases/fourslash/typeParameterListInQuickInfoAfterEdit.ts @@ -11,10 +11,10 @@ // Sanity check: type name here should include the type parameter goTo.marker('1'); -verify.quickInfoSymbolNameIs('Dictionary'); +verify.quickInfoIs('class Dictionary'); // Add a similar class -- name does not match goTo.marker('2'); edit.insert("class C2 extends Dictionary { }"); edit.moveLeft('ictionary { }'.length); -verify.quickInfoSymbolNameIs('Dictionary'); +verify.quickInfoIs('class Dictionary'); diff --git a/tests/cases/fourslash/typedGenericPrototypeMember.ts b/tests/cases/fourslash/typedGenericPrototypeMember.ts new file mode 100644 index 00000000000..016a7f73298 --- /dev/null +++ b/tests/cases/fourslash/typedGenericPrototypeMember.ts @@ -0,0 +1,13 @@ +/// + +////class C { +//// foo(x: T) { } +////} +////var /*1*/x = new C(); // Quick Info for x is C +////var /*2*/y = C.prototype; // Quick Info for y is C<{}> + +goTo.marker('1'); +verify.quickInfoIs('(var) x: C'); + +goTo.marker('2'); +verify.quickInfoIs('(var) y: C'); diff --git a/tests/cases/fourslash/underscoreTypings1.ts b/tests/cases/fourslash/underscoreTypings1.ts new file mode 100644 index 00000000000..9a0bada65f2 --- /dev/null +++ b/tests/cases/fourslash/underscoreTypings1.ts @@ -0,0 +1,62 @@ +/// + +////interface Iterator { +//// (value: T, index: any, list: any): U; +////} +//// +////interface WrappedArray { +//// map(iterator: Iterator, context?: any): U[]; +////} +//// +////interface Underscore { +//// (list: T[]): WrappedArray; +//// map(list: T[], iterator: Iterator, context?: any): U[]; +////} +//// +////declare var _: Underscore; +//// +////var a: string[]; +////var /*1*/b = _.map(a, /*2*/x => x.length); // Was typed any[], should be number[] +////var /*3*/c = _(a).map(/*4*/x => x.length); +////var /*5*/d = a.map(/*6*/x => x.length); +//// +////var aa: any[]; +////var /*7*/bb = _.map(aa, /*8*/x => x.length); +////var /*9*/cc = _(aa).map(/*10*/x => x.length); +////var /*11*/dd = aa.map(/*12*/x => x.length); +//// +////var e = a.map(x => x./*13*/ + +goTo.marker('1'); +verify.quickInfoIs('(var) b: number[]'); +goTo.marker('2'); +verify.quickInfoIs('(parameter) x: string'); + +goTo.marker('3'); +verify.quickInfoIs('(var) c: number[]'); +goTo.marker('4'); +verify.quickInfoIs('(parameter) x: string'); + +goTo.marker('5'); +verify.quickInfoIs('(var) d: number[]'); +goTo.marker('6'); +verify.quickInfoIs('(parameter) x: string'); + +goTo.marker('7'); +verify.quickInfoIs('(var) bb: any[]'); +goTo.marker('8'); +verify.quickInfoIs('(parameter) x: any'); + +goTo.marker('9'); +verify.quickInfoIs('(var) cc: any[]'); +goTo.marker('10'); +verify.quickInfoIs('(parameter) x: any'); + +goTo.marker('11'); +verify.quickInfoIs('(var) dd: any[]'); +goTo.marker('12'); +verify.quickInfoIs('(parameter) x: any'); + +goTo.marker('13'); +verify.completionListContains('length'); +verify.not.completionListContains('toFixed'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/verifySingleFileEmitOutput1.ts b/tests/cases/fourslash/verifySingleFileEmitOutput1.ts similarity index 78% rename from tests/cases/fourslash_old/verifySingleFileEmitOutput1.ts rename to tests/cases/fourslash/verifySingleFileEmitOutput1.ts index d0215283f3f..cd8c123c5b2 100644 --- a/tests/cases/fourslash_old/verifySingleFileEmitOutput1.ts +++ b/tests/cases/fourslash/verifySingleFileEmitOutput1.ts @@ -8,7 +8,7 @@ // @Filename: verifySingleFileEmitOutput1_file1.ts ////import f = require("verifySingleFileEmitOutput1_file0"); -////var b/**/ = new f.A(); +////var /**/b = new f.A(); goTo.marker(); -verify.quickInfoIs('f.A'); \ No newline at end of file +verify.quickInfoIs('(var) b: f.A'); \ No newline at end of file diff --git a/tests/cases/fourslash/widenedTypes.ts b/tests/cases/fourslash/widenedTypes.ts new file mode 100644 index 00000000000..d657d5a4054 --- /dev/null +++ b/tests/cases/fourslash/widenedTypes.ts @@ -0,0 +1,18 @@ +/// + +////var /*1*/a = null; // var a: any +////var /*2*/b = undefined; // var b: any +////var /*3*/c = { x: 0, y: null }; // var c: { x: number, y: any } +////var /*4*/d = [null, undefined]; // var d: any[] + +goTo.marker('1'); +verify.quickInfoIs('(var) a: any'); + +goTo.marker('2'); +verify.quickInfoIs('(var) b: any'); + +goTo.marker('3'); +verify.quickInfoIs('(var) c: {\n x: number;\n y: any;\n}'); + +goTo.marker('4'); +verify.quickInfoIs('(var) d: any[]'); diff --git a/tests/cases/fourslash_old/augmentedTypesModule2.ts b/tests/cases/fourslash_old/augmentedTypesModule2.ts deleted file mode 100644 index 0698e6060ca..00000000000 --- a/tests/cases/fourslash_old/augmentedTypesModule2.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// - -////function /*11*/m2f(x: number) { }; -////module m2f { export interface I { foo(): void } } -////var x: m2f./*1*/ -////var r/*2*/ = m2f/*3*/; - -goTo.marker('11'); -verify.quickInfoIs('(x: number): void'); - -goTo.marker('1'); -verify.completionListContains('I'); - -edit.insert('I.'); -verify.not.completionListContains('foo'); -edit.backspace(1); - -goTo.marker('2'); -verify.quickInfoIs('typeof m2f'); - -goTo.marker('3'); -edit.insert('('); -verify.currentSignatureHelpIs('m2f(x: number): void'); diff --git a/tests/cases/fourslash_old/augmentedTypesModule3.ts b/tests/cases/fourslash_old/augmentedTypesModule3.ts deleted file mode 100644 index 41a22c030df..00000000000 --- a/tests/cases/fourslash_old/augmentedTypesModule3.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - -////function m2g() { }; -////module m2g { export class C { foo(x: number) { } } } -////var x: m2g./*1*/; -////var r/*2*/ = m2g/*3*/; - -goTo.marker('1'); -verify.completionListContains('C'); - -edit.insert('C.'); -verify.not.completionListContains('foo'); -edit.backspace(1); - -goTo.marker('2'); -verify.quickInfoIs("typeof m2g", undefined, "r", "var"); - -goTo.marker('3'); -edit.insert('('); -verify.currentSignatureHelpIs('m2g(): void'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/augmentedTypesModule6.ts b/tests/cases/fourslash_old/augmentedTypesModule6.ts deleted file mode 100644 index 86462d3a264..00000000000 --- a/tests/cases/fourslash_old/augmentedTypesModule6.ts +++ /dev/null @@ -1,34 +0,0 @@ -/// - -////declare class m3f { foo(x: number): void } -////module m3f { export interface I { foo(): void } } -////var x: m3f./*1*/ -////var r/*4*/ = new /*2*/m3f(/*3*/); -////r./*5*/ -////var r2: m3f.I = r; -////r2./*6*/ - -goTo.marker('1'); -verify.completionListContains('I'); - -verify.not.completionListContains('foo'); -edit.insert('I;'); - -goTo.marker('2'); -verify.completionListContains('m3f'); - -goTo.marker('3'); -verify.currentSignatureHelpIs('m3f(): m3f'); - -goTo.marker('4'); -verify.quickInfoIs('m3f'); - -goTo.marker('5'); -verify.completionListContains('foo'); -edit.insert('foo(1)'); - -goTo.marker('6'); -verify.completionListContains('foo'); -edit.insert('foo('); -verify.currentSignatureHelpIs('foo(): void'); - diff --git a/tests/cases/fourslash_old/automaticConstructorToggling.ts b/tests/cases/fourslash_old/automaticConstructorToggling.ts deleted file mode 100644 index 9a95113f95c..00000000000 --- a/tests/cases/fourslash_old/automaticConstructorToggling.ts +++ /dev/null @@ -1,57 +0,0 @@ -/// - -////class A { } -////class B {/*B*/ } -////class C { /*C*/constructor(val: T) { } } -////class D { constructor(/*D*/val: T) { } } -//// -////new A/*Asig*/(); -////new B/*Bsig*/(""); -////new C/*Csig*/(""); -////new D/*Dsig*/(); - -var A = 'A'; -var B = 'B'; -var C = 'C'; -var D = 'D' -goTo.marker(B); -edit.insert('constructor(val: T) { }'); -goTo.marker('Asig'); -verify.quickInfoIs("(): A", null, A, 'constructor'); - -goTo.marker('Bsig'); -verify.quickInfoIs("(val: string): B", null, B, 'constructor'); - -goTo.marker('Csig'); -verify.quickInfoIs("(val: string): C", null, C, 'constructor'); - -goTo.marker('Dsig'); -verify.quickInfoIs("(val: string): D", null, D, 'constructor'); - -goTo.marker(C); -edit.deleteAtCaret('constructor(val: T) { }'.length); -goTo.marker('Asig'); -verify.quickInfoIs("(): A", null, A, 'constructor'); - -goTo.marker('Bsig'); -verify.quickInfoIs("(val: string): B", null, B, 'constructor'); - -goTo.marker('Csig'); -verify.quickInfoIs("(): C<{}>", null, C, 'constructor'); - -goTo.marker('Dsig'); -verify.quickInfoIs("(val: string): D", null, D, 'constructor'); - -goTo.marker(D); -edit.deleteAtCaret("val: T".length); -goTo.marker('Asig'); -verify.quickInfoIs("(): A", null, A, 'constructor'); - -goTo.marker('Bsig'); -verify.quickInfoIs("(val: string): B", null, B, 'constructor'); - -goTo.marker('Csig'); -verify.quickInfoIs("(): C<{}>", null, C, 'constructor'); - -goTo.marker('Dsig'); -verify.quickInfoIs("(): D", null, D, 'constructor'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/commentsClass.ts b/tests/cases/fourslash_old/commentsClass.ts deleted file mode 100644 index 1351f61530f..00000000000 --- a/tests/cases/fourslash_old/commentsClass.ts +++ /dev/null @@ -1,176 +0,0 @@ -/// - -/////** This is class c2 without constuctor*/ -////class c/*1*/2 { -////} -////var i/*2*/2 = new c/*28*/2(/*3*/); -////var i2/*4*/_c = c/*5*/2; -////class c/*6*/3 { -//// /** Constructor comment*/ -//// constructor() { -//// } -////} -////var i/*7*/3 = new c/*29*/3(/*8*/); -////var i3/*9*/_c = c/*10*/3; -/////** Class comment*/ -////class c/*11*/4 { -//// /** Constructor comment*/ -//// constructor() { -//// } -////} -////var i/*12*/4 = new c/*30*/4(/*13*/); -////var i4/*14*/_c = c/*15*/4; -/////** Class with statics*/ -////class c/*16*/5 { -//// static s1: number; -////} -////var i/*17*/5 = new c/*31*/5(/*18*/); -////var i5_/*19*/c = c/*20*/5; -/////** class with statics and constructor*/ -////class c/*21*/6 { -//// /** s1 comment*/ -//// static s1: number; -//// /** constructor comment*/ -//// constructor() { -//// } -////} -////var i/*22*/6 = new c/*32*/6(/*23*/); -////var i6/*24*/_c = c/*25*/6; -/////*26*/ -////class a { -//// /** -//// constructor for a -//// @param a this is my a -//// */ -//// constructor(a: string) { -//// } -////} -////new a(/*27*/"Hello"); -////module m { -//// export module m2 { -//// /** class comment */ -//// export class c1 { -//// /** constructor comment*/ -//// constructor() { -//// } -//// } -//// } -////} -////var myVar = new m.m2.c/*33*/1(); - -// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.marker('1'); -verify.quickInfoIs(undefined, "This is class c2 without constuctor", "c2", "class"); - -goTo.marker('2'); -verify.quickInfoIs("c2", "", "i2", "var"); - -goTo.marker('3'); -verify.currentSignatureHelpDocCommentIs(""); - -goTo.marker('4'); -verify.quickInfoIs("typeof c2", "", "i2_c", "var"); - -goTo.marker('5'); -verify.quickInfoIs(undefined, "This is class c2 without constuctor", "c2", "class"); - -goTo.marker('6'); -verify.quickInfoIs(undefined, "", "c3", "class"); - -goTo.marker('7'); -verify.quickInfoIs("c3", "", "i3", "var"); - -goTo.marker('8'); -verify.currentSignatureHelpDocCommentIs("Constructor comment"); - -goTo.marker('9'); -verify.quickInfoIs("typeof c3", "", "i3_c", "var"); - -goTo.marker('10'); -verify.quickInfoIs(undefined, "Constructor comment", "c3", "class"); - -goTo.marker('11'); -verify.quickInfoIs(undefined, "Class comment", "c4", "class"); - -goTo.marker('12'); -verify.quickInfoIs("c4", "", "i4", "var"); - -goTo.marker('13'); -verify.currentSignatureHelpDocCommentIs("Constructor comment"); - -goTo.marker('14'); -verify.quickInfoIs("typeof c4", "", "i4_c", "var"); - -goTo.marker('15'); -verify.quickInfoIs(undefined, "Class comment\nConstructor comment", "c4", "class"); - -goTo.marker('16'); -verify.quickInfoIs(undefined, "Class with statics", "c5", "class"); - -goTo.marker('17'); -verify.quickInfoIs("c5", "", "i5", "var"); - -goTo.marker('18'); -verify.currentSignatureHelpDocCommentIs(""); - -goTo.marker('19'); -verify.quickInfoIs("typeof c5", "", "i5_c", "var"); - -goTo.marker('20'); -verify.quickInfoIs(undefined, "Class with statics", "c5", "class"); - -goTo.marker('21'); -verify.quickInfoIs(undefined, "class with statics and constructor", "c6", "class"); - -goTo.marker('22'); -verify.quickInfoIs("c6", "", "i6", "var"); - -goTo.marker('23'); -verify.currentSignatureHelpDocCommentIs("constructor comment"); - -goTo.marker('24'); -verify.quickInfoIs("typeof c6", "", "i6_c", "var"); - -goTo.marker('25'); -verify.quickInfoIs(undefined, "class with statics and constructor\nconstructor comment", "c6", "class"); - -goTo.marker('26'); -verify.completionListContains("c2", undefined, "This is class c2 without constuctor", "c2", "class"); -verify.completionListContains("i2", "c2", "", "i2", "var"); -verify.completionListContains("i2_c", "typeof c2", "", "i2_c", "var"); -verify.completionListContains("c3", undefined, "", "c3", "class"); -verify.completionListContains("i3", "c3", "", "i3", "var"); -verify.completionListContains("i3_c", "typeof c3", "", "i3_c", "var"); -verify.completionListContains("c4", undefined, "Class comment", "c4", "class"); -verify.completionListContains("i4", "c4", "", "i4", "var"); -verify.completionListContains("i4_c", "typeof c4", "", "i4_c", "var"); -verify.completionListContains("c5", undefined, "Class with statics", "c5", "class"); -verify.completionListContains("i5", "c5", "","i5", "var"); -verify.completionListContains("i5_c", "typeof c5", "", "i5_c", "var"); -verify.completionListContains("c6", undefined, "class with statics and constructor", "c6", "class"); -verify.completionListContains("i6", "c6", "", "i6", "var"); -verify.completionListContains("i6_c", "typeof c6", "", "i6_c", "var"); - -goTo.marker('27'); -verify.currentSignatureHelpDocCommentIs("constructor for a"); -verify.currentParameterHelpArgumentDocCommentIs("this is my a"); - -goTo.marker('28'); -verify.quickInfoIs("(): c2", "", "c2", "constructor"); - -goTo.marker('29'); -verify.quickInfoIs("(): c3", "Constructor comment", "c3", "constructor"); - -goTo.marker('30'); -verify.quickInfoIs("(): c4", "Constructor comment", "c4", "constructor"); - -goTo.marker('31'); -verify.quickInfoIs("(): c5", "", "c5", "constructor"); - -goTo.marker('32'); -verify.quickInfoIs("(): c6", "constructor comment", "c6", "constructor"); - -goTo.marker('33'); -verify.quickInfoIs("(): m.m2.c1", "constructor comment", "m.m2.c1", "constructor"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/commentsClassMembers.ts b/tests/cases/fourslash_old/commentsClassMembers.ts deleted file mode 100644 index d3bd041abf0..00000000000 --- a/tests/cases/fourslash_old/commentsClassMembers.ts +++ /dev/null @@ -1,706 +0,0 @@ -/// - -/////** This is comment for c1*/ -////class c/*1*/1 { -//// /** p1 is property of c1*/ -//// public p/*2*/1: number; -//// /** sum with property*/ -//// public p/*3*/2(/** number to add*/b: number) { -//// return this./*4*/p1 + /*5*/b; -//// } -//// /** getter property*/ -//// public get p/*6*/3() { -//// return this./*7*/p/*8q*/2(/*8*/this./*9*/p1); -//// } -//// /** setter property*/ -//// public set p/*10*/3(/** this is value*/value: number) { -//// this./*11*/p1 = this./*12*/p/*13q*/2(/*13*/value); -//// } -//// /** pp1 is property of c1*/ -//// private p/*14*/p1: number; -//// /** sum with property*/ -//// private p/*15*/p2(/** number to add*/b: number) { -//// return this./*16*/p1 + /*17*/b; -//// } -//// /** getter property*/ -//// private get p/*18*/p3() { -//// return this./*19*/p/*20q*/p2(/*20*/this./*21*/pp1); -//// } -//// /** setter property*/ -//// private set p/*22*/p3( /** this is value*/value: number) { -//// this./*23*/pp1 = this./*24*/p/*25q*/p2(/*25*/value); -//// } -//// /** Constructor method*/ -//// constru/*26*/ctor() { -//// } -//// /** s1 is static property of c1*/ -//// static s/*27*/1: number; -//// /** static sum with property*/ -//// static s/*28*/2(/** number to add*/b: number) { -//// return /*29*/c1./*30*/s1 + /*31*/b; -//// } -//// /** static getter property*/ -//// static get s/*32*/3() { -//// return /*33*/c1./*34*/s/*35q*/2(/*35*/c1./*36*/s1); -//// } -//// /** setter property*/ -//// static set s/*37*/3( /** this is value*/value: number) { -//// /*38*/c1./*39*/s1 = /*40*/c1./*41*/s/*42q*/2(/*42*/value); -//// } -//// public nc_/*43*/p1: number; -//// public nc_/*44*/p2(b: number) { -//// return this.nc_p1 + /*45*/b; -//// } -//// public get nc_/*46*/p3() { -//// return this.nc/*47q*/_p2(/*47*/this.nc_p1); -//// } -//// public set nc/*48*/_p3(value: number) { -//// this.nc_p1 = this.nc/*49q*/_p2(/*49*/value); -//// } -//// private nc/*50*/_pp1: number; -//// private nc_/*51*/pp2(b: number) { -//// return this.nc_pp1 + /*52*/b; -//// } -//// private get nc/*53*/_pp3() { -//// return this.nc_/*54q*/pp2(/*54*/this.nc_pp1); -//// } -//// private set nc_p/*55*/p3(value: number) { -//// this.nc_pp1 = this./*56q*/nc_pp2(/*56*/value); -//// } -//// static nc/*57*/_s1: number; -//// static nc/*58*/_s2(b: number) { -//// return c1.nc_s1 + /*59*/b; -//// } -//// static get nc/*60*/_s3() { -//// return c1.nc/*61q*/_s2(/*61*/c1.nc_s1); -//// } -//// static set nc/*62*/_s3(value: number) { -//// c1.nc_s1 = c1.nc_/*63q*/s2(/*63*/value); -//// } -////} -////var i/*64*/1 = new c/*65q*/1(/*65*/); -////var i1/*66*/_p = i1./*67*/p1; -////var i1/*68*/_f = i1.p/*69*/2; -////var i1/*70*/_r = i1.p/*71q*/2(/*71*/20); -////var i1_p/*72*/rop = i1./*73*/p3; -////i1./*74*/p3 = i1_/*75*/prop; -////var i1_/*76*/nc_p = i1.n/*77*/c_p1; -////var i1/*78*/_ncf = i1.nc_/*79*/p2; -////var i1_/*80*/ncr = i1.nc/*81q*/_p2(/*81*/20); -////var i1_n/*82*/cprop = i1.n/*83*/c_p3; -////i1.nc/*84*/_p3 = i1_/*85*/ncprop; -////var i1_/*86*/s_p = /*87*/c1./*88*/s1; -////var i1_s/*89*/_f = c1./*90*/s2; -////var i1_/*91*/s_r = c1.s/*92q*/2(/*92*/20); -////var i1_s/*93*/_prop = c1.s/*94*/3; -////c1.s/*95*/3 = i1_s/*96*/_prop; -////var i1_s/*97*/_nc_p = c1.n/*98*/c_s1; -////var i1_s_/*99*/ncf = c1.nc/*100*/_s2; -////var i1_s_/*101*/ncr = c1.n/*102q*/c_s2(/*102*/20); -////var i1_s_n/*103*/cprop = c1.nc/*104*/_s3; -////c1.nc/*105*/_s3 = i1_s_nc/*106*/prop; -////var i1/*107*/_c = c/*108*/1; -/////*109*/ -////class cProperties { -//// private val: number; -//// /** getter only property*/ -//// public get p1() { -//// return this.val; -//// } -//// public get nc_p1() { -//// return this.val; -//// } -//// /**setter only property*/ -//// public set p2(value: number) { -//// this.val = value; -//// } -//// public set nc_p2(value: number) { -//// this.val = value; -//// } -////} -////var cProperties_i = new cProperties(); -////cProperties_i./*110*/p2 = cProperties_i.p/*111*/1; -////cProperties_i.nc/*112*/_p2 = cProperties_i.nc/*113*/_p1; -////class cWithConstructorProperty { -//// /** -//// * this is class cWithConstructorProperty's constructor -//// * @param a this is first parameter a -//// */ -//// /*119*/constructor(/**more info about a*/public a: number) { -//// var b/*118*/bbb = 10; -//// th/*116*/is./*114*/a = /*115*/a + 2 + bb/*117*/bb; -//// } -////} - -goTo.marker('1'); -verify.quickInfoIs(undefined, "This is comment for c1", "c1", "class"); - -goTo.marker('2'); -verify.quickInfoIs("number", "p1 is property of c1", "c1.p1", "property"); - -goTo.marker('3'); -verify.quickInfoIs("(b: number): number", "sum with property", "c1.p2", "method"); - -goTo.marker('4'); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("pp1", "number", "pp1 is property of c1", "c1.pp1", "property"); -verify.memberListContains("pp2", "(b: number): number", "sum with property", "c1.pp2", "method"); -verify.memberListContains("pp3", "number", "getter property\nsetter property", "c1.pp3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); -verify.memberListContains("nc_pp1", "number", "", "c1.nc_pp1", "property"); -verify.memberListContains("nc_pp2", "(b: number): number", "", "c1.nc_pp2", "method"); -verify.memberListContains("nc_pp3", "number", "", "c1.nc_pp3", "property"); - -goTo.marker('5'); -verify.completionListContains("b", "number", "number to add", "b", "parameter"); - -goTo.marker('6'); -verify.quickInfoIs("number", "getter property\nsetter property", "c1.p3", "property"); - -goTo.marker('7'); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("pp1", "number", "pp1 is property of c1", "c1.pp1", "property"); -verify.memberListContains("pp2", "(b: number): number", "sum with property", "c1.pp2", "method"); -verify.memberListContains("pp3", "number", "getter property\nsetter property", "c1.pp3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); -verify.memberListContains("nc_pp1", "number", "", "c1.nc_pp1", "property"); -verify.memberListContains("nc_pp2", "(b: number): number", "", "c1.nc_pp2", "method"); -verify.memberListContains("nc_pp3", "number", "", "c1.nc_pp3", "property"); - -goTo.marker('8'); -verify.currentSignatureHelpDocCommentIs("sum with property"); -verify.currentParameterHelpArgumentDocCommentIs("number to add"); -goTo.marker('8q'); -verify.quickInfoIs("(b: number): number", "sum with property", "c1.p2", "method"); - -goTo.marker('9'); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("pp1", "number", "pp1 is property of c1", "c1.pp1", "property"); -verify.memberListContains("pp2", "(b: number): number", "sum with property", "c1.pp2", "method"); -verify.memberListContains("pp3", "number", "getter property\nsetter property", "c1.pp3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); -verify.memberListContains("nc_pp1", "number", "", "c1.nc_pp1", "property"); -verify.memberListContains("nc_pp2", "(b: number): number", "", "c1.nc_pp2", "method"); -verify.memberListContains("nc_pp3", "number", "", "c1.nc_pp3", "property"); - -goTo.marker('10'); -verify.quickInfoIs("number", "getter property\nsetter property", "c1.p3", "property"); - -goTo.marker('11'); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("pp1", "number", "pp1 is property of c1", "c1.pp1", "property"); -verify.memberListContains("pp2", "(b: number): number", "sum with property", "c1.pp2", "method"); -verify.memberListContains("pp3", "number", "getter property\nsetter property", "c1.pp3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); -verify.memberListContains("nc_pp1", "number", "", "c1.nc_pp1", "property"); -verify.memberListContains("nc_pp2", "(b: number): number", "", "c1.nc_pp2", "method"); -verify.memberListContains("nc_pp3", "number", "", "c1.nc_pp3", "property"); - -goTo.marker('12'); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("pp1", "number", "pp1 is property of c1", "c1.pp1", "property"); -verify.memberListContains("pp2", "(b: number): number", "sum with property", "c1.pp2", "method"); -verify.memberListContains("pp3", "number", "getter property\nsetter property", "c1.pp3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); -verify.memberListContains("nc_pp1", "number", "", "c1.nc_pp1", "property"); -verify.memberListContains("nc_pp2", "(b: number): number", "", "c1.nc_pp2", "method"); -verify.memberListContains("nc_pp3", "number", "", "c1.nc_pp3", "property"); - -goTo.marker('13'); -verify.currentSignatureHelpDocCommentIs("sum with property"); -verify.currentParameterHelpArgumentDocCommentIs("number to add"); -verify.completionListContains("value", "number", "this is value", "value", "parameter"); -goTo.marker('13q'); -verify.quickInfoIs("(b: number): number", "sum with property", "c1.p2", "method"); - -goTo.marker('14'); -verify.quickInfoIs("number", "pp1 is property of c1", "c1.pp1", "property"); - -goTo.marker('15'); -verify.quickInfoIs("(b: number): number", "sum with property", "c1.pp2", "method"); - -goTo.marker('16'); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("pp1", "number", "pp1 is property of c1", "c1.pp1", "property"); -verify.memberListContains("pp2", "(b: number): number", "sum with property", "c1.pp2", "method"); -verify.memberListContains("pp3", "number", "getter property\nsetter property", "c1.pp3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); -verify.memberListContains("nc_pp1", "number", "", "c1.nc_pp1", "property"); -verify.memberListContains("nc_pp2", "(b: number): number", "", "c1.nc_pp2", "method"); -verify.memberListContains("nc_pp3", "number", "", "c1.nc_pp3", "property"); - -goTo.marker('17'); -verify.completionListContains("b", "number", "number to add", "b", "parameter"); - -goTo.marker('18'); -verify.quickInfoIs("number", "getter property\nsetter property", "c1.pp3", "property"); - -goTo.marker('19'); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("pp1", "number", "pp1 is property of c1", "c1.pp1", "property"); -verify.memberListContains("pp2", "(b: number): number", "sum with property", "c1.pp2", "method"); -verify.memberListContains("pp3", "number", "getter property\nsetter property", "c1.pp3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); -verify.memberListContains("nc_pp1", "number", "", "c1.nc_pp1", "property"); -verify.memberListContains("nc_pp2", "(b: number): number", "", "c1.nc_pp2", "method"); -verify.memberListContains("nc_pp3", "number", "", "c1.nc_pp3", "property"); - -goTo.marker('20'); -verify.currentSignatureHelpDocCommentIs("sum with property"); -verify.currentParameterHelpArgumentDocCommentIs("number to add"); -goTo.marker('20q'); -verify.quickInfoIs("(b: number): number", "sum with property", "c1.pp2", "method"); - -goTo.marker('21'); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("pp1", "number", "pp1 is property of c1", "c1.pp1", "property"); -verify.memberListContains("pp2", "(b: number): number", "sum with property", "c1.pp2", "method"); -verify.memberListContains("pp3", "number", "getter property\nsetter property", "c1.pp3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); -verify.memberListContains("nc_pp1", "number", "", "c1.nc_pp1", "property"); -verify.memberListContains("nc_pp2", "(b: number): number", "", "c1.nc_pp2", "method"); -verify.memberListContains("nc_pp3", "number", "", "c1.nc_pp3", "property"); - -goTo.marker('22'); -verify.quickInfoIs("number", "getter property\nsetter property", "c1.pp3", "property"); - -goTo.marker('23'); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("pp1", "number", "pp1 is property of c1", "c1.pp1", "property"); -verify.memberListContains("pp2", "(b: number): number", "sum with property", "c1.pp2", "method"); -verify.memberListContains("pp3", "number", "getter property\nsetter property", "c1.pp3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); -verify.memberListContains("nc_pp1", "number", "", "c1.nc_pp1", "property"); -verify.memberListContains("nc_pp2", "(b: number): number", "", "c1.nc_pp2", "method"); -verify.memberListContains("nc_pp3", "number", "", "c1.nc_pp3", "property"); - -goTo.marker('24'); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("pp1", "number", "pp1 is property of c1", "c1.pp1", "property"); -verify.memberListContains("pp2", "(b: number): number", "sum with property", "c1.pp2", "method"); -verify.memberListContains("pp3", "number", "getter property\nsetter property", "c1.pp3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); -verify.memberListContains("nc_pp1", "number", "", "c1.nc_pp1", "property"); -verify.memberListContains("nc_pp2", "(b: number): number", "", "c1.nc_pp2", "method"); -verify.memberListContains("nc_pp3", "number", "", "c1.nc_pp3", "property"); - -goTo.marker('25'); -verify.currentSignatureHelpDocCommentIs("sum with property"); -verify.currentParameterHelpArgumentDocCommentIs("number to add"); -verify.completionListContains("value", "number", "this is value", "value", "parameter"); -goTo.marker('25q'); -verify.quickInfoIs("(b: number): number", "sum with property", "c1.pp2", "method"); - -goTo.marker('26'); -verify.quickInfoIs("(): c1", "Constructor method", "c1", "constructor"); - -goTo.marker('27'); -verify.quickInfoIs("number", "s1 is static property of c1", "c1.s1", "property"); - -goTo.marker('28'); -verify.quickInfoIs("(b: number): number", "static sum with property", "c1.s2", "method"); - -goTo.marker('29'); -verify.completionListContains("c1", undefined, "This is comment for c1", "c1", "class"); - -goTo.marker('30'); -verify.memberListContains("s1", "number", "s1 is static property of c1", "c1.s1", "property"); -verify.memberListContains("s2", "(b: number): number", "static sum with property", "c1.s2", "method"); -verify.memberListContains("s3", "number", "static getter property\nsetter property", "c1.s3", "property"); -verify.memberListContains("nc_s1", "number", "", "c1.nc_s1", "property"); -verify.memberListContains("nc_s2", "(b: number): number", "", "c1.nc_s2", "method"); -verify.memberListContains("nc_s3", "number", "", "c1.nc_s3", "property"); - -goTo.marker('31'); -verify.completionListContains("b", "number", "number to add", "b", "parameter"); - -goTo.marker('32'); -verify.quickInfoIs("number", "static getter property\nsetter property", "c1.s3", "property"); - -goTo.marker('33'); -verify.completionListContains("c1", undefined, "This is comment for c1", "c1", "class"); - -goTo.marker('34'); -verify.memberListContains("s1", "number", "s1 is static property of c1", "c1.s1", "property"); -verify.memberListContains("s2", "(b: number): number", "static sum with property", "c1.s2", "method"); -verify.memberListContains("s3", "number", "static getter property\nsetter property", "c1.s3", "property"); -verify.memberListContains("nc_s1", "number", "", "c1.nc_s1", "property"); -verify.memberListContains("nc_s2", "(b: number): number", "", "c1.nc_s2", "method"); -verify.memberListContains("nc_s3", "number", "", "c1.nc_s3", "property"); - -goTo.marker('35'); -verify.currentSignatureHelpDocCommentIs("static sum with property"); -verify.currentParameterHelpArgumentDocCommentIs("number to add"); -verify.completionListContains("c1", undefined, "This is comment for c1", "c1", "class"); -goTo.marker('35q'); -verify.quickInfoIs("(b: number): number", "static sum with property", "c1.s2", "method"); - -goTo.marker('36'); -verify.memberListContains("s1", "number", "s1 is static property of c1", "c1.s1", "property"); -verify.memberListContains("s2", "(b: number): number", "static sum with property", "c1.s2", "method"); -verify.memberListContains("s3", "number", "static getter property\nsetter property", "c1.s3", "property"); -verify.memberListContains("nc_s1", "number", "", "c1.nc_s1", "property"); -verify.memberListContains("nc_s2", "(b: number): number", "", "c1.nc_s2", "method"); -verify.memberListContains("nc_s3", "number", "", "c1.nc_s3", "property"); - -goTo.marker('37'); -verify.quickInfoIs("number", "static getter property\nsetter property", "c1.s3", "property"); - -goTo.marker('38'); -verify.completionListContains("c1", undefined, "This is comment for c1", "c1", "class"); - -goTo.marker('39'); -verify.memberListContains("s1", "number", "s1 is static property of c1", "c1.s1", "property"); -verify.memberListContains("s2", "(b: number): number", "static sum with property", "c1.s2", "method"); -verify.memberListContains("s3", "number", "static getter property\nsetter property", "c1.s3", "property"); -verify.memberListContains("nc_s1", "number", "", "c1.nc_s1", "property"); -verify.memberListContains("nc_s2", "(b: number): number", "", "c1.nc_s2", "method"); -verify.memberListContains("nc_s3", "number", "", "c1.nc_s3", "property"); - -goTo.marker('40'); -verify.completionListContains("c1", undefined, "This is comment for c1", "c1", "class"); - -goTo.marker('41'); -verify.memberListContains("s1", "number", "s1 is static property of c1", "c1.s1", "property"); -verify.memberListContains("s2", "(b: number): number", "static sum with property", "c1.s2", "method"); -verify.memberListContains("s3", "number", "static getter property\nsetter property", "c1.s3", "property"); -verify.memberListContains("nc_s1", "number", "", "c1.nc_s1", "property"); -verify.memberListContains("nc_s2", "(b: number): number", "", "c1.nc_s2", "method"); -verify.memberListContains("nc_s3", "number", "", "c1.nc_s3", "property"); - -goTo.marker('42'); -verify.currentSignatureHelpDocCommentIs("static sum with property"); -verify.currentParameterHelpArgumentDocCommentIs("number to add"); -verify.completionListContains("value", "number", "this is value", "value", "parameter"); -goTo.marker('42q'); -verify.quickInfoIs("(b: number): number", "static sum with property", "c1.s2", "method"); - -goTo.marker('43'); -verify.quickInfoIs("number", "", "c1.nc_p1", "property"); - -goTo.marker('44'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_p2", "method"); - -goTo.marker('45'); -verify.completionListContains("b", "number", "", "b", "parameter"); - -goTo.marker('46'); -verify.quickInfoIs("number", "", "c1.nc_p3", "property"); - -goTo.marker('47'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -goTo.marker('47q'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_p2", "method"); - -goTo.marker('48'); -verify.quickInfoIs("number", "", "c1.nc_p3", "property"); - -goTo.marker('49'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -verify.completionListContains("value", "number", "", "value", "parameter"); -goTo.marker('49q'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_p2", "method"); - -goTo.marker('50'); -verify.quickInfoIs("number", "", "c1.nc_pp1", "property"); - -goTo.marker('51'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_pp2", "method"); - -goTo.marker('52'); -verify.completionListContains("b", "number", "", "b", "parameter"); - -goTo.marker('53'); -verify.quickInfoIs("number", "", "c1.nc_pp3", "property"); - -goTo.marker('54'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -goTo.marker('54q'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_pp2", "method"); - -goTo.marker('55'); -verify.quickInfoIs("number", "", "c1.nc_pp3", "property"); - -goTo.marker('56'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -verify.completionListContains("value", "number", "", "value", "parameter"); -goTo.marker('56q'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_pp2", "method"); - -goTo.marker('57'); -verify.quickInfoIs("number", "", "c1.nc_s1", "property"); - -goTo.marker('58'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_s2", "method"); - -goTo.marker('59'); -verify.completionListContains("b", "number", "", "b", "parameter"); - -goTo.marker('60'); -verify.quickInfoIs("number", "", "c1.nc_s3", "property"); - -goTo.marker('61'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -goTo.marker('61q'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_s2", "method"); - -goTo.marker('62'); -verify.quickInfoIs("number", "", "c1.nc_s3", "property"); - -goTo.marker('63'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -verify.completionListContains("value", "number", "", "value", "parameter"); -goTo.marker('63q'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_s2", "method"); - -goTo.marker('64'); -verify.quickInfoIs("c1", "", "i1", "var"); - -goTo.marker('65'); -verify.currentSignatureHelpDocCommentIs("Constructor method"); -goTo.marker('65q'); -verify.quickInfoIs("(): c1", "Constructor method", "c1", "constructor"); - -goTo.marker('66'); -verify.quickInfoIs("number", "", "i1_p", "var"); - -goTo.marker('67'); -verify.quickInfoIs("number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p1", "number", "p1 is property of c1", "c1.p1", "property"); -verify.memberListContains("p2", "(b: number): number", "sum with property", "c1.p2", "method"); -verify.memberListContains("p3", "number", "getter property\nsetter property", "c1.p3", "property"); -verify.memberListContains("nc_p1", "number", "", "c1.nc_p1", "property"); -verify.memberListContains("nc_p2", "(b: number): number", "", "c1.nc_p2", "method"); -verify.memberListContains("nc_p3", "number", "", "c1.nc_p3", "property"); - -goTo.marker('68'); -verify.quickInfoIs("(b: number) => number", "", "i1_f", "var"); - -goTo.marker('69'); -verify.quickInfoIs("(b: number): number", "sum with property", "c1.p2", "method"); - -goTo.marker('70'); -verify.quickInfoIs("number", "", "i1_r", "var"); - -goTo.marker('71'); -verify.currentSignatureHelpDocCommentIs("sum with property"); -verify.currentParameterHelpArgumentDocCommentIs("number to add"); -goTo.marker('71q'); -verify.quickInfoIs("(b: number): number", "sum with property", "c1.p2", "method"); - -goTo.marker('72'); -verify.quickInfoIs("number", "", "i1_prop", "var"); -goTo.marker('73'); -verify.quickInfoIs("number", "getter property\nsetter property", "c1.p3", "property"); -goTo.marker('74'); -verify.quickInfoIs("number", "getter property\nsetter property", "c1.p3", "property"); -goTo.marker('75'); -verify.quickInfoIs("number", "", "i1_prop", "var"); - -goTo.marker('76'); -verify.quickInfoIs("number", "", "i1_nc_p", "var"); - -goTo.marker('77'); -verify.quickInfoIs("number", "", "c1.nc_p1", "property"); - -goTo.marker('78'); -verify.quickInfoIs("(b: number) => number", "", "i1_ncf", "var"); - -goTo.marker('79'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_p2", "method"); - -goTo.marker('80'); -verify.quickInfoIs("number", "", "i1_ncr", "var"); - -goTo.marker('81'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -goTo.marker('81q'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_p2", "method"); - -goTo.marker('82'); -verify.quickInfoIs("number", "", "i1_ncprop", "var"); -goTo.marker('83'); -verify.quickInfoIs("number", "", "c1.nc_p3", "property"); -goTo.marker('84'); -verify.quickInfoIs("number", "", "c1.nc_p3", "property"); -goTo.marker('85'); -verify.quickInfoIs("number", "", "i1_ncprop", "var"); - -goTo.marker('86'); -verify.quickInfoIs("number", "", "i1_s_p", "var"); - -goTo.marker('87'); -verify.quickInfoIs(undefined, "This is comment for c1\nConstructor method", "c1", "class"); -verify.completionListContains("c1", undefined, "This is comment for c1", "c1", "class"); - -goTo.marker('88'); -verify.quickInfoIs("number", "s1 is static property of c1", "c1.s1", "property"); -verify.memberListContains("s1", "number", "s1 is static property of c1", "c1.s1", "property"); -verify.memberListContains("s2", "(b: number): number", "static sum with property", "c1.s2", "method"); -verify.memberListContains("s3", "number", "static getter property\nsetter property", "c1.s3", "property"); -verify.memberListContains("nc_s1", "number", "", "c1.nc_s1", "property"); -verify.memberListContains("nc_s2", "(b: number): number", "", "c1.nc_s2", "method"); -verify.memberListContains("nc_s3", "number", "", "c1.nc_s3", "property"); - -goTo.marker('89'); -verify.quickInfoIs("(b: number) => number", "", "i1_s_f", "var"); - -goTo.marker('90'); -verify.quickInfoIs("(b: number): number", "static sum with property", "c1.s2", "method"); - -goTo.marker('91'); -verify.quickInfoIs("number", "", "i1_s_r", "var"); - -goTo.marker('92'); -verify.currentSignatureHelpDocCommentIs("static sum with property"); -verify.currentParameterHelpArgumentDocCommentIs("number to add"); -goTo.marker('92q'); -verify.quickInfoIs("(b: number): number", "static sum with property", "c1.s2", "method"); - -goTo.marker('93'); -verify.quickInfoIs("number", "", "i1_s_prop", "var"); -goTo.marker('94'); -verify.quickInfoIs("number", "static getter property\nsetter property", "c1.s3", "property"); -goTo.marker('95'); -verify.quickInfoIs("number", "static getter property\nsetter property", "c1.s3", "property"); -goTo.marker('96'); -verify.quickInfoIs("number", "", "i1_s_prop", "var"); - -goTo.marker('97'); -verify.quickInfoIs("number", "", "i1_s_nc_p", "var"); - -goTo.marker('98'); -verify.quickInfoIs("number", "", "c1.nc_s1", "property"); - -goTo.marker('99'); -verify.quickInfoIs("(b: number) => number", "", "i1_s_ncf", "var"); - -goTo.marker('100'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_s2", "method"); - -goTo.marker('101'); -verify.quickInfoIs("number", "", "i1_s_ncr", "var"); - -goTo.marker('102'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -goTo.marker('102q'); -verify.quickInfoIs("(b: number): number", "", "c1.nc_s2", "method"); - -goTo.marker('103'); -verify.quickInfoIs("number", "", "i1_s_ncprop", "var"); -goTo.marker('104'); -verify.quickInfoIs("number", "", "c1.nc_s3", "property"); -goTo.marker('105'); -verify.quickInfoIs("number", "", "c1.nc_s3", "property"); -goTo.marker('106'); -verify.quickInfoIs("number", "", "i1_s_ncprop", "var"); - -goTo.marker('107'); -verify.quickInfoIs("typeof c1", "", "i1_c", "var"); - -goTo.marker('108'); -verify.quickInfoIs(undefined, "This is comment for c1\nConstructor method", "c1", "class"); - -goTo.marker('109'); -verify.completionListContains("c1", undefined, "This is comment for c1", "c1", "class"); -verify.completionListContains("i1", "c1", "", "i1", "var"); -verify.completionListContains("i1_p", "number", "", "i1_p", "var"); -verify.completionListContains("i1_f", "(b: number) => number", "", "i1_f", "var"); -verify.completionListContains("i1_r", "number", "", "i1_r", "var"); -verify.completionListContains("i1_prop", "number", "", "i1_prop", "var"); -verify.completionListContains("i1_nc_p", "number", "", "i1_nc_p", "var"); -verify.completionListContains("i1_ncf", "(b: number) => number", "", "i1_ncf", "var"); -verify.completionListContains("i1_ncr", "number", "", "i1_ncr", "var"); -verify.completionListContains("i1_ncprop", "number", "", "i1_ncprop", "var"); -verify.completionListContains("i1_s_p", "number", "", "i1_s_p", "var"); -verify.completionListContains("i1_s_f", "(b: number) => number", "", "i1_s_f", "var"); -verify.completionListContains("i1_s_r", "number", "", "i1_s_r", "var"); -verify.completionListContains("i1_s_prop", "number", "", "i1_s_prop", "var"); -verify.completionListContains("i1_s_nc_p", "number", "", "i1_s_nc_p", "var"); -verify.completionListContains("i1_s_ncf", "(b: number) => number", "", "i1_s_ncf", "var"); -verify.completionListContains("i1_s_ncr", "number", "", "i1_s_ncr", "var"); -verify.completionListContains("i1_s_ncprop", "number", "", "i1_s_ncprop", "var"); - -verify.completionListContains("i1_c", "typeof c1", "", "i1_c", "var"); - -goTo.marker('110'); -verify.quickInfoIs("number", "setter only property", "cProperties.p2", "property"); -verify.memberListContains("p1", "number", "getter only property", "cProperties.p1", "property"); -verify.memberListContains("p2", "number", "setter only property", "cProperties.p2", "property"); -verify.memberListContains("nc_p1", "number", "", "cProperties.nc_p1", "property"); -verify.memberListContains("nc_p2", "number", "", "cProperties.nc_p2", "property"); - -goTo.marker('111'); -verify.quickInfoIs("number", "getter only property", "cProperties.p1", "property"); -goTo.marker('112'); -verify.quickInfoIs("number", "", "cProperties.nc_p2", "property"); -goTo.marker('113'); -verify.quickInfoIs("number", "", "cProperties.nc_p1", "property"); - -goTo.marker('114'); -verify.memberListContains("a", "number", "more info about a", "cWithConstructorProperty.a", "property"); -verify.quickInfoIs("number", "more info about a", "cWithConstructorProperty.a", "property"); - -goTo.marker('115'); -verify.completionListContains("a", "number", "this is first parameter a\nmore info about a", "a", "parameter"); -verify.quickInfoIs("number", "this is first parameter a\nmore info about a", "a", "parameter"); - -goTo.marker('116'); -verify.quickInfoIs("cWithConstructorProperty", "", "cWithConstructorProperty", "class"); - -goTo.marker('117'); -verify.quickInfoIs("number", "", "bbbb", "local var"); - -goTo.marker('118'); -verify.quickInfoIs("number", "", "bbbb", "local var"); - -goTo.marker('119'); -verify.quickInfoIs("(a: number): cWithConstructorProperty", "this is class cWithConstructorProperty's constructor", "cWithConstructorProperty", "constructor"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/commentsEnums.ts b/tests/cases/fourslash_old/commentsEnums.ts deleted file mode 100644 index ed99eda23f9..00000000000 --- a/tests/cases/fourslash_old/commentsEnums.ts +++ /dev/null @@ -1,37 +0,0 @@ -/// - -/////** Enum of colors*/ -////enum /*1*/Colors { -//// /** Fancy name for 'blue'*/ -//// /*2*/Cornflower, -//// /** Fancy name for 'pink'*/ -//// /*3*/FancyPink -////} -////var /*4*/x = /*5*/Colors./*6*/Cornflower; -////x = Colors./*7*/FancyPink; - -goTo.marker('1'); -verify.quickInfoIs("Colors", "Enum of colors", "Colors", "enum"); - -goTo.marker('2'); -verify.quickInfoIs("Colors", "Fancy name for 'blue'", "Colors.Cornflower", "property"); - -goTo.marker('3'); -verify.quickInfoIs("Colors", "Fancy name for 'pink'", "Colors.FancyPink", "property"); - -goTo.marker('4'); -verify.quickInfoIs("Colors", "", "x", "var"); - -goTo.marker('5'); -verify.completionListContains("Colors", "Colors", "Enum of colors", "Colors", "enum"); -verify.quickInfoIs("typeof Colors", "Enum of colors", "Colors", "enum"); - -goTo.marker('6'); -verify.memberListContains("Cornflower", "Colors", "Fancy name for 'blue'", "Colors.Cornflower", "property"); -verify.memberListContains("FancyPink", "Colors", "Fancy name for 'pink'", "Colors.FancyPink", "property"); -verify.quickInfoIs("Colors", "Fancy name for 'blue'", "Colors.Cornflower", "property"); - -goTo.marker('7'); -verify.memberListContains("Cornflower", "Colors", "Fancy name for 'blue'", "Colors.Cornflower", "property"); -verify.memberListContains("FancyPink", "Colors", "Fancy name for 'pink'", "Colors.FancyPink", "property"); -verify.quickInfoIs("Colors", "Fancy name for 'pink'", "Colors.FancyPink", "property"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/commentsExternalModules.ts b/tests/cases/fourslash_old/commentsExternalModules.ts deleted file mode 100644 index 55a8d720a6f..00000000000 --- a/tests/cases/fourslash_old/commentsExternalModules.ts +++ /dev/null @@ -1,95 +0,0 @@ -/// - -// @Filename: commentsExternalModules_file0.ts -/////** Module comment*/ -////export module m/*1*/1 { -//// /** b's comment*/ -//// export var b: number; -//// /** foo's comment*/ -//// function foo() { -//// return /*2*/b; -//// } -//// /** m2 comments*/ -//// export module m2 { -//// /** class comment;*/ -//// export class c { -//// }; -//// /** i*/ -//// export var i = new c(); -//// } -//// /** exported function*/ -//// export function fooExport() { -//// return f/*3q*/oo(/*3*/); -//// } -////} -/////*4*/m1./*5*/fooEx/*6q*/port(/*6*/); -////var my/*7*/var = new m1.m2./*8*/c(); - -// @Filename: commentsExternalModules_file1.ts -/////**This is on import declaration*/ -////import ex/*9*/tMod = require("commentsExternalModules_file0"); -/////*10*/extMod./*11*/m1./*12*/fooExp/*13q*/ort(/*13*/); -////var new/*14*/Var = new extMod.m1.m2./*15*/c(); - -// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.file("commentsExternalModules_file0.ts"); -goTo.marker('1'); -verify.quickInfoIs("m1", "Module comment", "m1", "module"); - -goTo.marker('2'); -verify.completionListContains("b", "number", "b's comment", "m1.b", "var"); -verify.completionListContains("foo", "(): number", "foo's comment", "foo", "function"); - -goTo.marker('3'); -verify.currentSignatureHelpDocCommentIs("foo's comment"); -goTo.marker('3q'); -verify.quickInfoIs("(): number", "foo's comment", "foo", "function"); - -goTo.marker('4'); -verify.completionListContains("m1", "m1", "Module comment", "m1", "module"); - -goTo.marker('5'); -verify.memberListContains("b", "number", "b's comment", "m1.b", "var"); -verify.memberListContains("fooExport", "(): number", "exported function", "m1.fooExport", "function"); -verify.memberListContains("m2", "m1.m2"); - -goTo.marker('6'); -verify.currentSignatureHelpDocCommentIs("exported function"); -goTo.marker('6q'); -verify.quickInfoIs("(): number", "exported function", "m1.fooExport", "function"); - -goTo.marker('7'); -verify.quickInfoIs("m1.m2.c", "", "myvar", "var"); - -goTo.marker('8'); -verify.memberListContains("c", undefined, "class comment;", "m1.m2.c", "class"); -verify.memberListContains("i", "m1.m2.c", "i", "m1.m2.i", "var"); - -goTo.file("commentsExternalModules_file1.ts"); -goTo.marker('9'); -verify.quickInfoIs(undefined, "This is on import declaration", "extMod", "module"); - -goTo.marker('10'); -verify.completionListContains("extMod", "extMod", "This is on import declaration", "extMod", "module"); - -goTo.marker('11'); -verify.memberListContains("m1", "extMod.m1"); - -goTo.marker('12'); -verify.memberListContains("b", "number", "b's comment", "extMod.m1.b", "var"); -verify.memberListContains("fooExport", "(): number", "exported function", "extMod.m1.fooExport", "function"); -verify.memberListContains("m2", "extMod.m1.m2"); - -goTo.marker('13'); -verify.currentSignatureHelpDocCommentIs("exported function"); -goTo.marker('13q'); -verify.quickInfoIs("(): number", "exported function", "extMod.m1.fooExport", "function"); - -goTo.marker('14'); -verify.quickInfoIs("extMod.m1.m2.c", "", "newVar", "var"); - -goTo.marker('15'); -verify.memberListContains("c", undefined, "class comment;", "extMod.m1.m2.c", "class"); -verify.memberListContains("i", "extMod.m1.m2.c", "i", "extMod.m1.m2.i", "var"); diff --git a/tests/cases/fourslash_old/commentsInheritance.ts b/tests/cases/fourslash_old/commentsInheritance.ts deleted file mode 100644 index cb87ef0d6ab..00000000000 --- a/tests/cases/fourslash_old/commentsInheritance.ts +++ /dev/null @@ -1,672 +0,0 @@ -/// - -/////** i1 is interface with properties*/ -////interface i1 { -//// /** i1_p1*/ -//// i1_p1: number; -//// /** i1_f1*/ -//// i1_f1(): void; -//// /** i1_l1*/ -//// i1_l1: () => void; -//// i1_nc_p1: number; -//// i1_nc_f1(): void; -//// i1_nc_l1: () => void; -//// p1: number; -//// f1(): void; -//// l1: () => void; -//// nc_p1: number; -//// nc_f1(): void; -//// nc_l1: () => void; -////} -////class c1 implements i1 { -//// public i1_p1: number; -//// public i1_f1() { -//// } -//// public i1_l1: () => void; -//// public i1_nc_p1: number; -//// public i1_nc_f1() { -//// } -//// public i1_nc_l1: () => void; -//// /** c1_p1*/ -//// public p1: number; -//// /** c1_f1*/ -//// public f1() { -//// } -//// /** c1_l1*/ -//// public l1: () => void; -//// /** c1_nc_p1*/ -//// public nc_p1: number; -//// /** c1_nc_f1*/ -//// public nc_f1() { -//// } -//// /** c1_nc_l1*/ -//// public nc_l1: () => void; -////} -////var i1/*1iq*/_i: i1; -////i1_i./*1*/i/*2q*/1_f1(/*2*/); -////i1_i.i1_n/*3q*/c_f1(/*3*/); -////i1_i.f/*4q*/1(/*4*/); -////i1_i.nc/*5q*/_f1(/*5*/); -////i1_i.i1/*l2q*/_l1(/*l2*/); -////i1_i.i1_/*l3q*/nc_l1(/*l3*/); -////i1_i.l/*l4q*/1(/*l4*/); -////i1_i.nc/*l5q*/_l1(/*l5*/); -////var c1/*6iq*/_i = new c1(); -////c1_i./*6*/i1/*7q*/_f1(/*7*/); -////c1_i.i1_nc/*8q*/_f1(/*8*/); -////c1_i.f/*9q*/1(/*9*/); -////c1_i.nc/*10q*/_f1(/*10*/); -////c1_i.i1/*l7q*/_l1(/*l7*/); -////c1_i.i1_n/*l8q*/c_l1(/*l8*/); -////c1_i.l/*l9q*/1(/*l9*/); -////c1_i.nc/*l10q*/_l1(/*l10*/); -////// assign to interface -////i1_i = c1_i; -////i1_i./*11*/i1/*12q*/_f1(/*12*/); -////i1_i.i1_nc/*13q*/_f1(/*13*/); -////i1_i.f/*14q*/1(/*14*/); -////i1_i.nc/*15q*/_f1(/*15*/); -////i1_i.i1/*l12q*/_l1(/*l12*/); -////i1_i.i1/*l13q*/_nc_l1(/*l13*/); -////i1_i.l/*l14q*/1(/*l14*/); -////i1_i.nc/*l15q*/_l1(/*l15*/); -/////*16*/ -////class c2 { -//// /** c2 c2_p1*/ -//// public c2_p1: number; -//// /** c2 c2_f1*/ -//// public c2_f1() { -//// } -//// /** c2 c2_prop*/ -//// public get c2_prop() { -//// return 10; -//// } -//// public c2_nc_p1: number; -//// public c2_nc_f1() { -//// } -//// public get c2_nc_prop() { -//// return 10; -//// } -//// /** c2 p1*/ -//// public p1: number; -//// /** c2 f1*/ -//// public f1() { -//// } -//// /** c2 prop*/ -//// public get prop() { -//// return 10; -//// } -//// public nc_p1: number; -//// public nc_f1() { -//// } -//// public get nc_prop() { -//// return 10; -//// } -//// /** c2 constructor*/ -//// constr/*55*/uctor(a: number) { -//// this.c2_p1 = a; -//// } -////} -////class c3 extends c2 { -//// cons/*56*/tructor() { -//// su/*18sq*/per(10); -//// this.p1 = s/*18spropq*/uper./*18spropProp*/c2_p1; -//// } -//// /** c3 p1*/ -//// public p1: number; -//// /** c3 f1*/ -//// public f1() { -//// } -//// /** c3 prop*/ -//// public get prop() { -//// return 10; -//// } -//// public nc_p1: number; -//// public nc_f1() { -//// } -//// public get nc_prop() { -//// return 10; -//// } -////} -////var c/*17iq*/2_i = new c/*17q*/2(/*17*/10); -////var c/*18iq*/3_i = new c/*18q*/3(/*18*/); -////c2_i./*19*/c2/*20q*/_f1(/*20*/); -////c2_i.c2_nc/*21q*/_f1(/*21*/); -////c2_i.f/*22q*/1(/*22*/); -////c2_i.nc/*23q*/_f1(/*23*/); -////c3_i./*24*/c2/*25q*/_f1(/*25*/); -////c3_i.c2_nc/*26q*/_f1(/*26*/); -////c3_i.f/*27q*/1(/*27*/); -////c3_i.nc/*28q*/_f1(/*28*/); -////// assign -////c2_i = c3_i; -////c2_i./*29*/c2/*30q*/_f1(/*30*/); -////c2_i.c2_nc_/*31q*/f1(/*31*/); -////c2_i.f/*32q*/1(/*32*/); -////c2_i.nc/*33q*/_f1(/*33*/); -////class c4 extends c2 { -////} -////var c4/*34iq*/_i = new c/*34q*/4(/*34*/10); -/////*35*/ -////interface i2 { -//// /** i2_p1*/ -//// i2_p1: number; -//// /** i2_f1*/ -//// i2_f1(): void; -//// /** i2_l1*/ -//// i2_l1: () => void; -//// i2_nc_p1: number; -//// i2_nc_f1(): void; -//// i2_nc_l1: () => void; -//// /** i2 p1*/ -//// p1: number; -//// /** i2 f1*/ -//// f1(): void; -//// /** i2 l1*/ -//// l1: () => void; -//// nc_p1: number; -//// nc_f1(): void; -//// nc_l1: () => void; -////} -////interface i3 extends i2 { -//// /** i3 p1*/ -//// p1: number; -//// /** i3 f1*/ -//// f1(): void; -//// /** i3 l1*/ -//// l1: () => void; -//// nc_p1: number; -//// nc_f1(): void; -//// nc_l1: () => void; -////} -////var i2/*36iq*/_i: i2; -////var i3/*37iq*/_i: i3; -////i2_i./*36*/i2/*37q*/_f1(/*37*/); -////i2_i.i2_n/*38q*/c_f1(/*38*/); -////i2_i.f/*39q*/1(/*39*/); -////i2_i.nc/*40q*/_f1(/*40*/); -////i2_i.i2_/*l37q*/l1(/*l37*/); -////i2_i.i2_nc/*l38q*/_l1(/*l38*/); -////i2_i.l/*l39q*/1(/*l39*/); -////i2_i.nc_/*l40q*/l1(/*l40*/); -////i3_i./*41*/i2_/*42q*/f1(/*42*/); -////i3_i.i2_nc/*43q*/_f1(/*43*/); -////i3_i.f/*44q*/1(/*44*/); -////i3_i.nc_/*45q*/f1(/*45*/); -////i3_i.i2_/*l42q*/l1(/*l42*/); -////i3_i.i2_nc/*l43q*/_l1(/*l43*/); -////i3_i.l/*l44q*/1(/*l44*/); -////i3_i.nc_/*l45q*/l1(/*l45*/); -////// assign to interface -////i2_i = i3_i; -////i2_i./*46*/i2/*47q*/_f1(/*47*/); -////i2_i.i2_nc_/*48q*/f1(/*48*/); -////i2_i.f/*49q*/1(/*49*/); -////i2_i.nc/*50q*/_f1(/*50*/); -////i2_i.i2_/*l47q*/l1(/*l47*/); -////i2_i.i2_nc/*l48q*/_l1(/*l48*/); -////i2_i.l/*l49q*/1(/*l49*/); -////i2_i.nc_/*l50q*/l1(/*l50*/); -/////*51*/ -/////**c5 class*/ -////class c5 { -//// public b: number; -////} -////class c6 extends c5 { -//// public d; -//// const/*57*/ructor() { -//// /*52*/super(); -//// this.d = /*53*/super./*54*/b; -//// } -////} - -goTo.marker('1'); -verify.memberListContains("i1_p1", "number", "i1_p1", "i1.i1_p1", "property"); -verify.memberListContains("i1_f1", "(): void", "i1_f1", "i1.i1_f1", "method"); -verify.memberListContains("i1_l1", "() => void", "i1_l1", "i1.i1_l1", "property"); -verify.memberListContains("i1_nc_p1", "number", "", "i1.i1_nc_p1", "property"); -verify.memberListContains("i1_nc_f1", "(): void", "", "i1.i1_nc_f1", "method"); -verify.memberListContains("i1_nc_l1", "() => void", "", "i1.i1_nc_l1", "property"); -verify.memberListContains("p1", "number", "", "i1.p1", "property"); -verify.memberListContains("f1", "(): void", "", "i1.f1", "method"); -verify.memberListContains("l1", "() => void", "", "i1.l1", "property"); -verify.memberListContains("nc_p1", "number", "", "i1.nc_p1", "property"); -verify.memberListContains("nc_f1", "(): void", "", "i1.nc_f1", "method"); -verify.memberListContains("nc_l1", "() => void", "", "i1.nc_l1", "property"); -goTo.marker('2'); -verify.currentSignatureHelpDocCommentIs("i1_f1"); -goTo.marker('3'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('4'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('5'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l2'); -verify.currentSignatureHelpDocCommentIs("i1_l1"); -goTo.marker('l3'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l4'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l5'); -verify.currentSignatureHelpDocCommentIs(""); - -goTo.marker('1iq'); -verify.quickInfoIs("i1", "", "i1_i", "var"); -goTo.marker('2q'); -verify.quickInfoIs("(): void", "i1_f1", "i1.i1_f1", "method"); -goTo.marker('3q'); -verify.quickInfoIs("(): void", "", "i1.i1_nc_f1", "method"); -goTo.marker('4q'); -verify.quickInfoIs("(): void", "", "i1.f1", "method"); -goTo.marker('5q'); -verify.quickInfoIs("(): void", "", "i1.nc_f1", "method"); -goTo.marker('l2q'); -verify.quickInfoIs("() => void", "i1_l1", "i1.i1_l1", "property"); -goTo.marker('l3q'); -verify.quickInfoIs("() => void", "", "i1.i1_nc_l1", "property"); -goTo.marker('l4q'); -verify.quickInfoIs("() => void", "", "i1.l1", "property"); -goTo.marker('l5q'); -verify.quickInfoIs("() => void", "", "i1.nc_l1", "property"); - -goTo.marker('6'); -verify.memberListContains("i1_p1", "number", "", "c1.i1_p1", "property"); -verify.memberListContains("i1_f1", "(): void", "", "c1.i1_f1", "method"); -verify.memberListContains("i1_l1", "() => void", "", "c1.i1_l1", "property"); -verify.memberListContains("i1_nc_p1", "number", "", "c1.i1_nc_p1", "property"); -verify.memberListContains("i1_nc_f1", "(): void", "", "c1.i1_nc_f1", "method"); -verify.memberListContains("i1_nc_l1", "() => void", "", "c1.i1_nc_l1", "property"); -verify.memberListContains("p1", "number", "c1_p1", "c1.p1", "property"); -verify.memberListContains("f1", "(): void", "c1_f1", "c1.f1", "method"); -verify.memberListContains("l1", "() => void", "c1_l1", "c1.l1", "property"); -verify.memberListContains("nc_p1", "number", "c1_nc_p1", "c1.nc_p1", "property"); -verify.memberListContains("nc_f1", "(): void", "c1_nc_f1", "c1.nc_f1", "method"); -verify.memberListContains("nc_l1", "() => void", "c1_nc_l1", "c1.nc_l1", "property"); -goTo.marker('7'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('8'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('9'); -verify.currentSignatureHelpDocCommentIs("c1_f1"); -goTo.marker('10'); -verify.currentSignatureHelpDocCommentIs("c1_nc_f1"); -goTo.marker('l7'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l8'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l9'); -verify.currentSignatureHelpDocCommentIs("c1_l1"); -goTo.marker('l10'); -verify.currentSignatureHelpDocCommentIs("c1_nc_l1"); - -goTo.marker('6iq'); -verify.quickInfoIs("c1", "", "c1_i", "var"); -goTo.marker('7q'); -verify.quickInfoIs("(): void", "", "c1.i1_f1", "method"); -goTo.marker('8q'); -verify.quickInfoIs("(): void", "", "c1.i1_nc_f1", "method"); -goTo.marker('9q'); -verify.quickInfoIs("(): void", "c1_f1", "c1.f1", "method"); -goTo.marker('10q'); -verify.quickInfoIs("(): void", "c1_nc_f1", "c1.nc_f1", "method"); -goTo.marker('l7q'); -verify.quickInfoIs("() => void", "", "c1.i1_l1", "property"); -goTo.marker('l8q'); -verify.quickInfoIs("() => void", "", "c1.i1_nc_l1", "property"); -goTo.marker('l9q'); -verify.quickInfoIs("() => void", "c1_l1", "c1.l1", "property"); -goTo.marker('l10q'); -verify.quickInfoIs("() => void", "c1_nc_l1", "c1.nc_l1", "property"); - -goTo.marker('11'); -verify.memberListContains("i1_p1", "number", "i1_p1", "i1.i1_p1", "property"); -verify.memberListContains("i1_f1", "(): void", "i1_f1", "i1.i1_f1", "method"); -verify.memberListContains("i1_l1", "() => void", "i1_l1", "i1.i1_l1", "property"); -verify.memberListContains("i1_nc_p1", "number", "", "i1.i1_nc_p1", "property"); -verify.memberListContains("i1_nc_f1", "(): void", "", "i1.i1_nc_f1", "method"); -verify.memberListContains("i1_nc_l1", "() => void", "", "i1.i1_nc_l1", "property"); -verify.memberListContains("p1", "number", "", "i1.p1", "property"); -verify.memberListContains("f1", "(): void", "", "i1.f1", "method"); -verify.memberListContains("l1", "() => void", "", "i1.l1", "property"); -verify.memberListContains("nc_p1", "number", "", "i1.nc_p1", "property"); -verify.memberListContains("nc_f1", "(): void", "", "i1.nc_f1", "method"); -verify.memberListContains("nc_l1", "() => void", "", "i1.nc_l1", "property"); -goTo.marker('12'); -verify.currentSignatureHelpDocCommentIs("i1_f1"); -goTo.marker('13'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('14'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('15'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l12'); -verify.currentSignatureHelpDocCommentIs("i1_l1"); -goTo.marker('l13'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l14'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l15'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('12q'); -verify.quickInfoIs("(): void", "i1_f1", "i1.i1_f1", "method"); -goTo.marker('13q'); -verify.quickInfoIs("(): void", "", "i1.i1_nc_f1", "method"); -goTo.marker('14q'); -verify.quickInfoIs("(): void", "", "i1.f1", "method"); -goTo.marker('15q'); -verify.quickInfoIs("(): void", "", "i1.nc_f1", "method"); -goTo.marker('l12q'); -verify.quickInfoIs("() => void", "i1_l1", "i1.i1_l1", "property"); -goTo.marker('l13q'); -verify.quickInfoIs("() => void", "", "i1.i1_nc_l1", "property"); -goTo.marker('l14q'); -verify.quickInfoIs("() => void", "", "i1.l1", "property"); -goTo.marker('l15q'); -verify.quickInfoIs("() => void", "", "i1.nc_l1", "property"); - -goTo.marker('16'); -verify.completionListContains("i1", "i1", "i1 is interface with properties", "i1", "interface"); -verify.completionListContains("i1_i", "i1", "", "i1_i", "var"); -verify.completionListContains("c1", undefined, "", "c1", "class"); -verify.completionListContains("c1_i", "c1", "", "c1_i", "var"); - -goTo.marker('17iq'); -verify.quickInfoIs("c2", "", "c2_i", "var"); -goTo.marker('18iq'); -verify.quickInfoIs("c3", "", "c3_i", "var"); - -goTo.marker('17'); -verify.currentSignatureHelpDocCommentIs("c2 constructor"); - -goTo.marker('18'); -verify.currentSignatureHelpDocCommentIs(""); - -goTo.marker('18sq'); -verify.quickInfoIs("(a: number): c2", "c2 constructor", "c2", "constructor"); - -goTo.marker('18spropq'); -verify.quickInfoIs("c2", "", "c2", "class"); -goTo.marker('18spropProp'); -verify.quickInfoIs("number", "c2 c2_p1", "c2.c2_p1", "property"); - -goTo.marker('17q'); -verify.quickInfoIs("(a: number): c2", "c2 constructor", "c2", "constructor"); -goTo.marker('18q'); -verify.quickInfoIs("(): c3", "", "c3", "constructor"); - -goTo.marker('19'); -verify.memberListContains("c2_p1", "number", "c2 c2_p1", "c2.c2_p1", "property"); -verify.memberListContains("c2_f1", "(): void", "c2 c2_f1", "c2.c2_f1", "method"); -verify.memberListContains("c2_prop", "number", "c2 c2_prop", "c2.c2_prop", "property"); -verify.memberListContains("c2_nc_p1", "number", "", "c2.c2_nc_p1", "property"); -verify.memberListContains("c2_nc_f1", "(): void", "", "c2.c2_nc_f1", "method"); -verify.memberListContains("c2_nc_prop", "number", "", "c2.c2_nc_prop", "property"); -verify.memberListContains("p1", "number", "c2 p1", "c2.p1", "property"); -verify.memberListContains("f1", "(): void", "c2 f1", "c2.f1", "method"); -verify.memberListContains("prop", "number", "c2 prop", "c2.prop", "property"); -verify.memberListContains("nc_p1", "number", "", "c2.nc_p1", "property"); -verify.memberListContains("nc_f1", "(): void", "", "c2.nc_f1", "method"); -verify.memberListContains("nc_prop", "number", "", "c2.nc_prop", "property"); -goTo.marker('20'); -verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); -goTo.marker('21'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('22'); -verify.currentSignatureHelpDocCommentIs("c2 f1"); -goTo.marker('23'); -verify.currentSignatureHelpDocCommentIs(""); - -goTo.marker('20q'); -verify.quickInfoIs("(): void", "c2 c2_f1", "c2.c2_f1", "method"); -goTo.marker('21q'); -verify.quickInfoIs("(): void", "", "c2.c2_nc_f1", "method"); -goTo.marker('22q'); -verify.quickInfoIs("(): void", "c2 f1", "c2.f1", "method"); -goTo.marker('23q'); -verify.quickInfoIs("(): void", "", "c2.nc_f1", "method"); - -goTo.marker('24'); -verify.memberListContains("c2_p1", "number", "c2 c2_p1", "c2.c2_p1", "property"); -verify.memberListContains("c2_f1", "(): void", "c2 c2_f1", "c2.c2_f1", "method"); -verify.memberListContains("c2_prop", "number", "c2 c2_prop", "c2.c2_prop", "property"); -verify.memberListContains("c2_nc_p1", "number", "", "c2.c2_nc_p1", "property"); -verify.memberListContains("c2_nc_f1", "(): void", "", "c2.c2_nc_f1", "method"); -verify.memberListContains("c2_nc_prop", "number", "", "c2.c2_nc_prop", "property"); -verify.memberListContains("p1", "number", "c3 p1", "c3.p1", "property"); -verify.memberListContains("f1", "(): void", "c3 f1", "c3.f1", "method"); -verify.memberListContains("prop", "number", "c3 prop", "c3.prop", "property"); -verify.memberListContains("nc_p1", "number", "", "c3.nc_p1", "property"); -verify.memberListContains("nc_f1", "(): void", "", "c3.nc_f1", "method"); -verify.memberListContains("nc_prop", "number", "", "c3.nc_prop", "property"); -goTo.marker('25'); -verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); -goTo.marker('26'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('27'); -verify.currentSignatureHelpDocCommentIs("c3 f1"); -goTo.marker('28'); -verify.currentSignatureHelpDocCommentIs(""); - -goTo.marker('25q'); -verify.quickInfoIs("(): void", "c2 c2_f1", "c2.c2_f1", "method"); -goTo.marker('26q'); -verify.quickInfoIs("(): void", "", "c2.c2_nc_f1", "method"); -goTo.marker('27q'); -verify.quickInfoIs("(): void", "c3 f1", "c3.f1", "method"); -goTo.marker('28q'); -verify.quickInfoIs("(): void", "", "c3.nc_f1", "method"); - -goTo.marker('29'); -verify.memberListContains("c2_p1", "number", "c2 c2_p1", "c2.c2_p1", "property"); -verify.memberListContains("c2_f1", "(): void", "c2 c2_f1", "c2.c2_f1", "method"); -verify.memberListContains("c2_prop", "number", "c2 c2_prop", "c2.c2_prop", "property"); -verify.memberListContains("c2_nc_p1", "number", "", "c2.c2_nc_p1", "property"); -verify.memberListContains("c2_nc_f1", "(): void", "", "c2.c2_nc_f1", "method"); -verify.memberListContains("c2_nc_prop", "number", "", "c2.c2_nc_prop", "property"); -verify.memberListContains("p1", "number", "c2 p1", "c2.p1", "property"); -verify.memberListContains("f1", "(): void", "c2 f1", "c2.f1", "method"); -verify.memberListContains("prop", "number", "c2 prop", "c2.prop", "property"); -verify.memberListContains("nc_p1", "number", "", "c2.nc_p1", "property"); -verify.memberListContains("nc_f1", "(): void", "", "c2.nc_f1", "method"); -verify.memberListContains("nc_prop", "number", "", "c2.nc_prop", "property"); -goTo.marker('30'); -verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); -goTo.marker('31'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('32'); -verify.currentSignatureHelpDocCommentIs("c2 f1"); -goTo.marker('33'); -verify.currentSignatureHelpDocCommentIs(""); - -goTo.marker('30q'); -verify.quickInfoIs("(): void", "c2 c2_f1", "c2.c2_f1", "method"); -goTo.marker('31q'); -verify.quickInfoIs("(): void", "", "c2.c2_nc_f1", "method"); -goTo.marker('32q'); -verify.quickInfoIs("(): void", "c2 f1", "c2.f1", "method"); -goTo.marker('33q'); -verify.quickInfoIs("(): void", "", "c2.nc_f1", "method"); - -goTo.marker('34'); -verify.currentSignatureHelpDocCommentIs("c2 constructor"); -goTo.marker('34iq'); -verify.quickInfoIs("c4", "", "c4_i", "var"); -goTo.marker('34q'); -verify.quickInfoIs("(a: number): c4", "c2 constructor", "c4", "constructor"); - -goTo.marker('35'); -verify.completionListContains("c2", undefined, "", "c2", "class"); -verify.completionListContains("c2_i", "c2", "", "c2_i", "var"); -verify.completionListContains("c3", undefined, "", "c3", "class"); -verify.completionListContains("c3_i", "c3", "", "c3_i", "var"); -verify.completionListContains("c4", undefined, "", "c4", "class"); -verify.completionListContains("c4_i", "c4", "", "c4_i", "var"); - -goTo.marker('36'); -verify.memberListContains("i2_p1", "number", "i2_p1", "i2.i2_p1", "property"); -verify.memberListContains("i2_f1", "(): void", "i2_f1", "i2.i2_f1", "method"); -verify.memberListContains("i2_l1", "() => void", "i2_l1", "i2.i2_l1", "property"); -verify.memberListContains("i2_nc_p1", "number", "", "i2.i2_nc_p1", "property"); -verify.memberListContains("i2_nc_f1", "(): void", "", "i2.i2_nc_f1", "method"); -verify.memberListContains("i2_nc_l1", "() => void", "", "i2.i2_nc_l1", "property"); -verify.memberListContains("p1", "number", "i2 p1", "i2.p1", "property"); -verify.memberListContains("f1", "(): void", "i2 f1", "i2.f1", "method"); -verify.memberListContains("l1", "() => void", "i2 l1", "i2.l1", "property"); -verify.memberListContains("nc_p1", "number", "", "i2.nc_p1", "property"); -verify.memberListContains("nc_f1", "(): void", "", "i2.nc_f1", "method"); -verify.memberListContains("nc_l1", "() => void", "", "i2.nc_l1", "property"); -goTo.marker('37'); -verify.currentSignatureHelpDocCommentIs("i2_f1"); -goTo.marker('38'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('39'); -verify.currentSignatureHelpDocCommentIs("i2 f1"); -goTo.marker('40'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l37'); -verify.currentSignatureHelpDocCommentIs("i2_l1"); -goTo.marker('l38'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l39'); -verify.currentSignatureHelpDocCommentIs("i2 l1"); -goTo.marker('l40'); -verify.currentSignatureHelpDocCommentIs(""); - -goTo.marker('36iq'); -verify.quickInfoIs("i2", "", "i2_i", "var"); -goTo.marker('37iq'); -verify.quickInfoIs("i3", "", "i3_i", "var"); -goTo.marker('37q'); -verify.quickInfoIs("(): void", "i2_f1", "i2.i2_f1", "method"); -goTo.marker('38q'); -verify.quickInfoIs("(): void", "", "i2.i2_nc_f1", "method"); -goTo.marker('39q'); -verify.quickInfoIs("(): void", "i2 f1", "i2.f1", "method"); -goTo.marker('40q'); -verify.quickInfoIs("(): void", "", "i2.nc_f1", "method"); -goTo.marker('l37q'); -verify.quickInfoIs("() => void", "i2_l1", "i2.i2_l1", "property"); -goTo.marker('l38q'); -verify.quickInfoIs("() => void", "", "i2.i2_nc_l1", "property"); -goTo.marker('l39q'); -verify.quickInfoIs("() => void", "i2 l1", "i2.l1", "property"); -goTo.marker('l40q'); -verify.quickInfoIs("() => void", "", "i2.nc_l1", "property"); - -goTo.marker('41'); -verify.memberListContains("i2_p1", "number", "i2_p1", "i2.i2_p1", "property"); -verify.memberListContains("i2_f1", "(): void", "i2_f1", "i2.i2_f1", "method"); -verify.memberListContains("i2_l1", "() => void", "i2_l1", "i2.i2_l1", "property"); -verify.memberListContains("i2_nc_p1", "number", "", "i2.i2_nc_p1", "property"); -verify.memberListContains("i2_nc_f1", "(): void", "", "i2.i2_nc_f1", "method"); -verify.memberListContains("i2_nc_l1", "() => void", "", "i2.i2_nc_l1", "property"); -verify.memberListContains("p1", "number", "i3 p1", "i3.p1", "property"); -verify.memberListContains("f1", "(): void", "i3 f1", "i3.f1", "method"); -verify.memberListContains("l1", "() => void", "i3 l1", "i3.l1", "property"); -verify.memberListContains("nc_p1", "number", "", "i3.nc_p1", "property"); -verify.memberListContains("nc_f1", "(): void", "", "i3.nc_f1", "method"); -verify.memberListContains("nc_l1", "() => void", "", "i3.nc_l1", "property"); -goTo.marker('42'); -verify.currentSignatureHelpDocCommentIs("i2_f1"); -goTo.marker('43'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('44'); -verify.currentSignatureHelpDocCommentIs("i3 f1"); -goTo.marker('45'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l42'); -verify.currentSignatureHelpDocCommentIs("i2_l1"); -goTo.marker('l43'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l44'); -verify.currentSignatureHelpDocCommentIs("i3 l1"); -goTo.marker('l45'); -verify.currentSignatureHelpDocCommentIs(""); - -goTo.marker('42q'); -verify.quickInfoIs("(): void", "i2_f1", "i2.i2_f1", "method"); -goTo.marker('43q'); -verify.quickInfoIs("(): void", "", "i2.i2_nc_f1", "method"); -goTo.marker('44q'); -verify.quickInfoIs("(): void", "i3 f1", "i3.f1", "method"); -goTo.marker('45q'); -verify.quickInfoIs("(): void", "", "i3.nc_f1", "method"); -goTo.marker('l42q'); -verify.quickInfoIs("() => void", "i2_l1", "i2.i2_l1", "property"); -goTo.marker('l43q'); -verify.quickInfoIs("() => void", "", "i2.i2_nc_l1", "property"); -goTo.marker('l44q'); -verify.quickInfoIs("() => void", "i3 l1", "i3.l1", "property"); -goTo.marker('l45q'); -verify.quickInfoIs("() => void", "", "i3.nc_l1", "property"); - -goTo.marker('46'); -verify.memberListContains("i2_p1", "number", "i2_p1", "i2.i2_p1", "property"); -verify.memberListContains("i2_f1", "(): void", "i2_f1", "i2.i2_f1", "method"); -verify.memberListContains("i2_l1", "() => void", "i2_l1", "i2.i2_l1", "property"); -verify.memberListContains("i2_nc_p1", "number", "", "i2.i2_nc_p1", "property"); -verify.memberListContains("i2_nc_f1", "(): void", "", "i2.i2_nc_f1", "method"); -verify.memberListContains("i2_nc_l1", "() => void", "", "i2.i2_nc_l1", "property"); -verify.memberListContains("p1", "number", "i2 p1", "i2.p1", "property"); -verify.memberListContains("f1", "(): void", "i2 f1", "i2.f1", "method"); -verify.memberListContains("l1", "() => void", "i2 l1", "i2.l1", "property"); -verify.memberListContains("nc_p1", "number", "", "i2.nc_p1", "property"); -verify.memberListContains("nc_f1", "(): void", "", "i2.nc_f1", "method"); -verify.memberListContains("nc_l1", "() => void", "", "i2.nc_l1", "property"); -goTo.marker('47'); -verify.currentSignatureHelpDocCommentIs("i2_f1"); -goTo.marker('48'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('49'); -verify.currentSignatureHelpDocCommentIs("i2 f1"); -goTo.marker('50'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l47'); -verify.currentSignatureHelpDocCommentIs("i2_l1"); -goTo.marker('l48'); -verify.currentSignatureHelpDocCommentIs(""); -goTo.marker('l49'); -verify.currentSignatureHelpDocCommentIs("i2 l1"); -goTo.marker('l50'); -verify.currentSignatureHelpDocCommentIs(""); - -goTo.marker('47q'); -verify.quickInfoIs("(): void", "i2_f1", "i2.i2_f1", "method"); -goTo.marker('48q'); -verify.quickInfoIs("(): void", "", "i2.i2_nc_f1", "method"); -goTo.marker('49q'); -verify.quickInfoIs("(): void", "i2 f1", "i2.f1", "method"); -goTo.marker('50q'); -verify.quickInfoIs("(): void", "", "i2.nc_f1", "method"); -goTo.marker('l47q'); -verify.quickInfoIs("() => void", "i2_l1", "i2.i2_l1", "property"); -goTo.marker('l48q'); -verify.quickInfoIs("() => void", "", "i2.i2_nc_l1", "property"); -goTo.marker('l49q'); -verify.quickInfoIs("() => void", "i2 l1", "i2.l1", "property"); -goTo.marker('l50q'); -verify.quickInfoIs("() => void", "", "i2.nc_l1", "property"); - -goTo.marker('51'); -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"); - -goTo.marker('52'); -verify.quickInfoIs("(): c5", "", "c5", "constructor"); - -goTo.marker('53'); -verify.quickInfoIs(undefined, "c5 class", "c5", "class"); - -goTo.marker('54'); -verify.quickInfoIs("number", "", "c5.b", "property"); - -goTo.marker('55'); -verify.quickInfoIs("(a: number): c2", "c2 constructor", "c2", "constructor"); - -goTo.marker('56'); -verify.quickInfoIs("(): c3", "", "c3", "constructor"); - -goTo.marker('57'); -verify.quickInfoIs("(): c6", "", "c6", "constructor"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/commentsInterface.ts b/tests/cases/fourslash_old/commentsInterface.ts deleted file mode 100644 index c9a6bab7911..00000000000 --- a/tests/cases/fourslash_old/commentsInterface.ts +++ /dev/null @@ -1,259 +0,0 @@ -/// - -/////** this is interface 1*/ -////interface i/*1*/1 { -////} -////var i1/*2*/_i: i1; -////interface nc_/*3*/i1 { -////} -////var nc_/*4*/i1_i: nc_i1; -/////** this is interface 2 with memebers*/ -////interface i/*5*/2 { -//// /** this is x*/ -//// x: number; -//// /** this is foo*/ -//// foo: (/**param help*/b: number) => string; -//// /** this is indexer*/ -//// [/**string param*/i: string]: number; -//// /**new method*/ -//// new (/** param*/i: i1); -//// nc_x: number; -//// nc_foo: (b: number) => string; -//// [i: number]: number; -//// /** this is call signature*/ -//// (/**paramhelp a*/a: number,/**paramhelp b*/ b: number) : number; -//// /** this is fnfoo*/ -//// fnfoo(/**param help*/b: number): string; -//// nc_fnfoo(b: number): string; -////} -////var i2/*6*/_i: i2; -////var i2_i/*7*/_x = i2_i./*8*/x; -////var i2_i/*9*/_foo = i2_i.f/*10*/oo; -////var i2_i_f/*11*/oo_r = i2_i.f/*12q*/oo(/*12*/30); -////var i2_i_i2_/*13*/si = i2/*13q*/_i["hello"]; -////var i2_i_i2/*14*/_ii = i2/*14q*/_i[30]; -////var i2_/*15*/i_n = new i2/*16q*/_i(/*16*/i1_i); -////var i2_i/*17*/_nc_x = i2_i.n/*18*/c_x; -////var i2_i_/*19*/nc_foo = i2_i.n/*20*/c_foo; -////var i2_i_nc_f/*21*/oo_r = i2_i.nc/*22q*/_foo(/*22*/30); -////var i2/*23*/_i_r = i2/*24q*/_i(/*24*/10, /*25*/20); -////var i2_i/*26*/_fnfoo = i2_i.fn/*27*/foo; -////var i2_i_/*28*/fnfoo_r = i2_i.fn/*29q*/foo(/*29*/10); -////var i2_i/*30*/_nc_fnfoo = i2_i.nc_fn/*31*/foo; -////var i2_i_nc_/*32*/fnfoo_r = i2_i.nc/*33q*/_fnfoo(/*33*/10); -/////*34*/ -////interface i3 { -//// /** Comment i3 x*/ -//// x: number; -//// /** Function i3 f*/ -//// f(/**number parameter*/a: number): string; -//// /** i3 l*/ -//// l: (/**comment i3 l b*/b: number) => string; -//// nc_x: number; -//// nc_f(a: number): string; -//// nc_l: (b: number) => string; -////} -////var i3_i: i3; -////i3_i = { -//// /*35*/f: /**own f*/ (/**i3_i a*/a: number) => "Hello" + /*36*/a, -//// l: this./*37*/f, -//// /** own x*/ -//// x: this.f(/*38*/10), -//// nc_x: this.l(/*39*/this.x), -//// nc_f: this.f, -//// nc_l: this.l -////}; -/////*40*/i/*40q*/3_i./*41*/f(/*42*/10); -////i3_i./*43q*/l(/*43*/10); -////i3_i.nc_/*44q*/f(/*44*/10); -////i3_i.nc/*45q*/_l(/*45*/10); - -goTo.marker('1'); -verify.quickInfoIs("i1", "this is interface 1", "i1", "interface"); - -goTo.marker('2'); -verify.quickInfoIs("i1", "", "i1_i", "var"); - -goTo.marker('3'); -verify.quickInfoIs("nc_i1", "", "nc_i1", "interface"); - -goTo.marker('4'); -verify.quickInfoIs("nc_i1", "", "nc_i1_i", "var"); - -goTo.marker('5'); -verify.quickInfoIs("i2", "this is interface 2 with memebers", "i2", "interface"); - -goTo.marker('6'); -verify.quickInfoIs("i2", "", "i2_i", "var"); - -goTo.marker('7'); -verify.quickInfoIs("number", "", "i2_i_x", "var"); - -goTo.marker('8'); -verify.quickInfoIs("number", "this is x", "i2.x", "property"); -verify.memberListContains("x", "number", "this is x", "i2.x", "property"); -verify.memberListContains("foo", "(b: number) => string", "this is foo", "i2.foo", "property"); -verify.memberListContains("nc_x", "number", "", "i2.nc_x", "property"); -verify.memberListContains("nc_foo", "(b: number) => string", "", "i2.nc_foo", "property"); -verify.memberListContains("fnfoo", "(b: number): string", "this is fnfoo", "i2.fnfoo", "method"); -verify.memberListContains("nc_fnfoo", "(b: number): string", "", "i2.nc_fnfoo", "method"); - -goTo.marker('9'); -verify.quickInfoIs("(b: number) => string", "", "i2_i_foo", "var"); - -goTo.marker('10'); -verify.quickInfoIs("(b: number) => string", "this is foo", "i2.foo", "property"); - -goTo.marker('11'); -verify.quickInfoIs("string", "", "i2_i_foo_r", "var"); - -goTo.marker('12'); -verify.currentSignatureHelpDocCommentIs("this is foo"); -verify.currentParameterHelpArgumentDocCommentIs("param help"); -goTo.marker('12q'); -verify.quickInfoIs("(b: number) => string", "this is foo", "i2.foo", "property"); - -goTo.marker('13'); -verify.quickInfoIs("number", "", "i2_i_i2_si", "var"); -goTo.marker('13q'); -verify.quickInfoIs("i2", "", "i2_i", "var"); - -goTo.marker('14'); -verify.quickInfoIs("number", "", "i2_i_i2_ii", "var"); -goTo.marker('14q'); -verify.quickInfoIs("i2", "", "i2_i", "var"); - -goTo.marker('15'); -verify.quickInfoIs("any", "", "i2_i_n", "var"); - -goTo.marker('16'); -verify.currentSignatureHelpDocCommentIs("new method"); -verify.currentParameterHelpArgumentDocCommentIs("param"); -goTo.marker('16q'); -verify.quickInfoIs("(i: i1): any", "new method", "i2", "constructor"); - -goTo.marker('17'); -verify.quickInfoIs("number", "", "i2_i_nc_x", "var"); - -goTo.marker('18'); -verify.quickInfoIs("number", "", "i2.nc_x", "property"); - -goTo.marker('19'); -verify.quickInfoIs("(b: number) => string", "", "i2_i_nc_foo", "var"); - -goTo.marker('20'); -verify.quickInfoIs("(b: number) => string", "", "i2.nc_foo", "property"); - -goTo.marker('21'); -verify.quickInfoIs("string", "", "i2_i_nc_foo_r", "var"); - -goTo.marker('22'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -goTo.marker('22q'); -verify.quickInfoIs("(b: number) => string", "", "i2.nc_foo", "property"); - -goTo.marker('23'); -verify.quickInfoIs("number", "", "i2_i_r", "var"); - -goTo.marker('24'); -verify.currentSignatureHelpDocCommentIs("this is call signature"); -verify.currentParameterHelpArgumentDocCommentIs("paramhelp a"); -goTo.marker('24q'); -verify.quickInfoIs("(a: number, b: number): number", "this is call signature", "i2", "function"); - -goTo.marker('25'); -verify.currentSignatureHelpDocCommentIs("this is call signature"); -verify.currentParameterHelpArgumentDocCommentIs("paramhelp b"); - -goTo.marker('26'); -verify.quickInfoIs("(b: number) => string", "", "i2_i_fnfoo", "var"); - -goTo.marker('27'); -verify.quickInfoIs("(b: number): string", "this is fnfoo", "i2.fnfoo", "method"); - -goTo.marker('28'); -verify.quickInfoIs("string", "", "i2_i_fnfoo_r", "var"); - -goTo.marker('29'); -verify.currentSignatureHelpDocCommentIs("this is fnfoo"); -verify.currentParameterHelpArgumentDocCommentIs("param help"); -goTo.marker('29q'); -verify.quickInfoIs("(b: number): string", "this is fnfoo", "i2.fnfoo", "method"); - -goTo.marker('30'); -verify.quickInfoIs("(b: number) => string", "", "i2_i_nc_fnfoo", "var"); - -goTo.marker('31'); -verify.quickInfoIs("(b: number): string", "", "i2.nc_fnfoo", "method"); - -goTo.marker('32'); -verify.quickInfoIs("string", "", "i2_i_nc_fnfoo_r", "var"); - -goTo.marker('33'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -goTo.marker('33q'); -verify.quickInfoIs("(b: number): string", "", "i2.nc_fnfoo", "method"); - -goTo.marker('34'); -verify.completionListContains("i1", "i1", "this is interface 1", "i1", "interface"); -verify.completionListContains("i1_i", "i1", "", "i1_i", "var"); -verify.completionListContains("nc_i1", "nc_i1", "", "nc_i1", "interface"); -verify.completionListContains("nc_i1_i", "nc_i1", "", "nc_i1_i", "var"); -verify.completionListContains("i2", "i2", "this is interface 2 with memebers", "i2", "interface"); -verify.completionListContains("i2_i", "i2", "", "i2_i", "var"); -verify.completionListContains("i2_i_x", "number", "", "i2_i_x", "var"); -verify.completionListContains("i2_i_foo", "(b: number) => string", "", "i2_i_foo", "var"); -verify.completionListContains("i2_i_foo_r", "string", "", "i2_i_foo_r", "var"); -verify.completionListContains("i2_i_i2_si", "number", "", "i2_i_i2_si", "var"); -verify.completionListContains("i2_i_i2_ii", "number", "", "i2_i_i2_ii", "var"); -verify.completionListContains("i2_i_n", "any", "", "i2_i_n", "var"); -verify.completionListContains("i2_i_nc_x", "number", "", "i2_i_nc_x", "var"); -verify.completionListContains("i2_i_nc_foo", "(b: number) => string", "", "i2_i_nc_foo", "var"); -verify.completionListContains("i2_i_nc_foo_r", "string", "", "i2_i_nc_foo_r", "var"); -verify.completionListContains("i2_i_r", "number", "", "i2_i_r", "var"); -verify.completionListContains("i2_i_fnfoo", "(b: number) => string", "", "i2_i_fnfoo", "var"); -verify.completionListContains("i2_i_fnfoo_r", "string", "", "i2_i_fnfoo_r", "var"); -verify.completionListContains("i2_i_nc_fnfoo", "(b: number) => string", "", "i2_i_nc_fnfoo", "var"); -verify.completionListContains("i2_i_nc_fnfoo_r", "string", "", "i2_i_nc_fnfoo_r", "var"); - -goTo.marker('36'); -verify.completionListContains("a", "number", "i3_i a", "a", "parameter"); - -goTo.marker('40q'); -verify.quickInfoIs("i3", "", "i3_i", "var"); -goTo.marker('40'); -verify.completionListContains("i3", "i3", "", "i3", "interface"); -verify.completionListContains("i3_i", "i3", "", "i3_i", "var"); - -goTo.marker('41'); -verify.quickInfoIs("(a: number): string", "Function i3 f", "i3.f", "method"); -verify.memberListContains("f", "(a: number): string", "Function i3 f", "i3.f", "method"); -verify.memberListContains("l", "(b: number) => string", "i3 l", "i3.l", "property"); -verify.memberListContains("x", "number", "Comment i3 x", "i3.x", "property"); -verify.memberListContains("nc_f", "(a: number): string", "", "i3.nc_f", "method"); -verify.memberListContains("nc_l", "(b: number) => string", "", "i3.nc_l", "property"); -verify.memberListContains("nc_x", "number", "", "i3.nc_x", "property"); - -goTo.marker('42'); -verify.currentSignatureHelpDocCommentIs("Function i3 f"); -verify.currentParameterHelpArgumentDocCommentIs("number parameter"); - -goTo.marker('43'); -verify.currentSignatureHelpDocCommentIs("i3 l"); -verify.currentParameterHelpArgumentDocCommentIs("comment i3 l b"); -goTo.marker('43q'); -verify.quickInfoIs("(b: number) => string", "i3 l", "i3.l", "property"); - -goTo.marker('44'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -goTo.marker('44q'); -verify.quickInfoIs("(a: number): string", "", "i3.nc_f", "method"); - -goTo.marker('45'); -verify.currentSignatureHelpDocCommentIs(""); -verify.currentParameterHelpArgumentDocCommentIs(""); -goTo.marker('45q'); -verify.quickInfoIs("(b: number) => string", "", "i3.nc_l", "property"); diff --git a/tests/cases/fourslash_old/commentsModules.ts b/tests/cases/fourslash_old/commentsModules.ts deleted file mode 100644 index 68f04b4e823..00000000000 --- a/tests/cases/fourslash_old/commentsModules.ts +++ /dev/null @@ -1,251 +0,0 @@ -/// - -/////** Module comment*/ -////module m/*1*/1 { -//// /** b's comment*/ -//// export var b: number; -//// /** foo's comment*/ -//// function foo() { -//// return /*2*/b; -//// } -//// /** m2 comments*/ -//// export module m2 { -//// /** class comment;*/ -//// export class c { -//// }; -//// /** i*/ -//// export var i = new c(); -//// } -//// /** exported function*/ -//// export function fooExport() { -//// return fo/*3q*/o(/*3*/); -//// } -////} -/////*4*/m1./*5*/fooExport(/*6*/); -////var my/*7*/var = new m1.m2./*8*/c(); -/////** module comment of m2.m3*/ -////module m2.m3 { -//// /** Exported class comment*/ -//// export class c { -//// } -////} -////new /*9*/m2./*10*/m3./*11*/c(); -/////** module comment of m3.m4.m5*/ -////module m3.m4.m5 { -//// /** Exported class comment*/ -//// export class c { -//// } -////} -////new /*12*/m3./*13*/m4./*14*/m5./*15*/c(); -/////** module comment of m4.m5.m6*/ -////module m4.m5.m6 { -//// export module m7 { -//// /** Exported class comment*/ -//// export class c { -//// } -//// } -////} -////new /*16*/m4./*17*/m5./*18*/m6./*19*/m7./*20*/c(); -/////** module comment of m5.m6.m7*/ -////module m5.m6.m7 { -//// /** module m8 comment*/ -//// export module m8 { -//// /** Exported class comment*/ -//// export class c { -//// } -//// } -////} -////new /*21*/m5./*22*/m6./*23*/m7./*24*/m8./*25*/c(); -////module m6.m7 { -//// export module m8 { -//// /** Exported class comment*/ -//// export class c { -//// } -//// } -////} -////new /*26*/m6./*27*/m7./*28*/m8./*29*/c(); -////module m7.m8 { -//// /** module m9 comment*/ -//// export module m9 { -//// /** Exported class comment*/ -//// export class c { -//// } -//// } -////} -////new /*30*/m7./*31*/m8./*32*/m9./*33*/c(); -////declare module "quotedM" { -//// export class c { -//// } -//// export var b: /*34*/c; -////} -////module complexM { -//// export module m1 { -//// export class c { -//// public foo() { -//// return 30; -//// } -//// } -//// } -//// export module m2 { -//// export class c { -//// public foo2() { -//// return new complexM.m1.c(); -//// } -//// } -//// } -////} -////var myComp/*35*/lexVal = new compl/*36*/exM.m/*37*/2./*38*/c().f/*39*/oo2().f/*40*/oo(); - -goTo.marker('1'); -verify.quickInfoIs("m1", "Module comment", "m1", "module"); - -goTo.marker('2'); -verify.completionListContains("b", "number", "b's comment", "m1.b", "var"); -verify.completionListContains("foo", "(): number", "foo's comment", "foo", "function"); - -goTo.marker('3'); -verify.currentSignatureHelpDocCommentIs("foo's comment"); -goTo.marker('3q'); -verify.quickInfoIs("(): number", "foo's comment", "foo", "function"); - -goTo.marker('4'); -verify.completionListContains("m1", "m1", "Module comment", "m1", "module"); - -goTo.marker('5'); -verify.memberListContains("b", "number", "b's comment", "m1.b", "var"); -verify.memberListContains("fooExport", "(): number", "exported function", "m1.fooExport", "function"); -verify.memberListContains("m2", "m1.m2"); -verify.quickInfoIs("(): number", "exported function", "m1.fooExport", "function"); - -goTo.marker('6'); -verify.currentSignatureHelpDocCommentIs("exported function"); - -goTo.marker('7'); -verify.quickInfoIs("m1.m2.c", "", "myvar", "var"); - -goTo.marker('8'); -verify.quickInfoIs("(): m1.m2.c", "", "m1.m2.c", "constructor"); -verify.memberListContains("c", undefined, "class comment;", "m1.m2.c", "class"); -verify.memberListContains("i", "m1.m2.c", "i", "m1.m2.i", "var"); - -goTo.marker('9'); -verify.completionListContains("m2", "m2", "", "m2", "module"); -verify.quickInfoIs("typeof m2", "", "m2", "module"); - -goTo.marker('10'); -verify.memberListContains("m3", "m2.m3"); -verify.quickInfoIs("typeof m2.m3", "module comment of m2.m3", "m2.m3", "module"); - -goTo.marker('11'); -verify.quickInfoIs("(): m2.m3.c", "", "m2.m3.c", "constructor"); -verify.memberListContains("c", undefined, "Exported class comment", "m2.m3.c", "class"); - -goTo.marker('12'); -verify.completionListContains("m3", "m3", "", "m3", "module"); -verify.quickInfoIs("typeof m3", "", "m3", "module"); - -goTo.marker('13'); -verify.memberListContains("m4", "m3.m4", "", "m3.m4", "module"); -verify.quickInfoIs("typeof m3.m4", "", "m3.m4", "module"); - -goTo.marker('14'); -verify.memberListContains("m5", "m3.m4.m5"); -verify.quickInfoIs("typeof m3.m4.m5", "module comment of m3.m4.m5", "m3.m4.m5", "module"); - -goTo.marker('15'); -verify.memberListContains("c", undefined, "Exported class comment", "m3.m4.m5.c", "class"); -verify.quickInfoIs("(): m3.m4.m5.c", "", "m3.m4.m5.c", "constructor"); - -goTo.marker('16'); -verify.completionListContains("m4", "m4", "", "m4", "module"); -verify.quickInfoIs("typeof m4", "", "m4", "module"); - -goTo.marker('17'); -verify.memberListContains("m5", "m4.m5", "", "m4.m5"); -verify.quickInfoIs("typeof m4.m5", "", "m4.m5", "module"); - -goTo.marker('18'); -verify.memberListContains("m6", "m4.m5.m6"); -verify.quickInfoIs("typeof m4.m5.m6", "module comment of m4.m5.m6", "m4.m5.m6", "module"); - -goTo.marker('19'); -verify.memberListContains("m7", "m4.m5.m6.m7"); -verify.quickInfoIs("typeof m4.m5.m6.m7", "", "m4.m5.m6.m7", "module"); - -goTo.marker('20'); -verify.memberListContains("c", undefined, "Exported class comment", "m4.m5.m6.m7.c", "class"); -verify.quickInfoIs("(): m4.m5.m6.m7.c", "", "m4.m5.m6.m7.c", "constructor"); - -goTo.marker('21'); -verify.completionListContains("m5", "m5"); -verify.quickInfoIs("typeof m5", "", "m5", "module"); - -goTo.marker('22'); -verify.memberListContains("m6", "m5.m6"); -verify.quickInfoIs("typeof m5.m6", "", "m5.m6", "module"); - -goTo.marker('23'); -verify.memberListContains("m7", "m5.m6.m7"); -verify.quickInfoIs("typeof m5.m6.m7", "module comment of m5.m6.m7", "m5.m6.m7", "module"); - -goTo.marker('24'); -verify.memberListContains("m8", "m5.m6.m7.m8"); -verify.quickInfoIs("typeof m5.m6.m7.m8", "module m8 comment", "m5.m6.m7.m8", "module"); - -goTo.marker('25'); -verify.memberListContains("c", undefined, "Exported class comment", "m5.m6.m7.m8.c", "class"); -verify.quickInfoIs("(): m5.m6.m7.m8.c", "", "m5.m6.m7.m8.c", "constructor"); - -goTo.marker('26'); -verify.completionListContains("m6", "m6"); -verify.quickInfoIs("typeof m6", "", "m6", "module"); - -goTo.marker('27'); -verify.memberListContains("m7", "m6.m7"); -verify.quickInfoIs("typeof m6.m7", "", "m6.m7", "module"); - -goTo.marker('28'); -verify.memberListContains("m8", "m6.m7.m8"); -verify.quickInfoIs("typeof m6.m7.m8", "", "m6.m7.m8", "module"); - -goTo.marker('29'); -verify.memberListContains("c", undefined, "Exported class comment", "m6.m7.m8.c", "class"); -verify.quickInfoIs("(): m6.m7.m8.c", "", "m6.m7.m8.c", "constructor"); - -goTo.marker('30'); -verify.completionListContains("m7", "m7"); -verify.quickInfoIs("typeof m7", "", "m7", "module"); - -goTo.marker('31'); -verify.memberListContains("m8", "m7.m8"); -verify.quickInfoIs("typeof m7.m8", "", "m7.m8", "module"); - -goTo.marker('32'); -verify.memberListContains("m9", "m7.m8.m9"); -verify.quickInfoIs("typeof m7.m8.m9", "module m9 comment", "m7.m8.m9", "module"); - -goTo.marker('33'); -verify.memberListContains("c", undefined, "Exported class comment", "m7.m8.m9.c", "class"); -verify.quickInfoIs("(): m7.m8.m9.c", "", "m7.m8.m9.c", "constructor"); - -goTo.marker('34'); -verify.completionListContains("c", undefined, "", '"quotedM".c', "class"); -verify.quickInfoIs(undefined, "", '"quotedM".c', "class"); - -goTo.marker('35'); -verify.quickInfoIs("number", "", 'myComplexVal', "var"); - -goTo.marker('36'); -verify.quickInfoIs("typeof complexM", "", "complexM", "module"); - -goTo.marker('37'); -verify.quickInfoIs("typeof complexM.m2", "", "complexM.m2", "module"); - -goTo.marker('38'); -verify.quickInfoIs("(): complexM.m2.c", "", 'complexM.m2.c', "constructor"); - -goTo.marker('39'); -verify.quickInfoIs("(): complexM.m1.c", "", 'complexM.m2.c.foo2', "method"); - -goTo.marker('40'); -verify.quickInfoIs("(): number", "", 'complexM.m1.c.foo', "method"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/commentsMultiModuleMultiFile.ts b/tests/cases/fourslash_old/commentsMultiModuleMultiFile.ts deleted file mode 100644 index e515e914a60..00000000000 --- a/tests/cases/fourslash_old/commentsMultiModuleMultiFile.ts +++ /dev/null @@ -1,54 +0,0 @@ -/// - -// @Filename: commentsMultiModuleMultiFile_0.ts -/////** this is multi declare module*/ -////module mult/*3*/iM { -//// /** class b*/ -//// export class b { -//// } -////} -/////** thi is multi module 2*/ -////module mu/*2*/ltiM { -//// /** class c comment*/ -//// export class c { -//// } -////} -//// -////new /*1*/mu/*4*/ltiM.b(); -////new mu/*5*/ltiM.c(); - -// @Filename: commentsMultiModuleMultiFile_1.ts -/////** this is multi module 3 comment*/ -////module mu/*6*/ltiM { -//// /** class d comment*/ -//// export class d { -//// } -////} -////new /*7*/mu/*8*/ltiM.d(); - -// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.marker('1'); -verify.completionListContains("multiM", "multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment", "multiM", "module"); - -goTo.marker('2'); -verify.quickInfoIs("multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment", "multiM", "module"); - -goTo.marker('3'); -verify.quickInfoIs("multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment", "multiM", "module"); - -goTo.marker('4'); -verify.quickInfoIs("typeof multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment", "multiM", "module"); - -goTo.marker('5'); -verify.quickInfoIs("typeof multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment", "multiM", "module"); - -goTo.marker('6'); -verify.quickInfoIs("multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment", "multiM", "module"); - -goTo.marker('7'); -verify.completionListContains("multiM"); - -goTo.marker('8'); -verify.quickInfoIs("typeof multiM", "this is multi declare module\nthi is multi module 2\nthis is multi module 3 comment", "multiM", "module"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/commentsMultiModuleSingleFile.ts b/tests/cases/fourslash_old/commentsMultiModuleSingleFile.ts deleted file mode 100644 index a4174dfe750..00000000000 --- a/tests/cases/fourslash_old/commentsMultiModuleSingleFile.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// - -/////** this is multi declare module*/ -////module mult/*3*/iM { -//// /** class b*/ -//// export class b { -//// } -////} -/////** thi is multi module 2*/ -////module mu/*2*/ltiM { -//// /** class c comment*/ -//// export class c { -//// } -////} -//// -////new /*1*/mu/*4*/ltiM.b(); -////new mu/*5*/ltiM.c(); - -// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.marker('1'); -verify.completionListContains("multiM", "multiM", "this is multi declare module\nthi is multi module 2", "multiM", "module"); - -goTo.marker('2'); -verify.quickInfoIs("multiM", "this is multi declare module\nthi is multi module 2", "multiM", "module"); - -goTo.marker('3'); -verify.quickInfoIs("multiM", "this is multi declare module\nthi is multi module 2", "multiM", "module"); - -goTo.marker('4'); -verify.quickInfoIs("typeof multiM", "this is multi declare module\nthi is multi module 2", "multiM", "module"); - -goTo.marker('5'); -verify.quickInfoIs("typeof multiM", "this is multi declare module\nthi is multi module 2", "multiM", "module"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/commentsVariables.ts b/tests/cases/fourslash_old/commentsVariables.ts deleted file mode 100644 index 0a269214d75..00000000000 --- a/tests/cases/fourslash_old/commentsVariables.ts +++ /dev/null @@ -1,97 +0,0 @@ -/// - -/////** This is my variable*/ -////var myV/*1*/ariable = 10; -/////*2*/ -/////** d variable*/ -////var d = 10; -////myVariable = d; -/////*3*/ -/////** foos comment*/ -////function foo() { -////} -/////** fooVar comment*/ -////var foo/*12*/Var: () => void; -/////*4*/ -////f/*5q*/oo(/*5*/); -////fo/*6q*/oVar(/*6*/); -////fo/*13*/oVar = f/*14*/oo; -/////*7*/ -////f/*8q*/oo(/*8*/); -////foo/*9q*/Var(/*9*/); -/////**class comment*/ -////class c { -//// /** constructor comment*/ -//// constructor() { -//// } -////} -/////**instance comment*/ -////var i = new c(); -/////*10*/ -/////** interface comments*/ -////interface i1 { -////} -/////**interface instance comments*/ -////var i1_i: i1; -/////*11*/ -////function foo2(a: number): void; -////function foo2(b: string): void; -////function foo2(aOrb) { -////} -////var x = fo/*15*/o2; - -goTo.marker('1'); -verify.quickInfoIs("number", "This is my variable", "myVariable", "var"); - -goTo.marker('2'); -verify.completionListContains("myVariable", "number", "This is my variable", "myVariable", "var"); - -goTo.marker('3'); -verify.completionListContains("myVariable", "number", "This is my variable", "myVariable", "var"); -verify.completionListContains("d", "number", "d variable", "d", "var"); - -goTo.marker('4'); -verify.completionListContains("foo", "(): void", "foos comment", "foo", "function"); -verify.completionListContains("fooVar", "() => void", "fooVar comment", "fooVar", "var"); - -goTo.marker('5'); -verify.currentSignatureHelpDocCommentIs("foos comment"); -goTo.marker('5q'); -verify.quickInfoIs("(): void", "foos comment", "foo", "function"); - -goTo.marker('6'); -verify.currentSignatureHelpDocCommentIs("fooVar comment"); -goTo.marker('6q'); -verify.quickInfoIs("() => void", "fooVar comment", "fooVar", "var"); - -goTo.marker('7'); -verify.completionListContains("foo", "(): void", "foos comment", "foo", "function"); -verify.completionListContains("fooVar", "() => void", "fooVar comment", "fooVar", "var"); - -goTo.marker('8'); -verify.currentSignatureHelpDocCommentIs("foos comment"); -goTo.marker('8q'); -verify.quickInfoIs("(): void", "foos comment", "foo", "function"); - -goTo.marker('9'); -verify.currentSignatureHelpDocCommentIs("fooVar comment"); -goTo.marker('9q'); -verify.quickInfoIs("() => void", "fooVar comment", "fooVar", "var"); - -goTo.marker('10'); -verify.completionListContains("i", "c", "instance comment", "i", "var"); - -goTo.marker('11'); -verify.completionListContains("i1_i", "i1", "interface instance comments", "i1_i", "var"); - -goTo.marker('12'); -verify.quickInfoIs("() => void", "fooVar comment", "fooVar", "var"); - -goTo.marker('13'); -verify.quickInfoIs("() => void", "fooVar comment", "fooVar", "var"); - -goTo.marker('14'); -verify.quickInfoIs("(): void", "foos comment", "foo", "function"); - -goTo.marker('15'); -verify.quickInfoIs("(a: number): void (+ 1 overload(s))", "", "foo2", "function"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/contextualTypingFromTypeAssertion1.ts b/tests/cases/fourslash_old/contextualTypingFromTypeAssertion1.ts deleted file mode 100644 index 848207eeb9f..00000000000 --- a/tests/cases/fourslash_old/contextualTypingFromTypeAssertion1.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -////var f3 = <(x: string) => string> function (x/**/) { return x.toLowerCase(); }; - -goTo.marker(); -verify.quickInfoIs('string'); - diff --git a/tests/cases/fourslash_old/contextualTypingGenericFunction1.ts b/tests/cases/fourslash_old/contextualTypingGenericFunction1.ts deleted file mode 100644 index 98081826329..00000000000 --- a/tests/cases/fourslash_old/contextualTypingGenericFunction1.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - -// should not contextually type the RHS because it introduces type parameters -////var obj: { f(x: T): T } = { f: (x/*1*/) => x }; -////var obj2: (x: T) => T = (x/*2*/) => x; -//// -////class C { -//// obj: (x: T) => T -////} -////var c = new C(); -////c.obj = (x/*3*/) => x; - -goTo.marker('1'); -verify.quickInfoIs('any'); - -goTo.marker('2'); -verify.quickInfoIs('any'); - -goTo.marker('3'); -verify.quickInfoIs('any'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/contextualTypingReturnExpressions.ts b/tests/cases/fourslash_old/contextualTypingReturnExpressions.ts deleted file mode 100644 index 966e67ac3af..00000000000 --- a/tests/cases/fourslash_old/contextualTypingReturnExpressions.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -////interface A { } -////var f44: (x: A) => (y: A) => A = x/*1*/ => y/*2*/ => x/*3*/; - -goTo.marker('1'); -verify.quickInfoIs('A'); - -goTo.marker('2'); -verify.quickInfoIs('A'); - -goTo.marker('3'); -verify.quickInfoIs('A'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/emptyArrayInference.ts b/tests/cases/fourslash_old/emptyArrayInference.ts deleted file mode 100644 index 14185125e5b..00000000000 --- a/tests/cases/fourslash_old/emptyArrayInference.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -////var x/*1*/x = true ? [1] : [undefined]; -////var y/*2*/ = true ? [1] : []; - -goTo.marker('1'); -verify.quickInfoIs('number[]'); - -goTo.marker('2'); -verify.quickInfoIs('number[]'); diff --git a/tests/cases/fourslash_old/externalModuleWithExportAssignment.ts b/tests/cases/fourslash_old/externalModuleWithExportAssignment.ts deleted file mode 100644 index 678f0c1c1d4..00000000000 --- a/tests/cases/fourslash_old/externalModuleWithExportAssignment.ts +++ /dev/null @@ -1,87 +0,0 @@ -/// - -// @Filename: externalModuleWithExportAssignment_file0.ts -////module m2 { -//// export interface connectModule { -//// (res, req, next): void; -//// } -//// export interface connectExport { -//// use: (mod: connectModule) => connectExport; -//// listen: (port: number) => void; -//// } -////} -////var m2: { -//// (): m2.connectExport; -//// test1: m2.connectModule; -//// test2(): m2.connectModule; -////}; -////export = m2; - -// @Filename: externalModuleWithExportAssignment_file1.ts -////import /*1*/a1 = require("externalModuleWithExportAssignment_file0"); -////export var /*2*/a = a1; -////a./*3*/test1(/*4*/null, null, null); -////var /*6*/r1 = a.test2(/*5*/); -////var /*8*/r2 = a(/*7*/); -////a1./*9*/test1(/*10*/null, null, null); -////var /*12*/r3 = a1.test2(/*11*/); -////var /*14*/r4 = a1(/*13*/); -////var v1: a1./*15*/connectExport; - -goTo.file("externalModuleWithExportAssignment_file1.ts"); -goTo.marker('1'); -verify.quickInfoIs("a1"); - -goTo.marker('2'); -verify.quickInfoIs("{ test1: a1.connectModule; test2(): a1.connectModule; (): a1.connectExport; }", undefined, "a", "var"); - -goTo.marker('3'); -verify.quickInfoIs("(res: any, req: any, next: any): void", undefined, "a1.connectModule", "function"); -verify.completionListContains("test1", "a1.connectModule", undefined, "test1", "property"); -verify.completionListContains("test2", "(): a1.connectModule", undefined, "test2", "method"); -verify.not.completionListContains("connectModule"); -verify.not.completionListContains("connectExport"); - -goTo.marker('4'); -verify.currentSignatureHelpIs("test1(res: any, req: any, next: any): void"); - -goTo.marker('5'); -verify.currentSignatureHelpIs("test2(): a1.connectModule"); - -goTo.marker('6'); -verify.quickInfoIs("a1.connectModule", undefined, "r1", "var"); - -goTo.marker('7'); -verify.currentSignatureHelpIs("a(): a1.connectExport"); - -goTo.marker('8'); -verify.quickInfoIs("a1.connectExport", undefined, "r2", "var"); - -goTo.marker('9'); -verify.quickInfoIs("(res: any, req: any, next: any): void", undefined, "a1.connectModule", "function"); -verify.completionListContains("test1", "a1.connectModule", undefined, "test1", "property"); -verify.completionListContains("test2", "(): a1.connectModule", undefined, "test2", "method"); -verify.not.completionListContains("connectModule"); -verify.not.completionListContains("connectExport"); - -goTo.marker('10'); -verify.currentSignatureHelpIs("test1(res: any, req: any, next: any): void"); - -goTo.marker('11'); -verify.currentSignatureHelpIs("test2(): a1.connectModule"); - -goTo.marker('12'); -verify.quickInfoIs("a1.connectModule", undefined, "r3", "var"); - -goTo.marker('13'); -verify.currentSignatureHelpIs("a1(): a1.connectExport"); - -goTo.marker('14'); -verify.quickInfoIs("a1.connectExport", undefined, "r4", "var"); - -goTo.marker('15'); -verify.not.completionListContains("test1", "a1.connectModule", undefined, "test1", "property"); -verify.not.completionListContains("test2", "(): a1.connectModule", undefined, "test2", "method"); -verify.completionListContains("connectModule", "a1.connectModule", undefined, "a1.connectModule", "interface"); -verify.completionListContains("connectExport", "a1.connectExport", undefined, "a1.connectExport", "interface"); - diff --git a/tests/cases/fourslash_old/functionProperty.ts b/tests/cases/fourslash_old/functionProperty.ts deleted file mode 100644 index 4fb3ea52949..00000000000 --- a/tests/cases/fourslash_old/functionProperty.ts +++ /dev/null @@ -1,49 +0,0 @@ -/// - -////var a = { -//// x(a: number) { } -////}; -//// -////var b = { -//// x: function (a: number) { } -////}; -//// -////var c = { -//// x: (a: number) => { } -////}; -////a.x(/*signatureA*/1); -////b.x(/*signatureB*/1); -////c.x(/*signatureC*/1); -////a./*completionA*/; -////b./*completionB*/; -////c./*completionC*/; -////a./*quickInfoA*/x; -////b./*quickInfoB*/x; -////c./*quickInfoC*/x; - -goTo.marker('signatureA'); -verify.currentSignatureHelpIs('x(a: number): void'); - -goTo.marker('signatureB'); -verify.currentSignatureHelpIs('x(a: number): void'); - -goTo.marker('signatureC'); -verify.currentSignatureHelpIs('x(a: number): void'); - -goTo.marker('completionA'); -verify.completionListContains("x", "(a: number): void"); - -goTo.marker('completionB'); -verify.completionListContains("x", "(a: number) => void"); - -goTo.marker('completionC'); -verify.completionListContains("x", "(a: number) => void"); - -goTo.marker('quickInfoA'); -verify.quickInfoIs("(a: number): void", undefined, "x", "local function"); - -goTo.marker('quickInfoB'); -verify.quickInfoIs("(a: number) => void", undefined, "x", "property"); - -goTo.marker('quickInfoC'); -verify.quickInfoIs("(a: number) => void", undefined, "x", "property"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericCombinatorWithConstraints1.ts b/tests/cases/fourslash_old/genericCombinatorWithConstraints1.ts deleted file mode 100644 index d2afec07c31..00000000000 --- a/tests/cases/fourslash_old/genericCombinatorWithConstraints1.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -////function apply(source: T[], selector: (x: T) => U) { -//// var xs/*1*/ = source.map(selector); // any[] -//// var xs2/*2*/ = source.map((x: T, a, b): U => { return null }); // any[] -////} - -goTo.marker('1'); -verify.quickInfoIs('U[]'); - -goTo.marker('2'); -verify.quickInfoIs('U[]'); - diff --git a/tests/cases/fourslash_old/genericCombinators1.ts b/tests/cases/fourslash_old/genericCombinators1.ts deleted file mode 100644 index 6db305529ba..00000000000 --- a/tests/cases/fourslash_old/genericCombinators1.ts +++ /dev/null @@ -1,101 +0,0 @@ -/// -////interface Collection { -//// length: number; -//// add(x: T): void; -//// remove(x: T): boolean; -////} - -////interface Combinators { -//// map(c: Collection, f: (x: T) => U): Collection; -//// map(c: Collection, f: (x: T) => any): Collection; -////} - -////class A { -//// foo() { return this; } -////} - -////class B { -//// foo(x: T): T { return null; } -////} - -////var c2: Collection; -////var c3: Collection>; -////var c4: Collection; -////var c5: Collection>; - -////var _: Combinators; -////var rf1 = (x: number) => { return x.toFixed() }; -////var rf2 = (x: Collection) => { return x.length }; -////var rf3 = (x: A) => { return x.foo() }; - -////var r1a/*9*/ = _.map(c2, (x/*1*/) => { return x.toFixed() }); -////var r1b/*10*/ = _.map(c2, rf1); - -////var r2a/*11*/ = _.map(c3, (x/*2*/: Collection) => { return x.length }); -////var r2b/*12*/ = _.map(c3, rf2); - -////var r3a/*13*/ = _.map(c4, (x/*3*/) => { return x.foo() }); -////var r3b/*14*/ = _.map(c4, rf3); - -////var r4a/*15*/ = _.map(c5, (x/*4*/) => { return x.foo(1) }); - -////var r5a/*17*/ = _.map(c2, (x/*5*/) => { return x.toFixed() }); -////var r5b/*18*/ = _.map(c2, rf1); - -////var r6a/*19*/ = _.map, number>(c3/*6*/, (x: Collection) => { return x.length }); -////var r6b/*20*/ = _.map, number>(c3, rf2); - -////var r7a/*21*/ = _.map(c4, (x/*7*/: A) => { return x.foo() }); -////var r7b/*22*/ = _.map(c4, rf3); - -////var r8a/*23*/ = _.map(c5, (x/*8*/) => { return x.foo() }); - -// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.marker('1'); -verify.quickInfoIs('number'); -goTo.marker('2'); -verify.quickInfoIs('Collection'); -goTo.marker('3'); -verify.quickInfoIs('A'); -goTo.marker('4'); -verify.quickInfoIs('B'); -goTo.marker('5'); -verify.quickInfoIs('number'); -goTo.marker('6'); -verify.quickInfoIs('Collection>'); -goTo.marker('7'); -verify.quickInfoIs('A'); -goTo.marker('8'); -verify.quickInfoIs('B'); // Specialized to any because no type argument was specified -goTo.marker('9'); -verify.quickInfoIs('Collection'); -goTo.marker('10'); -verify.quickInfoIs('Collection'); -goTo.marker('11'); -verify.quickInfoIs('Collection'); -goTo.marker('12'); -verify.quickInfoIs('Collection'); -goTo.marker('13'); -verify.quickInfoIs('Collection'); -goTo.marker('14'); -verify.quickInfoIs('Collection'); -goTo.marker('15'); -verify.quickInfoIs('Collection'); -goTo.marker('17'); -verify.quickInfoIs('Collection'); -goTo.marker('18'); -verify.quickInfoIs('Collection'); -goTo.marker('19'); -verify.quickInfoIs('Collection'); -goTo.marker('20'); -verify.quickInfoIs('Collection'); -goTo.marker('21'); -verify.quickInfoIs('Collection'); -goTo.marker('22'); -verify.quickInfoIs('Collection'); -goTo.marker('23'); -verify.quickInfoIs('Collection'); - -verify.errorExistsBetweenMarkers('error1', 'error2'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericCombinators2.ts b/tests/cases/fourslash_old/genericCombinators2.ts deleted file mode 100644 index 353d67fb3d5..00000000000 --- a/tests/cases/fourslash_old/genericCombinators2.ts +++ /dev/null @@ -1,136 +0,0 @@ -/// - -////interface Collection { -//// length: number; -//// add(x: T, y: U): void ; -//// remove(x: T, y: U): boolean; -////} -////} -////interface Combinators { -//// map(c: Collection, f: (x: T, y: U) => V): Collection; -//// map(c: Collection, f: (x: T, y: U) => any): Collection; -////} -////} -////class A { -//// foo(): T { return null; } -////} -////} -////class B { -//// foo(x: T): T { return null; } -////} -////} -////var c1: Collection; -////var c2: Collection; -////var c3: Collection, string>; -////var c4: Collection; -////var c5: Collection>; -////} -////var _: Combinators; -////// param help on open paren for arg 2 should show 'number' not T or 'any' -////// x should be contextually typed to number -////var rf1 = (x: number, y: string) => { return x.toFixed() }; -////var rf2 = (x: Collection, y: string) => { return x.length }; -////var rf3 = (x: number, y: A) => { return y.foo() }; -////} -////var r1a/*9*/ = _.map/*1c*/(c2, (x/*1a*/, y/*1b*/) => { return x.toFixed() }); -////var r1b/*10*/ = _.map(c2, rf1); -////} -////var r2a/*11*/ = _.map(c3, (x/*2a*/, y/*2b*/) => { return x.length }); -////var r2b/*12*/ = _.map(c3, rf2); -////} -////var r3a/*13*/ = _.map(c4, (x/*3a*/, y/*3b*/) => { return y.foo() }); -////var r3b/*14*/ = _.map(c4, rf3); -////} -////var r4a/*15*/ = _.map(c5, (x/*4a*/, y/*4b*/) => { return y.foo() }); -////} -////var r5a/*17*/ = _./*17error1*/map/*17error2*/(c2, (x/*5a*/, y/*5b*/) => { return x.toFixed() }); -////var rf1b = (x: number, y: string) => { return new Date() }; -////var r5b/*18*/ = _.map(c2, rf1b); -//// -////var r6a/*19*/ = _.map, string, Date>(c3, (x/*6a*/,y/*6b*/) => { return new Date(); }); -////var rf2b = (x: Collection, y: string) => { return new Date(); }; -////var r6b/*20*/ = _.map, string, Date>(c3, rf2b); -//// -////var r7a/*21*/ = _./*21error1*/map/*21error2*/(c4, (x/*7a*/,y/*7b*/) => { return y.foo() }); -////var r7b/*22*/ = _./*22error1*/map/*22error2*/(c4, rf3); -//// -////var r8a/*23*/ = _.map(c5, (x/*8a*/,y/*8b*/) => { return y.foo() }); - -// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.marker('2a'); -verify.quickInfoIs('Collection'); -goTo.marker('2b'); -verify.quickInfoIs('string'); - -goTo.marker('3a'); -verify.quickInfoIs('number'); -goTo.marker('3b'); -verify.quickInfoIs('A'); - -goTo.marker('4a'); -verify.quickInfoIs('number'); -goTo.marker('4b'); -verify.quickInfoIs('B'); - -goTo.marker('5a'); -verify.quickInfoIs('number'); -goTo.marker('5b'); -verify.quickInfoIs('string'); - -goTo.marker('6a'); -verify.quickInfoIs('Collection'); -goTo.marker('6b'); -verify.quickInfoIs('string'); - -goTo.marker('7a'); -verify.quickInfoIs('number'); -goTo.marker('7b'); -verify.quickInfoIs('A'); - -goTo.marker('8a'); -verify.quickInfoIs('number'); -goTo.marker('8b'); -verify.quickInfoIs('B'); // Specialized to any because no type argument was specified - -goTo.marker('9'); -verify.quickInfoIs('Collection'); -goTo.marker('10'); -verify.quickInfoIs('Collection'); -goTo.marker('11'); -verify.quickInfoIs('Collection, number>'); -goTo.marker('12'); -verify.quickInfoIs('Collection, number>'); -goTo.marker('13'); -verify.quickInfoIs('Collection'); -goTo.marker('14'); -verify.quickInfoIs('Collection'); -goTo.marker('15'); -verify.quickInfoIs('Collection'); - -goTo.marker('17'); -verify.quickInfoIs('any'); // This is actually due to an error because toFixed does not return a Date - -goTo.marker('18'); -verify.quickInfoIs('Collection'); - -goTo.marker('19'); -verify.quickInfoIs('Collection, Date>'); - -goTo.marker('20'); -verify.quickInfoIs('Collection, Date>'); - -goTo.marker('21'); -verify.quickInfoIs('any'); // This call is an error because y.foo() does not return a string - -goTo.marker('22'); -verify.quickInfoIs('any'); // This call is an error because y.foo() does not return a string - -goTo.marker('23'); -verify.quickInfoIs('Collection'); - -verify.errorExistsBetweenMarkers('error1', 'error2'); -verify.errorExistsBetweenMarkers('17error1', '17error2'); -verify.errorExistsBetweenMarkers('21error1', '21error2'); -verify.errorExistsBetweenMarkers('22error1', '22error2'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericFunctionReturnType.ts b/tests/cases/fourslash_old/genericFunctionReturnType.ts deleted file mode 100644 index e08cdbc3ab4..00000000000 --- a/tests/cases/fourslash_old/genericFunctionReturnType.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// - -////function foo(x: T, y: U): (a: U) => T { -//// var z = y; -//// return (z) => x; -////} - -////var r/*2*/ = foo(/*1*/1, ""); -////var r2/*4*/ = r(/*3*/""); - -goTo.marker('1'); -verify.currentSignatureHelpIs('foo(x: number, y: string): (a: string) => number'); - -goTo.marker('2'); -verify.quickInfoIs('(a: string) => number'); - -goTo.marker('3'); -verify.currentSignatureHelpIs('r(a: string): number'); - -goTo.marker('4'); -verify.quickInfoIs('number'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericFunctionReturnType2.ts b/tests/cases/fourslash_old/genericFunctionReturnType2.ts deleted file mode 100644 index fc90b1eff8d..00000000000 --- a/tests/cases/fourslash_old/genericFunctionReturnType2.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -////class C { -//// constructor(x: T) { } -//// foo(x: T) { -//// return (a: T) => x; -//// } -////} - -////var x = new C(1); -////var r/*2*/ = x.foo(/*1*/3); -////var r2/*4*/ = r(/*3*/4); - -goTo.marker('1'); -verify.currentSignatureHelpIs('foo(x: number): (a: number) => number'); - -goTo.marker('2'); -verify.quickInfoIs('(a: number) => number'); - -goTo.marker('3'); -verify.currentSignatureHelpIs('r(a: number): number'); - -goTo.marker('4'); -verify.quickInfoIs('number'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericTypeArgumentInference1.ts b/tests/cases/fourslash_old/genericTypeArgumentInference1.ts deleted file mode 100644 index 3d05692d243..00000000000 --- a/tests/cases/fourslash_old/genericTypeArgumentInference1.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -////module Underscore { -//// export interface Iterator { -//// (value: T, index: any, list: any): U; -//// } -//// -//// export interface Static { -//// all(list: T[], iterator?: Iterator, context?: any): T; -//// identity(value: T): T; -//// } -////} -//// -////declare var _: Underscore.Static; -////var r/*1*/ = _./*11*/all([true, 1, null, 'yes'], _.identity); -////var r2/*2*/ = _./*21*/all([true], _.identity); -////var r3/*3*/ = _./*31*/all([], _.identity); -////var r4/*4*/ = _./*41*/all([true], _.identity); - -goTo.marker('1'); -verify.quickInfoIs('{}'); -goTo.marker('11'); -verify.quickInfoIs('(list: {}[], iterator?: Underscore.Iterator<{}, boolean>, context?: any): {}'); - -goTo.marker('2'); -verify.quickInfoIs('boolean'); -goTo.marker('21'); -verify.quickInfoIs('(list: boolean[], iterator?: Underscore.Iterator, context?: any): boolean'); - -goTo.marker('3'); -verify.quickInfoIs('any'); -goTo.marker('31'); -verify.quickInfoIs('(list: any[], iterator?: Underscore.Iterator, context?: any): any'); - -goTo.marker('4'); -verify.quickInfoIs('any'); -goTo.marker('41'); -verify.quickInfoIs('(list: any[], iterator?: Underscore.Iterator, context?: any): any'); - -verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash_old/genericTypeArgumentInference2.ts b/tests/cases/fourslash_old/genericTypeArgumentInference2.ts deleted file mode 100644 index 3e7cc9eab93..00000000000 --- a/tests/cases/fourslash_old/genericTypeArgumentInference2.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -////module Underscore { -//// export interface Iterator { -//// (value: T, index: any, list: any): U; -//// } -//// -//// export interface Static { -//// all(list: T[], iterator?: Iterator, context?: any): T; -//// identity(value: T): T; -//// } -////} -//// -////declare var _: Underscore.Static; -////var r/*1*/ = _./*11*/all([true, 1, null, 'yes'], _.identity); -////var r2/*2*/ = _./*21*/all([true], _.identity); -////var r3/*3*/ = _./*31*/all([], _.identity); -////var r4/*4*/ = _./*41*/all([true], _.identity); - -goTo.marker('1'); -verify.quickInfoIs('{}'); -goTo.marker('11'); -verify.quickInfoIs('(list: {}[], iterator?: Underscore.Iterator<{}, boolean>, context?: any): {}'); - -goTo.marker('2'); -verify.quickInfoIs('boolean'); -goTo.marker('21'); -verify.quickInfoIs('(list: boolean[], iterator?: Underscore.Iterator, context?: any): boolean'); - -goTo.marker('3'); -verify.quickInfoIs('any'); -goTo.marker('31'); -verify.quickInfoIs('(list: any[], iterator?: Underscore.Iterator, context?: any): any'); - -goTo.marker('4'); -verify.quickInfoIs('any'); -goTo.marker('41'); -verify.quickInfoIs('(list: any[], iterator?: Underscore.Iterator, context?: any): any'); - -verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash_old/genericWithSpecializedProperties1.ts b/tests/cases/fourslash_old/genericWithSpecializedProperties1.ts deleted file mode 100644 index 6d22db12e96..00000000000 --- a/tests/cases/fourslash_old/genericWithSpecializedProperties1.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -////interface Foo { -//// x: Foo; -//// y: Foo; -////} - -////var f: Foo; -////var xx/*1*/ = f.x; -////var yy/*2*/ = f.y; - -////var f2: Foo; -////var x2/*3*/ = f2.x; -////var y2/*4*/ = f2.y; - -goTo.marker('1'); -verify.quickInfoIs('Foo'); -goTo.marker('2'); -verify.quickInfoIs('Foo'); - -goTo.marker('3'); -verify.quickInfoIs('Foo'); -goTo.marker('4'); -verify.quickInfoIs('Foo'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericWithSpecializedProperties2.ts b/tests/cases/fourslash_old/genericWithSpecializedProperties2.ts deleted file mode 100644 index 14107df04a6..00000000000 --- a/tests/cases/fourslash_old/genericWithSpecializedProperties2.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// - -////interface Foo { -//// y: Foo; -//// x: Foo; -////} -////var f: Foo; -////var x/*1*/ = f.x; -////var y/*2*/ = f.y; - -////var f2: Foo; -////var x2/*3*/ = f2.x; -////var y2/*4*/ = f2.y; - -goTo.marker('1'); -verify.quickInfoIs('Foo'); -goTo.marker('2'); -verify.quickInfoIs('Foo'); - -goTo.marker('3'); -verify.quickInfoIs('Foo'); -goTo.marker('4'); -verify.quickInfoIs('Foo'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/genericWithSpecializedProperties3.ts b/tests/cases/fourslash_old/genericWithSpecializedProperties3.ts deleted file mode 100644 index dc7a83879c4..00000000000 --- a/tests/cases/fourslash_old/genericWithSpecializedProperties3.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -////interface Foo { -//// x: Foo; -//// y: Foo; -////} - -////var f: Foo; -////var xx/*1*/ = f.x; -////var yy/*2*/ = f.y; - -////var f2: Foo; -////var x2/*3*/ = f2.x; -////var y2/*4*/ = f2.y; - -goTo.marker('1'); -verify.quickInfoIs('Foo'); -goTo.marker('2'); -verify.quickInfoIs('Foo'); - -goTo.marker('3'); -verify.quickInfoIs('Foo'); -goTo.marker('4'); -verify.quickInfoIs('Foo'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/indexerReturnTypes1.ts b/tests/cases/fourslash_old/indexerReturnTypes1.ts deleted file mode 100644 index 5443001432d..00000000000 --- a/tests/cases/fourslash_old/indexerReturnTypes1.ts +++ /dev/null @@ -1,111 +0,0 @@ -/// - -////interface Numeric { -//// [x: number]: Date; -////} -////} -////interface Stringy { -//// [x: string]: RegExp; -////} -////} -////interface NumericPlus { -//// [x: number]: Date; -//// foo(): Date; -////} -////} -////interface StringyPlus { -//// [x: string]: RegExp; -//// foo(): RegExp; -////} -////} -////interface NumericG { -//// [x: number]: T; -////} -////} -////interface StringyG { -//// [x: string]: T; -////} -////} -////interface Ty { -//// [x: number]: Ty; -////} -////interface Ty2 { -//// [x: number]: { [x: number]: T }; -////} -//// -//// -////} -////var numeric: Numeric; -////var stringy: Stringy; -////var numericPlus: NumericPlus; -////var stringPlus: StringyPlus; -////var numericG: NumericG; -////var stringyG: StringyG; -////var ty: Ty; -////var ty2: Ty2; -//// -////var r1/*1*/ = numeric[1]; -////var r2/*2*/ = numeric['1']; -////var r3/*3*/ = stringy[1]; -////var r4/*4*/ = stringy['1']; -////var r5/*5*/ = numericPlus[1]; -////var r6/*6*/ = numericPlus['1']; -////var r7/*7*/ = stringPlus[1]; -////var r8/*8*/ = stringPlus['1']; -////var r9/*9*/ = numericG[1]; -////var r10/*10*/ = numericG['1']; -////var r11/*11*/ = stringyG[1]; -////var r12/*12*/ = stringyG['1']; -////var r13/*13*/ = ty[1]; -////var r14/*14*/ = ty['1']; -////var r15/*15*/ = ty2[1]; -////var r16/*16*/ = ty2['1']; - - -goTo.marker('1'); -verify.quickInfoIs('Date'); - -goTo.marker('2'); -verify.quickInfoIs('any'); - -goTo.marker('3'); -verify.quickInfoIs('RegExp'); - -goTo.marker('4'); -verify.quickInfoIs('RegExp'); - -goTo.marker('5'); -verify.quickInfoIs('Date'); - -goTo.marker('6'); -verify.quickInfoIs('any'); - -goTo.marker('7'); -verify.quickInfoIs('RegExp'); - -goTo.marker('8'); -verify.quickInfoIs('RegExp'); - -goTo.marker('9'); -verify.quickInfoIs('Date'); - -goTo.marker('10'); -verify.quickInfoIs('any'); - -goTo.marker('11'); -verify.quickInfoIs('Date'); - -goTo.marker('12'); -verify.quickInfoIs('Date'); - -goTo.marker('13'); -verify.quickInfoIs('Ty'); - -goTo.marker('14'); -verify.quickInfoIs('any'); - -goTo.marker('15'); -verify.quickInfoIs('{ [x: number]: Date; }'); - -goTo.marker('16'); -verify.quickInfoIs('any'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/memberListOfModuleInAnotherModule.ts b/tests/cases/fourslash_old/memberListOfModuleInAnotherModule.ts deleted file mode 100644 index fcbfc607453..00000000000 --- a/tests/cases/fourslash_old/memberListOfModuleInAnotherModule.ts +++ /dev/null @@ -1,38 +0,0 @@ -/// - -////module mod1 { -//// var mX = 1; -//// function mFunc() { } -//// class mClass { } -//// module mMod { } -//// interface mInt {} -//// export var meX = 1; -//// export function meFunc() { } -//// export class meClass { } -//// export module meMod { export var iMex = 1; } -//// export interface meInt {} -////} -//// -////module frmConfirm { -//// import Mod1 = mod1; -//// import iMod1 = mod1./*1*/meMod; -//// Mod1./*2*/meX = 1; -//// iMod1./*3*/iMex = 1; -////} - -goTo.marker('1'); -verify.completionListContains('meX', 'number'); -verify.completionListContains('meFunc', '(): void'); -verify.completionListContains('meClass', 'mod1.meClass'); -verify.completionListContains('meMod', 'mod1.meMod'); -verify.completionListContains('meInt', 'mod1.meInt'); - -goTo.marker('2'); -verify.completionListContains('meX', 'number'); -verify.completionListContains('meFunc', '(): void'); -verify.completionListContains('meClass', 'mod1.meClass'); -verify.completionListContains('meMod', 'mod1.meMod'); -verify.completionListContains('meInt', 'mod1.meInt'); - -goTo.marker('3'); -verify.completionListContains('iMex', 'number'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/noTypeParameterInLHS.ts b/tests/cases/fourslash_old/noTypeParameterInLHS.ts deleted file mode 100644 index c99b518e5d6..00000000000 --- a/tests/cases/fourslash_old/noTypeParameterInLHS.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// - -////interface I { } -////class C {} -////var i/*1*/: I; -////var c/*2*/: C; - -goTo.marker('1'); -verify.quickInfoIs('I'); -goTo.marker('2'); -verify.quickInfoIs('C>'); diff --git a/tests/cases/fourslash_old/numericPropertyNames.ts b/tests/cases/fourslash_old/numericPropertyNames.ts deleted file mode 100644 index 5d15882ed1b..00000000000 --- a/tests/cases/fourslash_old/numericPropertyNames.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// - -////var t2/**/ = { 0: 1, 1: "" }; - -goTo.marker(); -verify.quickInfoIs('{ 0: number; 1: string; }'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/overloadOnConstCallSignature.ts b/tests/cases/fourslash_old/overloadOnConstCallSignature.ts deleted file mode 100644 index d206b139072..00000000000 --- a/tests/cases/fourslash_old/overloadOnConstCallSignature.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -////var foo: { -//// (name: string): string; -//// (name: 'order'): string; -//// (name: 'content'): string; -//// (name: 'done'): string; -////} - -////var x/*2*/ = foo(/*1*/ - -goTo.marker('1'); -verify.signatureHelpCountIs(4); -verify.currentSignatureHelpIs('foo(name: string): string'); -edit.insert('"hi"'); - -goTo.marker('2'); -verify.quickInfoIs('string'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/proto.ts b/tests/cases/fourslash_old/proto.ts deleted file mode 100644 index ae98e6f167b..00000000000 --- a/tests/cases/fourslash_old/proto.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - -////module M { -//// export interface /*1*/__proto__ {} -////} -////var /*2*/__proto__: M.__proto__; -/////*3*/ -////var /*4*/fun: (__proto__: any) => boolean; - -goTo.marker('1'); -verify.quickInfoIs("__proto__", "", "M.__proto__", "interface"); -goTo.marker('2'); -verify.quickInfoIs("M.__proto__", "", "__proto__", "var"); -goTo.marker('3'); -verify.completionListContains("__proto__", "M.__proto__", "", "__proto__", "var"); -edit.insert("__proto__"); -goTo.definition(); -verify.caretAtMarker('2'); -goTo.marker('4'); -verify.quickInfoIs("(__proto__: any) => boolean", "", "fun", "var"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/prototypeProperty.ts b/tests/cases/fourslash_old/prototypeProperty.ts deleted file mode 100644 index d31bf01e34e..00000000000 --- a/tests/cases/fourslash_old/prototypeProperty.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// - -////class A {} -////A.prototype/*1*/; -////A./*2*/ - -goTo.marker('1'); -verify.quickInfoIs('A'); - -goTo.marker('2'); -verify.completionListContains('prototype', 'A'); diff --git a/tests/cases/fourslash_old/qualifyModuleTypeNames.ts b/tests/cases/fourslash_old/qualifyModuleTypeNames.ts deleted file mode 100644 index 50a9f6c85f0..00000000000 --- a/tests/cases/fourslash_old/qualifyModuleTypeNames.ts +++ /dev/null @@ -1,8 +0,0 @@ -/// - -////module m { export class c { } }; -////function x(arg: m.c) { return arg; } -////x(/**/ - -goTo.marker(); -verify.currentSignatureHelpIs('x(arg: m.c): m.c'); diff --git a/tests/cases/fourslash_old/quickInfoForGenericPrototypeMember.ts b/tests/cases/fourslash_old/quickInfoForGenericPrototypeMember.ts deleted file mode 100644 index e1233f10bf6..00000000000 --- a/tests/cases/fourslash_old/quickInfoForGenericPrototypeMember.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -////class C { -//// foo(x: T) { } -////} -////var x = new C/*1*/(); -////var y = C.proto/*2*/type; - -goTo.marker('1'); -verify.quickInfoIs('(): C'); - -goTo.marker('2'); -verify.quickInfoIs('C'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoGenerics.ts b/tests/cases/fourslash_old/quickInfoGenerics.ts deleted file mode 100644 index 6fe75424149..00000000000 --- a/tests/cases/fourslash_old/quickInfoGenerics.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -////class Con/*1*/tainer { -//// x: T; -////} -////interface IList { -//// getItem(i: number): /*3*/T; -////} -////class List> implements IList { -//// private __it/*6*/em: /*5*/T[]; -//// public get/*7*/Item(i: number) { -//// return this.__item[i]; -//// } -////} - -goTo.marker("1"); -verify.quickInfoIs(undefined, undefined, "Container", "class"); -goTo.marker("2"); -verify.quickInfoIs(undefined, undefined, "T in IList", "type parameter"); -goTo.marker("3"); -verify.quickInfoIs(undefined, undefined, "T in IList", "type parameter"); -goTo.marker("4"); -verify.quickInfoIs(undefined, undefined, "T in List>", "type parameter"); -goTo.marker("5"); -verify.quickInfoIs(undefined, undefined, "T in List>", "type parameter"); -goTo.marker("6"); -verify.quickInfoIs(undefined, undefined, "List>.__item", "property"); -goTo.marker("7"); -verify.quickInfoIs(undefined, undefined, "List>.getItem", "method"); - - diff --git a/tests/cases/fourslash_old/quickInfoInFunctionTypeReference2.ts b/tests/cases/fourslash_old/quickInfoInFunctionTypeReference2.ts deleted file mode 100644 index 3a34388355c..00000000000 --- a/tests/cases/fourslash_old/quickInfoInFunctionTypeReference2.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -////class C { -//// map(fn: (k/*1*/: string, value/*2*/: T, context: any) => void, context: any) { -//// } -////} - -////var c: C; -////c.map(/*3*/ - -goTo.marker('1'); -verify.quickInfoIs('string'); - -goTo.marker('2'); -verify.quickInfoIs('T'); - -goTo.marker('3'); -verify.currentSignatureHelpIs('map(fn: (k: string, value: number, context: any) => void, context: any): void'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoInInvalidIndexSignature.ts b/tests/cases/fourslash_old/quickInfoInInvalidIndexSignature.ts deleted file mode 100644 index 34b8987556e..00000000000 --- a/tests/cases/fourslash_old/quickInfoInInvalidIndexSignature.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// - -//// function method() { var dictionary/**/ = <{ [index]: string; }>{}; } - -goTo.marker(); -verify.quickInfoIs('{ [index: any]: string; }'); diff --git a/tests/cases/fourslash_old/quickInfoOfGenericTypeAssertions1.ts b/tests/cases/fourslash_old/quickInfoOfGenericTypeAssertions1.ts deleted file mode 100644 index cb96acb6854..00000000000 --- a/tests/cases/fourslash_old/quickInfoOfGenericTypeAssertions1.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -////function f(x: T): T { return null; } -////var r/*1*/ = (x: T) => x; -////var r2/*2*/ = < (x: T) => T>f; - -////var a; -////var r3/*3*/ = < (x: (y: A) => A) => T>a; - -goTo.marker('1'); -verify.quickInfoIs('(x: T) => T'); - -goTo.marker('2'); -verify.quickInfoIs('(x: T) => T'); - -goTo.marker('3'); -verify.quickInfoIs('(x: (y: A) => A) => T'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoOnConstructorWithGenericParameter.ts b/tests/cases/fourslash_old/quickInfoOnConstructorWithGenericParameter.ts deleted file mode 100644 index e77c2607a8e..00000000000 --- a/tests/cases/fourslash_old/quickInfoOnConstructorWithGenericParameter.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -////interface I { -//// x: number; -////} -////class Foo { -//// y: T; -////} -////class A { -//// foo() { } -////} -////class B extends A { -//// constructor(a: Foo, b: number) { -//// super(); -//// } -////} -////var x = new /*2*/B(/*1*/ - -// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.marker("1"); -verify.currentSignatureHelpIs("B(a: Foo, b: number): B"); -edit.insert("null,"); -verify.currentSignatureHelpIs("B(a: Foo, b: number): B"); -edit.insert("10);"); - -goTo.marker("2"); -verify.quickInfoIs("(a: Foo, b: number): B", undefined, "B", "constructor"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoOnGenericWithConstraints1.ts b/tests/cases/fourslash_old/quickInfoOnGenericWithConstraints1.ts deleted file mode 100644 index 83deedf186b..00000000000 --- a/tests/cases/fourslash_old/quickInfoOnGenericWithConstraints1.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// - -////interface Fo/*1*/o {} - -goTo.marker('1'); -verify.quickInfoIs('Foo', null, 'Foo') - -goTo.marker('2'); -verify.quickInfoIs('TT extends Date', null, 'TT in Foo') diff --git a/tests/cases/fourslash_old/quickInfoOnObjectLiteralWithAccessors.ts b/tests/cases/fourslash_old/quickInfoOnObjectLiteralWithAccessors.ts deleted file mode 100644 index 55bf4e1dd4b..00000000000 --- a/tests/cases/fourslash_old/quickInfoOnObjectLiteralWithAccessors.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -////function /*1*/makePoint(x: number) { -//// return { -//// b: 10, -//// get x() { return x; }, -//// set x(a: number) { this.b = a; } -//// }; -////}; -////var /*4*/point = makePoint(2); -////var /*2*/x = point.x; -////point./*3*/x = 30; - -goTo.marker('1'); -verify.quickInfoIs("(x: number): { b: number; x: number; }", undefined, "makePoint", "function"); - -goTo.marker('2'); -verify.quickInfoIs("number", undefined, "x", "var"); - -goTo.marker('3'); -verify.memberListContains("x", "number", undefined, "x", "property"); -verify.memberListContains("b", "number", undefined, "b", "property"); -verify.quickInfoIs("number", undefined, "x", "property"); - -goTo.marker('4'); -verify.quickInfoIs("{ b: number; x: number; }", undefined, "point", "var"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoOnObjectLiteralWithOnlyGetter.ts b/tests/cases/fourslash_old/quickInfoOnObjectLiteralWithOnlyGetter.ts deleted file mode 100644 index ef08f0841db..00000000000 --- a/tests/cases/fourslash_old/quickInfoOnObjectLiteralWithOnlyGetter.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// - -////function /*1*/makePoint(x: number) { -//// return { -//// get x() { return x; }, -//// }; -////}; -////var /*4*/point = makePoint(2); -////var /*2*/x = point./*3*/x; - -goTo.marker('1'); -verify.quickInfoIs("(x: number): { x: number; }", undefined, "makePoint", "function"); - -goTo.marker('2'); -verify.quickInfoIs("number", undefined, "x", "var"); - -goTo.marker('3'); -verify.memberListContains("x", "number", undefined, "x", "property"); - -goTo.marker('4'); -verify.quickInfoIs("{ x: number; }", undefined, "point", "var"); diff --git a/tests/cases/fourslash_old/quickInfoOnObjectLiteralWithOnlySetter.ts b/tests/cases/fourslash_old/quickInfoOnObjectLiteralWithOnlySetter.ts deleted file mode 100644 index 8361426793f..00000000000 --- a/tests/cases/fourslash_old/quickInfoOnObjectLiteralWithOnlySetter.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - -////function /*1*/makePoint(x: number) { -//// return { -//// b: 10, -//// set x(a: number) { this.b = a; } -//// }; -////}; -////var /*3*/point = makePoint(2); -////point./*2*/x = 30; - -goTo.marker('1'); -verify.quickInfoIs("(x: number): { b: number; x: number; }", undefined, "makePoint", "function"); - -goTo.marker('2'); -verify.memberListContains("x", "number", undefined, "x", "property"); -verify.memberListContains("b", "number", undefined, "b", "property"); - -goTo.marker('3'); -verify.quickInfoIs("{ b: number; x: number; }", undefined, "point", "var"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/quickInfoShowsGenericSpecialization.ts b/tests/cases/fourslash_old/quickInfoShowsGenericSpecialization.ts deleted file mode 100644 index 70719417699..00000000000 --- a/tests/cases/fourslash_old/quickInfoShowsGenericSpecialization.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -////class A { } -////var foo/**/ = new A(); - -goTo.marker(); -verify.quickInfoIs('A'); diff --git a/tests/cases/fourslash_old/recursiveObjectLiteral.ts b/tests/cases/fourslash_old/recursiveObjectLiteral.ts deleted file mode 100644 index 482d7394155..00000000000 --- a/tests/cases/fourslash_old/recursiveObjectLiteral.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// - -////var a = { f: a/**/ - -goTo.marker(); -verify.quickInfoIs("{ f: any; }", null, "a", "var"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/regexp.ts b/tests/cases/fourslash_old/regexp.ts deleted file mode 100644 index 2b1d96c604e..00000000000 --- a/tests/cases/fourslash_old/regexp.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// - -////var x/**/ = /aa/; - -goTo.marker(); -verify.quickInfoIs("RegExp"); diff --git a/tests/cases/fourslash_old/restArgType.ts b/tests/cases/fourslash_old/restArgType.ts deleted file mode 100644 index eda49715e43..00000000000 --- a/tests/cases/fourslash_old/restArgType.ts +++ /dev/null @@ -1,80 +0,0 @@ -/// - -////class Test { -//// private _priv(...restArgs/*1*/) { -//// } -//// public pub(...restArgs/*2*/) { -//// var x = restArgs[2]; -//// } -////} -////var x: (...y: string[]) => void = function (...y/*3*/) { -//// var t = y; -////}; -////function foo(x: (...y: string[]) => void ) { } -////foo((...y1/*4*/) => { -//// var t = y; -////}); -////foo((y2/*5*/) => { -//// var t = y; -////}); -////var t1 :(a1: string, a2: string) => void = (...f1/*t1*/) => { } // f1 => any[]; -////var t2: (a1: string, ...a2: string[]) => void = (...f1/*t2*/) => { } // f1 => any[]; -////var t3: (a1: number, a2: boolean, ...c: string[]) => void = (f1/*t31*/, ...f2/*t32*/) => { }; // f1 => number, f2 => any[] -////var t4: (...a1: string[]) => void = (...f1/*t4*/) => { }; // f1 => string[] -////var t5: (...a1: string[]) => void = (f1/*t5*/) => { }; // f1 => string -////var t6: (...a1: string[]) => void = (f1/*t61*/, ...f2/*t62*/) => { }; // f1 => string, f2 => string[] -////var t7: (...a1: string[]) => void = (f1/*t71*/, f2/*t72*/, f3/*t73*/) => { }; // fa => string, f2 => string, f3 => string -////// Explicit type annotation -////var t8: (...a1: string[]) => void = (f1/*t8*/: number[]) => { }; -////// Explicit initialization value -////var t9: (a1: string[], a2: string[]) => void = (f1/*t91*/ = 4, f2/*t92*/ = [false, true]) => { }; - -goTo.marker("1"); -verify.quickInfoIs("any[]", "", "restArgs", "parameter"); -goTo.marker("2"); -verify.quickInfoIs("any[]", "", "restArgs", "parameter"); - -goTo.marker("3"); -verify.quickInfoIs("string[]", "", "y", "parameter"); - -goTo.marker("4"); -verify.quickInfoIs("string[]", "", "y1", "parameter"); -goTo.marker("5"); -verify.quickInfoIs("string", "", "y2", "parameter"); - -goTo.marker("t1"); -verify.quickInfoIs("any[]", "", "f1", "parameter"); - -goTo.marker("t2"); -verify.quickInfoIs("any[]", "", "f1", "parameter"); - -goTo.marker("t31"); -verify.quickInfoIs("number", "", "f1", "parameter"); -goTo.marker("t32"); -verify.quickInfoIs("any[]", "", "f2", "parameter"); - -goTo.marker("t4"); -verify.quickInfoIs("string[]", "", "f1", "parameter"); - -goTo.marker("t5"); -verify.quickInfoIs("string", "", "f1", "parameter"); - -goTo.marker("t61"); -verify.quickInfoIs("string", "", "f1", "parameter"); -goTo.marker("t62"); -verify.quickInfoIs("string[]", "", "f2", "parameter"); - -goTo.marker("t71"); -verify.quickInfoIs("string", "", "f1", "parameter"); -goTo.marker("t72"); -verify.quickInfoIs("string", "", "f2", "parameter"); -goTo.marker("t73"); -verify.quickInfoIs("string", "", "f3", "parameter"); - -goTo.marker("t8"); -verify.quickInfoIs("number[]", "", "f1", "parameter"); - -goTo.marker("t91"); -verify.quickInfoIs("string[]", "", "f1", "parameter"); -goTo.marker("t92"); -verify.quickInfoIs("string[]", "", "f2", "parameter"); \ No newline at end of file diff --git a/tests/cases/fourslash_old/typedGenericPrototypeMember.ts b/tests/cases/fourslash_old/typedGenericPrototypeMember.ts deleted file mode 100644 index a5a12c27745..00000000000 --- a/tests/cases/fourslash_old/typedGenericPrototypeMember.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -////class C { -//// foo(x: T) { } -////} -////var x/*1*/ = new C(); // Quick Info for x is C -////var y/*2*/ = C.prototype; // Quick Info for y is C<{}> - -goTo.marker('1'); -verify.quickInfoIs('C'); - -goTo.marker('2'); -verify.quickInfoIs('C'); diff --git a/tests/cases/fourslash_old/underscoreTypings1.ts b/tests/cases/fourslash_old/underscoreTypings1.ts deleted file mode 100644 index b9d6c2c2f4b..00000000000 --- a/tests/cases/fourslash_old/underscoreTypings1.ts +++ /dev/null @@ -1,62 +0,0 @@ -/// - -////interface Iterator { -//// (value: T, index: any, list: any): U; -////} -//// -////interface WrappedArray { -//// map(iterator: Iterator, context?: any): U[]; -////} -//// -////interface Underscore { -//// (list: T[]): WrappedArray; -//// map(list: T[], iterator: Iterator, context?: any): U[]; -////} -//// -////declare var _: Underscore; -//// -////var a: string[]; -////var b/*1*/ = _.map(a, x/*2*/ => x.length); // Was typed any[], should be number[] -////var c/*3*/ = _(a).map(x/*4*/ => x.length); -////var d/*5*/ = a.map(x/*6*/ => x.length); -//// -////var aa: any[]; -////var bb/*7*/ = _.map(aa, x/*8*/ => x.length); -////var cc/*9*/ = _(aa).map(x/*10*/ => x.length); -////var dd/*11*/ = aa.map(x/*12*/ => x.length); -//// -////var e = a.map(x => x./*13*/ - -goTo.marker('1'); -verify.quickInfoIs('number[]'); -goTo.marker('2'); -verify.quickInfoIs('string'); - -goTo.marker('3'); -verify.quickInfoIs('number[]'); -goTo.marker('4'); -verify.quickInfoIs('string'); - -goTo.marker('5'); -verify.quickInfoIs('number[]'); -goTo.marker('6'); -verify.quickInfoIs('string'); - -goTo.marker('7'); -verify.quickInfoIs('any[]'); -goTo.marker('8'); -verify.quickInfoIs('any'); - -goTo.marker('9'); -verify.quickInfoIs('any[]'); -goTo.marker('10'); -verify.quickInfoIs('any'); - -goTo.marker('11'); -verify.quickInfoIs('any[]'); -goTo.marker('12'); -verify.quickInfoIs('any'); - -goTo.marker('13'); -verify.completionListContains('length'); -verify.not.completionListContains('toFixed'); \ No newline at end of file diff --git a/tests/cases/fourslash_old/widenedTypes.ts b/tests/cases/fourslash_old/widenedTypes.ts deleted file mode 100644 index 88f5d637ed2..00000000000 --- a/tests/cases/fourslash_old/widenedTypes.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -////var a/*1*/ = null; // var a: any -////var b/*2*/ = undefined; // var b: any -////var c/*3*/ = { x: 0, y: null }; // var c: { x: number, y: any } -////var d/*4*/ = [null, undefined]; // var d: any[] - -goTo.marker('1'); -verify.quickInfoIs('any'); - -goTo.marker('2'); -verify.quickInfoIs('any'); - -goTo.marker('3'); -verify.quickInfoIs('{ x: number; y: any; }'); - -goTo.marker('4'); -verify.quickInfoIs('any[]');