diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4856fb694e974..8a1aa0bd8bfa5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -374,6 +374,7 @@ import { getStrictOptionValue, getSuperContainer, getSymbolNameForPrivateIdentifier, + getSynthesizedDeepClone, getTextOfIdentifierOrLiteral, getTextOfJSDocComment, getTextOfJsxAttributeName, @@ -881,6 +882,7 @@ import { moduleExportNameTextUnescaped, ModuleInstanceState, ModuleKind, + ModuleName, ModuleResolutionKind, ModuleSpecifierResolutionHost, moduleSupportsImportAttributes, @@ -1132,6 +1134,7 @@ import { WhileStatement, WideningContext, WithStatement, + WriterContextOut, YieldExpression, } from "./_namespaces/ts.js"; import * as moduleSpecifiers from "./_namespaces/ts.moduleSpecifiers.js"; @@ -1716,11 +1719,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { typePredicateToString: (predicate, enclosingDeclaration, flags) => { return typePredicateToString(predicate, getParseTreeNode(enclosingDeclaration), flags); }, - writeSignature: (signature, enclosingDeclaration, flags, kind, writer) => { - return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer); + writeSignature: (signature, enclosingDeclaration, flags, kind, writer, verbosityLevel, out) => { + return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer, verbosityLevel, out); }, - writeType: (type, enclosingDeclaration, flags, writer) => { - return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer); + writeType: (type, enclosingDeclaration, flags, writer, verbosityLevel, out) => { + return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer, verbosityLevel, out); }, writeSymbol: (symbol, enclosingDeclaration, meaning, flags, writer) => { return symbolToString(symbol, getParseTreeNode(enclosingDeclaration), meaning, flags, writer); @@ -1932,6 +1935,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { typeHasCallOrConstructSignatures, getSymbolFlags, getTypeArgumentsForResolvedSignature, + isLibType, }; function getTypeArgumentsForResolvedSignature(signature: Signature) { @@ -6027,7 +6031,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } - function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags = TypeFormatFlags.None, kind?: SignatureKind, writer?: EmitTextWriter): string { + function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags = TypeFormatFlags.None, kind?: SignatureKind, writer?: EmitTextWriter, verbosityLevel?: number, out?: WriterContextOut): string { return writer ? signatureToStringWorker(writer).getText() : usingSingleLineStringWriter(signatureToStringWorker); function signatureToStringWorker(writer: EmitTextWriter) { @@ -6038,7 +6042,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { else { sigOutput = kind === SignatureKind.Construct ? SyntaxKind.ConstructSignature : SyntaxKind.CallSignature; } - const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.WriteTypeParametersInQualifiedName); + const sig = nodeBuilder.signatureToSignatureDeclaration( + signature, + sigOutput, + enclosingDeclaration, + toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.WriteTypeParametersInQualifiedName, + /*internalFlags*/ undefined, + /*tracker*/ undefined, + verbosityLevel, + out, + ); const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon(); const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration); printer.writeNode(EmitHint.Unspecified, sig!, /*sourceFile*/ sourceFile, getTrailingSemicolonDeferringWriter(writer)); // TODO: GH#18217 @@ -6046,9 +6059,25 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } - function typeToString(type: Type, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.AllowUniqueESSymbolType | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, writer: EmitTextWriter = createTextWriter("")): string { - const noTruncation = compilerOptions.noErrorTruncation || flags & TypeFormatFlags.NoTruncation; - const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | (noTruncation ? NodeBuilderFlags.NoTruncation : NodeBuilderFlags.None), /*internalFlags*/ undefined); + function typeToString( + type: Type, + enclosingDeclaration?: Node, + flags: TypeFormatFlags = TypeFormatFlags.AllowUniqueESSymbolType | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, + writer: EmitTextWriter = createTextWriter(""), + verbosityLevel?: number, + out?: WriterContextOut, + ): string { + const noTruncation = compilerOptions.noErrorTruncation || + flags & TypeFormatFlags.NoTruncation; + const typeNode = nodeBuilder.typeToTypeNode( + type, + enclosingDeclaration, + toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | (noTruncation ? NodeBuilderFlags.NoTruncation : 0), + /*internalFlags*/ undefined, + /*tracker*/ undefined, + verbosityLevel, + out, + ); if (typeNode === undefined) return Debug.fail("should always get typenode"); // The unresolved type gets a synthesized comment on `any` to hint to users that it's not a plain `any`. // Otherwise, we always strip comments out. @@ -6270,20 +6299,21 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { }; return { syntacticBuilderResolver, - typeToTypeNode: (type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => typeToTypeNodeHelper(type, context)), - typePredicateToTypePredicateNode: (typePredicate: TypePredicate, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => typePredicateToTypePredicateNodeHelper(typePredicate, context)), - serializeTypeForExpression: (expr: Expression, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)), - serializeTypeForDeclaration: (declaration: HasInferredType, symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol, context)), - serializeReturnTypeForSignature: (signature: SignatureDeclaration, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context)), - indexInfoToIndexSignatureDeclaration: (indexInfo: IndexInfo, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => indexInfoToIndexSignatureDeclarationHelper(indexInfo, context, /*typeNode*/ undefined)), - signatureToSignatureDeclaration: (signature: Signature, kind: SignatureDeclaration["kind"], enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => signatureToSignatureDeclarationHelper(signature, kind, context)), - symbolToEntityName: (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => symbolToName(symbol, context, meaning, /*expectsIdentifier*/ false)), - symbolToExpression: (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => symbolToExpression(symbol, context, meaning)), - symbolToTypeParameterDeclarations: (symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => typeParametersToTypeParameterDeclarations(symbol, context)), - symbolToParameterDeclaration: (symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => symbolToParameterDeclaration(symbol, context)), - typeParameterToDeclaration: (parameter: TypeParameter, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => typeParameterToDeclaration(parameter, context)), - symbolTableToDeclarationStatements: (symbolTable: SymbolTable, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => symbolTableToDeclarationStatements(symbolTable, context)), - symbolToNode: (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, context => symbolToNode(symbol, context, meaning)), + typeToTypeNode: (type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker, verbosityLevel?: number, out?: WriterContextOut) => withContext(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, context => typeToTypeNodeHelper(type, context), out), + typePredicateToTypePredicateNode: (typePredicate: TypePredicate, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => typePredicateToTypePredicateNodeHelper(typePredicate, context)), + serializeTypeForDeclaration: (declaration: HasInferredType, symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol, context)), + serializeReturnTypeForSignature: (signature: SignatureDeclaration, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context)), + serializeTypeForExpression: (expr: Expression, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)), + indexInfoToIndexSignatureDeclaration: (indexInfo: IndexInfo, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => indexInfoToIndexSignatureDeclarationHelper(indexInfo, context, /*typeNode*/ undefined)), + signatureToSignatureDeclaration: (signature: Signature, kind: SignatureDeclaration["kind"], enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker, verbosityLevel?: number, out?: WriterContextOut) => withContext(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, context => signatureToSignatureDeclarationHelper(signature, kind, context), out), + symbolToEntityName: (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => symbolToName(symbol, context, meaning, /*expectsIdentifier*/ false)), + symbolToExpression: (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => symbolToExpression(symbol, context, meaning)), + symbolToTypeParameterDeclarations: (symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => typeParametersToTypeParameterDeclarations(symbol, context)), + symbolToParameterDeclaration: (symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => symbolToParameterDeclaration(symbol, context)), + typeParameterToDeclaration: (parameter: TypeParameter, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker, verbosityLevel?: number, out?: WriterContextOut) => withContext(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, context => typeParameterToDeclaration(parameter, context), out), + symbolTableToDeclarationStatements: (symbolTable: SymbolTable, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => symbolTableToDeclarationStatements(symbolTable, context)), + symbolToNode: (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*verbosityLevel*/ undefined, context => symbolToNode(symbol, context, meaning)), + symbolToDeclarations, }; function getTypeFromTypeNode(context: NodeBuilderContext, node: TypeNode, noMappedTypes?: false): Type; @@ -6343,7 +6373,85 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return symbolToExpression(symbol, context, meaning); } - function withContext(enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined, internalFlags: InternalNodeBuilderFlags | undefined, tracker: SymbolTracker | undefined, cb: (context: NodeBuilderContext) => T): T | undefined { + function symbolToDeclarations(symbol: Symbol, meaning: SymbolFlags, flags: NodeBuilderFlags, verbosityLevel?: number, out?: WriterContextOut): Declaration[] { + const nodes = withContext( + /*enclosingDeclaration*/ undefined, + flags, + /*internalFlags*/ undefined, + /*tracker*/ undefined, + verbosityLevel, + context => symbolToDeclarationsWorker(symbol, context), + out, + ); + return mapDefined(nodes, node => { + switch (node.kind) { + case SyntaxKind.ClassDeclaration: + return simplifyClassDeclaration(node as ClassDeclaration, symbol); + case SyntaxKind.EnumDeclaration: + return simplifyModifiers(node as EnumDeclaration, isEnumDeclaration, symbol); + case SyntaxKind.InterfaceDeclaration: + return simplifyInterfaceDeclaration(node as InterfaceDeclaration, symbol, meaning); + case SyntaxKind.ModuleDeclaration: + return simplifyModifiers(node as ModuleDeclaration, isModuleDeclaration, symbol); + default: + return undefined; + } + }); + } + + function simplifyClassDeclaration(classDecl: ClassDeclaration, symbol: Symbol): Declaration { + const classDeclarations = filter(symbol.declarations, isClassLike); + const originalClassDecl = classDeclarations && classDeclarations.length > 0 ? classDeclarations[0] : classDecl; + const modifiers = getEffectiveModifierFlags(originalClassDecl) & ~(ModifierFlags.Export | ModifierFlags.Ambient); + const isAnonymous = isClassExpression(originalClassDecl); + if (isAnonymous) { + classDecl = factory.updateClassDeclaration( + classDecl, + classDecl.modifiers, + /*name*/ undefined, + classDecl.typeParameters, + classDecl.heritageClauses, + classDecl.members, + ); + } + return factory.replaceModifiers(classDecl, modifiers); + } + + function simplifyModifiers(newDecl: Declaration & HasModifiers, isDeclKind: (d: Declaration) => boolean, symbol: Symbol): Declaration & HasModifiers { + const decls = filter(symbol.declarations, isDeclKind); + const declWithModifiers = decls && decls.length > 0 ? decls[0] : newDecl; + const modifiers = getEffectiveModifierFlags(declWithModifiers) & ~(ModifierFlags.Export | ModifierFlags.Ambient); + return factory.replaceModifiers(newDecl, modifiers); + } + + function simplifyInterfaceDeclaration(interfaceDecl: InterfaceDeclaration, symbol: Symbol, meaning: SymbolFlags): Declaration | undefined { + if (!(meaning & SymbolFlags.Interface)) { + return undefined; + } + return simplifyModifiers(interfaceDecl, isInterfaceDeclaration, symbol); + } + + function symbolToDeclarationsWorker(symbol: Symbol, context: NodeBuilderContext): Statement[] { + // We're already expanding the type: set it in the stack to avoid expanding it again. + const type = getDeclaredTypeOfSymbol(symbol); + context.typeStack.push(type.id); + context.typeStack.push(-1); + const table = createSymbolTable([symbol]); + const statements = symbolTableToDeclarationStatements(table, context); + context.typeStack.pop(); + context.typeStack.pop(); + return statements; + } + + function withContext( + enclosingDeclaration: Node | undefined, + flags: NodeBuilderFlags | undefined, + internalFlags: InternalNodeBuilderFlags | undefined, + tracker: SymbolTracker | undefined, + verbosityLevel: number | undefined, + cb: (context: NodeBuilderContext) => T, + out?: WriterContextOut, + ): T | undefined { const moduleResolverHost = tracker?.trackSymbol ? tracker.moduleResolverHost : (internalFlags || InternalNodeBuilderFlags.None) & InternalNodeBuilderFlags.DoNotIncludeSymbolChain ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : undefined; @@ -6353,6 +6461,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { flags: flags || NodeBuilderFlags.None, internalFlags: internalFlags || InternalNodeBuilderFlags.None, tracker: undefined!, + maxExpansionDepth: verbosityLevel ?? -1, encounteredError: false, suppressReportInferenceFallback: false, reportedDiagnostic: false, @@ -6375,12 +6484,22 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { typeParameterNamesByTextNextNameCount: undefined, enclosingSymbolTypes: new Map(), mapper: undefined, + depth: 0, + typeStack: [], + out: { + canIncreaseExpansionDepth: false, + truncated: false, + }, }; context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost); const resultingNode = cb(context); if (context.truncating && context.flags & NodeBuilderFlags.NoTruncation) { context.tracker.reportTruncationError(); } + if (out) { + out.canIncreaseExpansionDepth = context.out.canIncreaseExpansionDepth; + out.truncated = context.out.truncated; + } return context.encounteredError ? undefined : resultingNode; } @@ -6401,23 +6520,65 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function saveRestoreFlags(context: NodeBuilderContext) { const flags = context.flags; const internalFlags = context.internalFlags; + const depth = context.depth; return restore; function restore() { context.flags = flags; context.internalFlags = internalFlags; + context.depth = depth; } } + function checkTruncationLengthIfExpanding(context: NodeBuilderContext): boolean { + return context.maxExpansionDepth >= 0 && checkTruncationLength(context); + } + function checkTruncationLength(context: NodeBuilderContext): boolean { if (context.truncating) return context.truncating; return context.truncating = context.approximateLength > ((context.flags & NodeBuilderFlags.NoTruncation) ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength); } + /** + * Returns true if it's possible the type or one of its components can be expanded. + */ + function canPossiblyExpandType(type: Type, context: NodeBuilderContext): boolean { + for (let i = 0; i < context.typeStack.length - 1; i++) { + if (context.typeStack[i] === type.id) { + return false; + } + } + return context.depth < context.maxExpansionDepth || + context.depth === context.maxExpansionDepth && !context.out.canIncreaseExpansionDepth; + } + + /** + * Determines if the input type should be expanded, based on how many layers of names we're allowed to expand. + * @param isAlias - Whether we're expanding a type alias or not. + */ + function shouldExpandType(type: Type, context: NodeBuilderContext, isAlias = false): boolean { + if (!isAlias && isLibType(type)) { + return false; + } + for (let i = 0; i < context.typeStack.length - 1; i++) { + if (context.typeStack[i] === type.id) { + return false; + } + } + const result = context.depth < context.maxExpansionDepth; + if (!result) { + // This type would have been expanded if `maxExpansionDepth` was increased. + context.out.canIncreaseExpansionDepth = true; + } + return result; + } + function typeToTypeNodeHelper(type: Type, context: NodeBuilderContext): TypeNode { const restoreFlags = saveRestoreFlags(context); + if (type) context.typeStack.push(type.id); const typeNode = typeToTypeNodeWorker(type, context); + if (type) context.typeStack.pop(); restoreFlags(); return typeNode; } @@ -6428,6 +6589,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } const inTypeAlias = context.flags & NodeBuilderFlags.InTypeAlias; context.flags &= ~NodeBuilderFlags.InTypeAlias; + let expandingEnum = false; if (!type) { if (!(context.flags & NodeBuilderFlags.AllowEmptyUnionOrIntersection)) { @@ -6496,7 +6658,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`."); } } - return symbolToTypeNode(type.symbol, context, SymbolFlags.Type); + if (!shouldExpandType(type, context)) { + return symbolToTypeNode(type.symbol, context, SymbolFlags.Type); + } + else { + expandingEnum = true; + } } if (type.flags & TypeFlags.StringLiteral) { context.approximateLength += (type as StringLiteralType).value.length + 2; @@ -6564,18 +6731,25 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } if (!inTypeAlias && type.aliasSymbol && (context.flags & NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) { - const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context); - if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & SymbolFlags.Class)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes); - if (length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) { - return factory.createArrayTypeNode(typeArgumentNodes![0]); + if (!shouldExpandType(type, context, /*isAlias*/ true)) { + const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context); + if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & SymbolFlags.Class)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes); + if (length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) { + return factory.createArrayTypeNode(typeArgumentNodes![0]); + } + return symbolToTypeNode(type.aliasSymbol, context, SymbolFlags.Type, typeArgumentNodes); } - return symbolToTypeNode(type.aliasSymbol, context, SymbolFlags.Type, typeArgumentNodes); + context.depth += 1; } const objectFlags = getObjectFlags(type); if (objectFlags & ObjectFlags.Reference) { Debug.assert(!!(type.flags & TypeFlags.Object)); + if (shouldExpandType(type, context)) { + context.depth += 1; + return createAnonymousTypeNode(type as TypeReference, /*forceClassExpansion*/ true, /*forceExpansion*/ true); + } return (type as TypeReference).node ? visitAndTransformType(type as TypeReference, typeReferenceToTypeNode) : typeReferenceToTypeNode(type as TypeReference); } if (type.flags & TypeFlags.TypeParameter || objectFlags & ObjectFlags.ClassOrInterface) { @@ -6604,6 +6778,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { context.approximateLength += idText(name).length; return factory.createTypeReferenceNode(factory.createIdentifier(idText(name)), /*typeArguments*/ undefined); } + if (objectFlags & ObjectFlags.ClassOrInterface && shouldExpandType(type, context)) { + context.depth += 1; + return createAnonymousTypeNode(type as InterfaceType, /*forceClassExpansion*/ true, /*forceExpansion*/ true); + } // Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter. if (type.symbol) { return symbolToTypeNode(type.symbol, context, SymbolFlags.Type); @@ -6616,7 +6794,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { type = (type as UnionType).origin!; } if (type.flags & (TypeFlags.Union | TypeFlags.Intersection)) { - const types = type.flags & TypeFlags.Union ? formatUnionTypes((type as UnionType).types) : (type as IntersectionType).types; + const types = type.flags & TypeFlags.Union ? formatUnionTypes((type as UnionType).types, expandingEnum) : (type as IntersectionType).types; if (length(types) === 1) { return typeToTypeNodeHelper(types[0], context); } @@ -6811,7 +6989,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return result; } - function createAnonymousTypeNode(type: ObjectType): TypeNode { + function createAnonymousTypeNode(type: ObjectType, forceClassExpansion = false, forceExpansion = false): TypeNode { const typeId = type.id; const symbol = type.symbol; if (symbol) { @@ -6844,15 +7022,26 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } // Always use 'typeof T' for type of class, enum, and module objects else if ( - symbol.flags & SymbolFlags.Class - && !getBaseTypeVariableOfClass(symbol) - && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & NodeBuilderFlags.WriteClassExpressionAsTypeLiteral && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(symbol, context.enclosingDeclaration, isInstanceType, /*shouldComputeAliasesToMakeVisible*/ false).accessibility !== SymbolAccessibility.Accessible)) || - symbol.flags & (SymbolFlags.Enum | SymbolFlags.ValueModule) || - shouldWriteTypeOfFunctionSymbol() + !forceExpansion && + (symbol.flags & SymbolFlags.Class + && !forceClassExpansion + && !getBaseTypeVariableOfClass(symbol) + && !(symbol.valueDeclaration + && isClassLike(symbol.valueDeclaration) + && context.flags & NodeBuilderFlags.WriteClassExpressionAsTypeLiteral + && (!isClassDeclaration(symbol.valueDeclaration) + || isSymbolAccessible(symbol, context.enclosingDeclaration, isInstanceType, /*shouldComputeAliasesToMakeVisible*/ false).accessibility !== SymbolAccessibility.Accessible)) + || symbol.flags & (SymbolFlags.Enum | SymbolFlags.ValueModule) + || shouldWriteTypeOfFunctionSymbol()) ) { - return symbolToTypeNode(symbol, context, isInstanceType); + if (shouldExpandType(type, context)) { + context.depth += 1; + } + else { + return symbolToTypeNode(symbol, context, isInstanceType); + } } - else if (context.visitedTypes?.has(typeId)) { + if (context.visitedTypes?.has(typeId)) { // If type is an anonymous type literal in a type alias declaration, use type alias name const typeAlias = getTypeAliasForTypeLiteral(type); if (typeAlias) { @@ -6901,7 +7090,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { context.symbolDepth = new Map(); } - const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration); + // Don't rely on type cache if we're expand a type, because we need to compute `canIncreaseExpansionDepth`. + const links = context.maxExpansionDepth >= 0 ? undefined : context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration); const key = `${getTypeId(type)}|${context.flags}|${context.internalFlags}`; if (links) { links.serializedTypes ||= new Map(); @@ -6980,7 +7170,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (isGenericMappedType(type) || (type as MappedType).containsError) { return createMappedTypeNodeFromType(type as MappedType); } - const resolved = resolveStructuredTypeMembers(type); if (!resolved.properties.length && !resolved.indexInfos.length) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { @@ -7262,11 +7451,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function createTypeNodesFromResolvedType(resolvedType: ResolvedType): TypeElement[] | undefined { if (checkTruncationLength(context)) { + context.out.truncated = true; if (context.flags & NodeBuilderFlags.NoTruncation) { return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), SyntaxKind.MultiLineCommentTrivia, "elided")]; } return [factory.createPropertySignature(/*modifiers*/ undefined, "...", /*questionToken*/ undefined, /*type*/ undefined)]; } + context.typeStack.push(-1); const typeElements: TypeElement[] = []; for (const signature of resolvedType.callSignatures) { typeElements.push(signatureToSignatureDeclarationHelper(signature, SyntaxKind.CallSignature, context) as CallSignatureDeclaration); @@ -7281,11 +7472,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const properties = resolvedType.properties; if (!properties) { + context.typeStack.pop(); return typeElements; } let i = 0; for (const propertySymbol of properties) { + if (isExpanding(context) && propertySymbol.flags & SymbolFlags.Prototype) { + continue; + } i++; if (context.flags & NodeBuilderFlags.WriteClassExpressionAsTypeLiteral) { if (propertySymbol.flags & SymbolFlags.Prototype) { @@ -7296,6 +7491,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } if (checkTruncationLength(context) && (i + 2 < properties.length - 1)) { + context.out.truncated = true; if (context.flags & NodeBuilderFlags.NoTruncation) { const typeElement = typeElements.pop()!; typeElements.push(addSyntheticTrailingComment(typeElement, SyntaxKind.MultiLineCommentTrivia, `... ${properties.length - i} more elided ...`)); @@ -7308,6 +7504,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } addPropertyToElementList(propertySymbol, context, typeElements); } + context.typeStack.pop(); return typeElements.length ? typeElements : undefined; } } @@ -7477,6 +7674,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function mapToTypeNodes(types: readonly Type[] | undefined, context: NodeBuilderContext, isBareList?: boolean): TypeNode[] | undefined { if (some(types)) { if (checkTruncationLength(context)) { + context.out.truncated = true; if (!isBareList) { return [ context.flags & NodeBuilderFlags.NoTruncation @@ -7502,6 +7700,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { for (const type of types) { i++; if (checkTruncationLength(context) && (i + 2 < types.length - 1)) { + context.out.truncated = true; result.push( context.flags & NodeBuilderFlags.NoTruncation ? addSyntheticLeadingComment(factory.createKeywordTypeNode(SyntaxKind.AnyKeyword), SyntaxKind.MultiLineCommentTrivia, `... ${types.length - i} more elided ...`) @@ -7928,7 +8127,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function typeToTypeNodeHelperWithPossibleReusableTypeNode(type: Type, typeNode: TypeNode | undefined, context: NodeBuilderContext) { - return typeNode && getTypeFromTypeNode(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) + return !canPossiblyExpandType(type, context) && typeNode && getTypeFromTypeNode(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context); } @@ -8501,13 +8700,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { let firstChar = symbolName.charCodeAt(0); if (isSingleOrDoubleQuote(firstChar) && some(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) { - return factory.createStringLiteral(getSpecifierForModuleSymbol(symbol, context)); + const specifier = getSpecifierForModuleSymbol(symbol, context); + context.approximateLength += 2 + specifier.length; // "specifier" + return factory.createStringLiteral(specifier); } if (index === 0 || canUsePropertyAccess(symbolName, languageVersion)) { const identifier = setEmitFlags(factory.createIdentifier(symbolName), EmitFlags.NoAsciiEscaping); if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); identifier.symbol = symbol; - + context.approximateLength += 1 + symbolName.length; // .symbolName return index > 0 ? factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain, index - 1), identifier) : identifier; } else { @@ -8517,17 +8718,22 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } let expression: Expression | undefined; if (isSingleOrDoubleQuote(firstChar) && !(symbol.flags & SymbolFlags.EnumMember)) { - expression = factory.createStringLiteral(stripQuotes(symbolName).replace(/\\./g, s => s.substring(1)), firstChar === CharacterCodes.singleQuote); + const literalText = stripQuotes(symbolName).replace(/\\./g, s => s.substring(1)); + context.approximateLength += literalText.length + 2; // "literalText" + expression = factory.createStringLiteral(literalText, firstChar === CharacterCodes.singleQuote); } else if (("" + +symbolName) === symbolName) { + context.approximateLength += symbolName.length; // +symbolName expression = factory.createNumericLiteral(+symbolName); } if (!expression) { const identifier = setEmitFlags(factory.createIdentifier(symbolName), EmitFlags.NoAsciiEscaping); if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); identifier.symbol = symbol; + context.approximateLength += symbolName.length; // symbolName expression = identifier; } + context.approximateLength += 2; // [] return factory.createElementAccessExpression(createExpressionFromSymbolChain(chain, index - 1), expression); } } @@ -8555,6 +8761,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function getPropertyNameNodeForSymbol(symbol: Symbol, context: NodeBuilderContext) { + const hashPrivateName = getClonedHashPrivateName(symbol); + if (hashPrivateName) { + return hashPrivateName; + } const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed); const singleQuote = !!length(symbol.declarations) && every(symbol.declarations, isSingleQuotedStringNamed); const isMethod = !!(symbol.flags & SymbolFlags.Method); @@ -8667,7 +8877,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { let result; const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration); const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? symbol.declarations?.[0]; - if (decl) { + if (!canPossiblyExpandType(type, context) && decl) { const restore = addSymbolTypeToContext(context, symbol, type); if (isAccessor(decl)) { result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context); @@ -8717,7 +8927,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const returnType = getReturnTypeOfSignature(signature); if (!(suppressAny && isTypeAny(returnType))) { - if (signature.declaration && !nodeIsSynthesized(signature.declaration)) { + if (signature.declaration && !nodeIsSynthesized(signature.declaration) && !canPossiblyExpandType(returnType, context)) { const declarationSymbol = getSymbolOfDeclaration(signature.declaration); const restore = addSymbolTypeToContext(context, declarationSymbol, returnType); returnTypeNode = syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, declarationSymbol, context); @@ -9146,9 +9356,18 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (!suppressNewPrivateContext) { deferredPrivatesStack.push(new Map()); } - symbolTable.forEach((symbol: Symbol) => { + let i = 0; + const symbols = Array.from(symbolTable.values()); + for (const symbol of symbols) { + i++; + if (checkTruncationLengthIfExpanding(context) && (i + 2 < symbolTable.size - 1)) { + context.out.truncated = true; + results.push(createTruncationStatement(`... (${symbolTable.size - i} more ...)`)); + serializeSymbol(symbols[symbols.length - 1], /*isPrivate*/ false, !!propertyAsAlias); + break; + } serializeSymbol(symbol, /*isPrivate*/ false, !!propertyAsAlias); - }); + } if (!suppressNewPrivateContext) { // deferredPrivates will be filled up by visiting the symbol table // And will continue to iterate as elements are added while visited `deferredPrivates` @@ -9274,6 +9493,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { && type.symbol?.valueDeclaration && isSourceFile(type.symbol.valueDeclaration) ) { const alias = localName === propertyAccessRequire.parent.right.escapedText ? undefined : propertyAccessRequire.parent.right; + context.approximateLength += 12 + ((alias?.escapedText as string | undefined)?.length ?? 0); // `export { alias };` addResult( factory.createExportDeclaration( /*modifiers*/ undefined, @@ -9295,6 +9515,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ), textRange, ); + context.approximateLength += 7 + name.length; // `var name: ;` addResult(statement, name !== localName ? modifierFlags & ~ModifierFlags.Export : modifierFlags); if (name !== localName && !isPrivate) { // We rename the variable declaration we generate for Property symbols since they may have a name which @@ -9318,6 +9539,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // export { g_1 as g }; // ``` // To create an export named `g` that does _not_ shadow the local `g` + context.approximateLength += 16 + name.length + localName.length; // `export { name as localName };` addResult( factory.createExportDeclaration( /*modifiers*/ undefined, @@ -9372,19 +9594,26 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { for (const node of symbol.declarations) { const resolvedModule = resolveExternalModuleName(node, (node as ExportDeclaration).moduleSpecifier!); if (!resolvedModule) continue; - addResult(factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ (node as ExportDeclaration).isTypeOnly, /*exportClause*/ undefined, factory.createStringLiteral(getSpecifierForModuleSymbol(resolvedModule, context))), ModifierFlags.None); + const isTypeOnly = (node as ExportDeclaration).isTypeOnly; + const specifier = getSpecifierForModuleSymbol(resolvedModule, context); + context.approximateLength += 17 + specifier.length; // `export * from "specifier";` + addResult(factory.createExportDeclaration(/*modifiers*/ undefined, isTypeOnly, /*exportClause*/ undefined, factory.createStringLiteral(specifier)), ModifierFlags.None); } } } if (needsPostExportDefault) { - addResult(factory.createExportAssignment(/*modifiers*/ undefined, /*isExportEquals*/ false, factory.createIdentifier(getInternalSymbolName(symbol, symbolName))), ModifierFlags.None); + const internalSymbolName = getInternalSymbolName(symbol, symbolName); + context.approximateLength += 16 + internalSymbolName.length; // `export default internalName;` + addResult(factory.createExportAssignment(/*modifiers*/ undefined, /*isExportEquals*/ false, factory.createIdentifier(internalSymbolName)), ModifierFlags.None); } else if (needsExportDeclaration) { + const internalSymbolName = getInternalSymbolName(symbol, symbolName); + context.approximateLength += 22 + symbolName.length + internalSymbolName.length; // `export { internalName as symbolName };` addResult( factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, - factory.createNamedExports([factory.createExportSpecifier(/*isTypeOnly*/ false, getInternalSymbolName(symbol, symbolName), symbolName)]), + factory.createNamedExports([factory.createExportSpecifier(/*isTypeOnly*/ false, internalSymbolName, symbolName)]), ), ModifierFlags.None, ); @@ -9415,6 +9644,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Prepends a `declare` and/or `export` modifier if the context requires it, and then adds `node` to `result` and returns `node` function addResult(node: Statement, additionalModifierFlags: ModifierFlags) { if (canHaveModifiers(node)) { + const oldModifierFlags = getEffectiveModifierFlags(node); let newModifierFlags: ModifierFlags = ModifierFlags.None; const enclosingDeclaration = context.enclosingDeclaration && (isJSDocTypeAlias(context.enclosingDeclaration) ? getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration); @@ -9438,8 +9668,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { newModifierFlags |= ModifierFlags.Default; } if (newModifierFlags) { - node = factory.replaceModifiers(node, newModifierFlags | getEffectiveModifierFlags(node)); + node = factory.replaceModifiers(node, newModifierFlags | oldModifierFlags); } + context.approximateLength += modifiersLength(newModifierFlags | oldModifierFlags); } results.push(node); } @@ -9458,9 +9689,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && syntacticNodeBuilder.tryReuseExistingTypeNode(context, jsdocAliasDecl.typeExpression.type) || typeToTypeNodeHelper(aliasType, context); + const internalSymbolName = getInternalSymbolName(symbol, symbolName); + context.approximateLength += 8 + (commentText?.length ?? 0) + internalSymbolName.length; // `/* comment */ type name = ...` addResult( setSyntheticLeadingComments( - factory.createTypeAliasDeclaration(/*modifiers*/ undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, typeNode), + factory.createTypeAliasDeclaration(/*modifiers*/ undefined, internalSymbolName, typeParamDecls, typeNode), !commentText ? [] : [{ kind: SyntaxKind.MultiLineCommentTrivia, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }], ), modifierFlags, @@ -9470,12 +9703,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function serializeInterface(symbol: Symbol, symbolName: string, modifierFlags: ModifierFlags) { + const internalSymbolName = getInternalSymbolName(symbol, symbolName); + context.approximateLength += 14 + internalSymbolName.length; // `interface name { }` const interfaceType = getDeclaredTypeOfClassOrInterface(symbol); const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); const typeParamDecls = map(localParams, p => typeParameterToDeclaration(p, context)); const baseTypes = getBaseTypes(interfaceType); const baseType = length(baseTypes) ? getIntersectionType(baseTypes) : undefined; - const members = flatMap(getPropertiesOfType(interfaceType), p => serializePropertySymbolForInterface(p, baseType)); + const members = serializePropertySymbolsForClassOrInterface(getPropertiesOfType(interfaceType), /*isClass*/ false, baseType); const callSignatures = serializeSignatures(SignatureKind.Call, interfaceType, baseType, SyntaxKind.CallSignature) as CallSignatureDeclaration[]; const constructSignatures = serializeSignatures(SignatureKind.Construct, interfaceType, baseType, SyntaxKind.ConstructSignature) as ConstructSignatureDeclaration[]; const indexSignatures = serializeIndexSignatures(interfaceType, baseType); @@ -9484,7 +9719,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { addResult( factory.createInterfaceDeclaration( /*modifiers*/ undefined, - getInternalSymbolName(symbol, symbolName), + internalSymbolName, typeParamDecls, heritageClauses, [...indexSignatures, ...constructSignatures, ...callSignatures, ...members], @@ -9493,6 +9728,63 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ); } + function serializePropertySymbolsForClassOrInterface(props: readonly Symbol[], isClass: false, baseType: Type | undefined): TypeElement[]; + function serializePropertySymbolsForClassOrInterface(props: readonly Symbol[], isClass: true, baseType: Type | undefined, isStatic: boolean): ClassElement[]; + function serializePropertySymbolsForClassOrInterface(props: readonly Symbol[], isClass: boolean, baseType: Type | undefined, isStatic?: boolean): (ClassElement | TypeElement)[] { + const elements: (ClassElement | TypeElement)[] = []; + let i = 0; + for (const prop of props) { + i++; + if (checkTruncationLengthIfExpanding(context) && (i + 2 < props.length - 1)) { + context.out.truncated = true; + const placeholder = createTruncationProperty(`... ${props.length - i} more ... `, isClass); + elements.push(placeholder); + const result = isClass ? + serializePropertySymbolForClass(props[props.length - 1], isStatic!, baseType) : + serializePropertySymbolForInterface(props[props.length - 1], baseType); + if (isArray(result)) { + elements.push(...result); + } + else { + elements.push(result); + } + break; + } + + context.approximateLength += 1; // separator + const result = isClass ? + serializePropertySymbolForClass(prop, isStatic!, baseType) : + serializePropertySymbolForInterface(prop, baseType); + if (isArray(result)) { + elements.push(...result); + } + else { + elements.push(result); + } + } + return elements; + } + + function createTruncationProperty(dotDotDotText: string, isClass: boolean): TypeElement | ClassElement { + if (context.flags & NodeBuilderFlags.NoTruncation) { + return addSyntheticLeadingComment(factory.createNotEmittedTypeElement(), SyntaxKind.MultiLineCommentTrivia, dotDotDotText); + } + return isClass ? + factory.createPropertyDeclaration( + /*modifiers*/ undefined, + dotDotDotText, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined, + ) : + factory.createPropertySignature( + /*modifiers*/ undefined, + dotDotDotText, + /*questionToken*/ undefined, + /*type*/ undefined, + ); + } + function getNamespaceMembersForSerialization(symbol: Symbol) { let exports = arrayFrom(getExportsOfSymbol(symbol).values()); const merged = getMergedSymbol(symbol); @@ -9514,15 +9806,28 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function serializeModule(symbol: Symbol, symbolName: string, modifierFlags: ModifierFlags) { const members = getNamespaceMembersForSerialization(symbol); + const expanding = isExpanding(context); // Split NS members up by declaration - members whose parent symbol is the ns symbol vs those whose is not (but were added in later via merging) - const locationMap = arrayToMultiMap(members, m => m.parent && m.parent === symbol ? "real" : "merged"); + const locationMap = arrayToMultiMap(members, m => m.parent && m.parent === symbol || expanding ? "real" : "merged"); const realMembers = locationMap.get("real") || emptyArray; const mergedMembers = locationMap.get("merged") || emptyArray; // TODO: `suppressNewPrivateContext` is questionable -we need to simply be emitting privates in whatever scope they were declared in, rather // than whatever scope we traverse to them in. That's a bit of a complex rewrite, since we're not _actually_ tracking privates at all in advance, // so we don't even have placeholders to fill in. - if (length(realMembers)) { - const localName = getInternalSymbolName(symbol, symbolName); + if (length(realMembers) || expanding) { + let localName: ModuleName; + if (expanding) { + // Use the same name as symbol display. + const oldFlags = context.flags; + context.flags |= NodeBuilderFlags.WriteTypeParametersInQualifiedName | SymbolFormatFlags.UseOnlyExternalAliasing; + localName = symbolToNode(symbol, context, /*meaning*/ SymbolFlags.All) as ModuleName; + context.flags = oldFlags; + } + else { + const localText = getInternalSymbolName(symbol, symbolName); + localName = factory.createIdentifier(localText); + context.approximateLength += localText.length; + } serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (SymbolFlags.Function | SymbolFlags.Assignment))); } if (length(mergedMembers)) { @@ -9558,23 +9863,62 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function serializeEnum(symbol: Symbol, symbolName: string, modifierFlags: ModifierFlags) { + const internalSymbolName = getInternalSymbolName(symbol, symbolName); + context.approximateLength += 9 + internalSymbolName.length; // `enum internalName { }` + const members: EnumMember[] = []; + const memberProps = filter(getPropertiesOfType(getTypeOfSymbol(symbol)), p => !!(p.flags & SymbolFlags.EnumMember)); + let i = 0; + for (const p of memberProps) { + i++; + if (checkTruncationLengthIfExpanding(context) && (i + 2 < memberProps.length - 1)) { + context.out.truncated = true; + members.push(factory.createEnumMember(` ... ${memberProps.length - i} more ... `)); + const last = memberProps[memberProps.length - 1]; + const initializedValue = last.declarations && last.declarations[0] && isEnumMember(last.declarations[0]) ? getConstantValue(last.declarations[0]) : undefined; + const initializer = initializedValue === undefined ? undefined : + typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : + factory.createNumericLiteral(initializedValue); + const memberName = unescapeLeadingUnderscores(last.escapedName); + const member = factory.createEnumMember( + memberName, + initializer, + ); + members.push(member); + break; + } + // TODO: Handle computed names + // I hate that to get the initialized value we need to walk back to the declarations here; but there's no + // other way to get the possible const value of an enum member that I'm aware of, as the value is cached + // _on the declaration_, not on the declaration's symbol... + const memberDecl = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? + p.declarations[0] : + undefined; + let initializer: Expression | undefined; + let initializerLength: number; + if (isExpanding(context) && memberDecl && memberDecl.initializer) { + initializer = getSynthesizedDeepClone(memberDecl.initializer); + initializerLength = memberDecl.initializer.end - memberDecl.initializer.pos; + } + else { + const initializedValue = memberDecl && getConstantValue(memberDecl); + initializer = initializedValue === undefined ? undefined : + typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : + factory.createNumericLiteral(initializedValue); + initializerLength = (initializer as StringLiteral | NumericLiteral | undefined)?.text.length ?? 0; + } + const memberName = unescapeLeadingUnderscores(p.escapedName); + context.approximateLength += 4 + memberName.length + initializerLength; // `member = initializer,` + const member = factory.createEnumMember( + memberName, + initializer, + ); + members.push(member); + } addResult( factory.createEnumDeclaration( factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? ModifierFlags.Const : 0), - getInternalSymbolName(symbol, symbolName), - map(filter(getPropertiesOfType(getTypeOfSymbol(symbol)), p => !!(p.flags & SymbolFlags.EnumMember)), p => { - // TODO: Handle computed names - // I hate that to get the initialized value we need to walk back to the declarations here; but there's no - // other way to get the possible const value of an enum member that I'm aware of, as the value is cached - // _on the declaration_, not on the declaration's symbol... - const initializedValue = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? getConstantValue(p.declarations[0]) : undefined; - return factory.createEnumMember( - unescapeLeadingUnderscores(p.escapedName), - initializedValue === undefined ? undefined : - typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : - factory.createNumericLiteral(initializedValue), - ); - }), + internalSymbolName, + members, ), modifierFlags, ); @@ -9583,6 +9927,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function serializeAsFunctionNamespaceMerge(type: Type, symbol: Symbol, localName: string, modifierFlags: ModifierFlags) { const signatures = getSignaturesOfType(type, SignatureKind.Call); for (const sig of signatures) { + context.approximateLength += 1; // ; // Each overload becomes a separate function declaration, in order const decl = signatureToSignatureDeclarationHelper(sig, SyntaxKind.FunctionDeclaration, context, { name: factory.createIdentifier(localName) }) as FunctionDeclaration; addResult(setTextRange(context, decl, getSignatureTextRangeLocation(sig)), modifierFlags); @@ -9590,8 +9935,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Module symbol emit will take care of module-y members, provided it has exports if (!(symbol.flags & (SymbolFlags.ValueModule | SymbolFlags.NamespaceModule) && !!symbol.exports && !!symbol.exports.size)) { const props = filter(getPropertiesOfType(type), isNamespaceMember); - serializeAsNamespaceDeclaration(props, localName, modifierFlags, /*suppressNewPrivateContext*/ true); + context.approximateLength += localName.length; + serializeAsNamespaceDeclaration(props, factory.createIdentifier(localName), modifierFlags, /*suppressNewPrivateContext*/ true); + } + } + + function createTruncationStatement(dotDotDotText: string): Statement { + if (context.flags & NodeBuilderFlags.NoTruncation) { + return addSyntheticLeadingComment(factory.createEmptyStatement(), SyntaxKind.MultiLineCommentTrivia, dotDotDotText); } + return factory.createExpressionStatement(factory.createIdentifier(dotDotDotText)); } function getSignatureTextRangeLocation(signature: Signature) { @@ -9607,9 +9960,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return signature.declaration; } - function serializeAsNamespaceDeclaration(props: readonly Symbol[], localName: string, modifierFlags: ModifierFlags, suppressNewPrivateContext: boolean) { + function serializeAsNamespaceDeclaration(props: readonly Symbol[], localName: ModuleName, modifierFlags: ModifierFlags, suppressNewPrivateContext: boolean) { + const nodeFlags = isIdentifier(localName) ? NodeFlags.Namespace : NodeFlags.None; + const expanding = isExpanding(context); if (length(props)) { - const localVsRemoteMap = arrayToMultiMap(props, p => !length(p.declarations) || some(p.declarations, d => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration!)) ? "local" : "remote"); + context.approximateLength += 14; // "namespace { }" + const localVsRemoteMap = arrayToMultiMap(props, p => !length(p.declarations) || some(p.declarations, d => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration!)) || expanding ? "local" : "remote"); const localProps = localVsRemoteMap.get("local") || emptyArray; // handle remote props first - we need to make an `import` declaration that points at the module containing each remote // prop in the outermost scope (TODO: a namespace within a namespace would need to be appropriately handled by this) @@ -9628,7 +9984,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Add a namespace // Create namespace as non-synthetic so it is usable as an enclosing declaration - let fakespace = parseNodeFactory.createModuleDeclaration(/*modifiers*/ undefined, factory.createIdentifier(localName), factory.createModuleBlock([]), NodeFlags.Namespace); + let fakespace = parseNodeFactory.createModuleDeclaration(/*modifiers*/ undefined, localName, factory.createModuleBlock([]), nodeFlags); setParent(fakespace, enclosingDeclaration as SourceFile | NamespaceDeclaration); fakespace.locals = createSymbolTable(props); fakespace.symbol = props[0].parent!; @@ -9662,6 +10018,18 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ); addResult(fakespace, modifierFlags); // namespaces can never be default exported } + else if (expanding) { + context.approximateLength += 14; // "namespace { }" + addResult( + factory.createModuleDeclaration( + /*modifiers*/ undefined, + localName, + factory.createModuleBlock([]), + nodeFlags, + ), + modifierFlags, + ); + } } function isNamespaceMember(p: Symbol) { @@ -9703,11 +10071,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function serializeAsClass(symbol: Symbol, localName: string, modifierFlags: ModifierFlags) { + context.approximateLength += 9 + localName.length; // `class localName { }` const originalDecl = symbol.declarations?.find(isClassLike); const oldEnclosing = context.enclosingDeclaration; context.enclosingDeclaration = originalDecl || oldEnclosing; const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); const typeParamDecls = map(localParams, p => typeParameterToDeclaration(p, context)); + forEach(localParams, p => context.approximateLength += symbolName(p.symbol).length); const classType = getTypeWithThisArgument(getDeclaredTypeOfClassOrInterface(symbol)) as InterfaceType; const baseTypes = getBaseTypes(classType); const originalImplements = originalDecl && getEffectiveImplementsTypeNodes(originalDecl); @@ -9718,40 +10088,36 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const staticBaseType = isClass ? getBaseConstructorTypeOfClass(staticType as InterfaceType) : anyType; + context.approximateLength += (length(baseTypes) ? 8 : 0) + (length(implementsExpressions) ? 11 : 0); // `extends ` and `implements ` const heritageClauses = [ ...!length(baseTypes) ? [] : [factory.createHeritageClause(SyntaxKind.ExtendsKeyword, map(baseTypes, b => serializeBaseType(b, staticBaseType, localName)))], ...!length(implementsExpressions) ? [] : [factory.createHeritageClause(SyntaxKind.ImplementsKeyword, implementsExpressions)], ]; const symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType)); - const publicSymbolProps = filter(symbolProps, s => { - // `valueDeclaration` could be undefined if inherited from - // a union/intersection base type, but inherited properties - // don't matter here. - const valueDecl = s.valueDeclaration; - return !!valueDecl && !(isNamedDeclaration(valueDecl) && isPrivateIdentifier(valueDecl.name)); - }); - const hasPrivateIdentifier = some(symbolProps, s => { - // `valueDeclaration` could be undefined if inherited from - // a union/intersection base type, but inherited properties - // don't matter here. - const valueDecl = s.valueDeclaration; - return !!valueDecl && isNamedDeclaration(valueDecl) && isPrivateIdentifier(valueDecl.name); - }); + const publicSymbolProps = filter(symbolProps, s => !isHashPrivate(s)); + const hasPrivateIdentifier = some(symbolProps, isHashPrivate); // Boil down all private properties into a single one. const privateProperties = hasPrivateIdentifier ? - [factory.createPropertyDeclaration( - /*modifiers*/ undefined, - factory.createPrivateIdentifier("#private"), - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined, - )] : + isExpanding(context) ? + serializePropertySymbolsForClassOrInterface(filter(symbolProps, isHashPrivate), /*isClass*/ true, baseTypes[0], /*isStatic*/ false) : + [factory.createPropertyDeclaration( + /*modifiers*/ undefined, + factory.createPrivateIdentifier("#private"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined, + )] : emptyArray; - const publicProperties = flatMap(publicSymbolProps, p => serializePropertySymbolForClass(p, /*isStatic*/ false, baseTypes[0])); + if (hasPrivateIdentifier && !isExpanding(context)) { + context.approximateLength += 9; // `#private;` + } + const publicProperties = serializePropertySymbolsForClassOrInterface(publicSymbolProps, /*isClass*/ true, baseTypes[0], /*isStatic*/ false); // Consider static members empty if symbol also has function or module meaning - function namespacey emit will handle statics - const staticMembers = flatMap( + const staticMembers = serializePropertySymbolsForClassOrInterface( filter(getPropertiesOfType(staticType), p => !(p.flags & SymbolFlags.Prototype) && p.escapedName !== "prototype" && !isNamespaceMember(p)), - p => serializePropertySymbolForClass(p, /*isStatic*/ true, staticBaseType), + /*isClass*/ true, + staticBaseType, + /*isStatic*/ true, ); // When we encounter an `X.prototype.y` assignment in a JS file, we bind `X` as a class regardless as to whether // the value is ever initialized with a class or function-like value. For cases where `X` could never be @@ -9760,6 +10126,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { !!symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && !some(getSignaturesOfType(staticType, SignatureKind.Construct)); + if (isNonConstructableClassLikeInJsFile) context.approximateLength += 21; // `private constructor()` const constructors = isNonConstructableClassLikeInJsFile ? [factory.createConstructorDeclaration(factory.createModifiersFromModifierFlags(ModifierFlags.Private), [], /*body*/ undefined)] : serializeSignatures(SignatureKind.Construct, staticType, staticBaseType, SyntaxKind.Constructor) as ConstructorDeclaration[]; @@ -9828,6 +10195,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // const { SomeClass } = require('./lib'); const specifier = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' const { propertyName } = node as BindingElement; + const propertyNameText = propertyName && isIdentifier(propertyName) ? idText(propertyName) : undefined; + context.approximateLength += 24 + localName.length + specifier.length + (propertyNameText?.length ?? 0); // `import { propertyName as name } from "specifier";` addResult( factory.createImportDeclaration( /*modifiers*/ undefined, @@ -9836,7 +10205,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { /*name*/ undefined, factory.createNamedImports([factory.createImportSpecifier( /*isTypeOnly*/ false, - propertyName && isIdentifier(propertyName) ? factory.createIdentifier(idText(propertyName)) : undefined, + propertyNameText ? factory.createIdentifier(propertyNameText) : undefined, factory.createIdentifier(localName), )]), ), @@ -9867,6 +10236,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const uniqueName = factory.createUniqueName(localName); // _x const specifier = getSpecifierForModuleSymbol(target.parent || target, context); // 'y' // import _x = require('y'); + context.approximateLength += 22 + specifier.length + idText(uniqueName).length; // `import uniqueName = require("specifier");` addResult( factory.createImportEqualsDeclaration( /*modifiers*/ undefined, @@ -9877,6 +10247,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ModifierFlags.None, ); // import x = _x.z + context.approximateLength += 12 + localName.length + idText(uniqueName).length + idText(initializer.name).length; // `import localName = uniqueName.initializerName;` addResult( factory.createImportEqualsDeclaration( /*modifiers*/ undefined, @@ -9899,6 +10270,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Could be a local `import localName = ns.member` or // an external `import localName = require("whatever")` const isLocalImport = !(target.flags & SymbolFlags.ValueModule) && !isVariableDeclaration(node); + context.approximateLength += 11 + localName.length + unescapeLeadingUnderscores(target.escapedName).length; // `import localName = target;` addResult( factory.createImportEqualsDeclaration( /*modifiers*/ undefined, @@ -9922,6 +10294,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const specifier = context.bundled ? factory.createStringLiteral(generatedSpecifier) : (node as ImportClause).parent.moduleSpecifier; const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : undefined; const isTypeOnly = isJSDocImportTag((node as ImportClause).parent); + context.approximateLength += 14 + localName.length + 3 + (isTypeOnly ? 4 : 0); // `import localName from specifier;`, approximate specifier addResult( factory.createImportDeclaration( /*modifiers*/ undefined, @@ -9937,6 +10310,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); // generate specifier (even though we're reusing and existing one) for ambient module reference include side effects const specifier = context.bundled ? factory.createStringLiteral(generatedSpecifier) : (node as NamespaceImport).parent.parent.moduleSpecifier; const isTypeOnly = isJSDocImportTag((node as NamespaceImport).parent.parent); + context.approximateLength += 19 + localName.length + 3 + (isTypeOnly ? 4 : 0); // `import * as localName from specifier;`, approximate specifier addResult( factory.createImportDeclaration( /*modifiers*/ undefined, @@ -9949,6 +10323,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { break; } case SyntaxKind.NamespaceExport: + context.approximateLength += 19 + localName.length + 3; // `export * as localName from specifier;`, approximate specifier addResult( factory.createExportDeclaration( /*modifiers*/ undefined, @@ -9963,6 +10338,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); // generate specifier (even though we're reusing and existing one) for ambient module reference include side effects const specifier = context.bundled ? factory.createStringLiteral(generatedSpecifier) : (node as ImportSpecifier).parent.parent.parent.moduleSpecifier; const isTypeOnly = isJSDocImportTag((node as ImportSpecifier).parent.parent.parent); + context.approximateLength += 19 + localName.length + 3 + (isTypeOnly ? 4 : 0); // `import { localName } from specifier;`, approximate specifier addResult( factory.createImportDeclaration( /*modifiers*/ undefined, @@ -10024,6 +10400,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function serializeExportSpecifier(localName: string, targetName: string, specifier?: Expression) { + context.approximateLength += 16 + localName.length + (localName !== targetName ? targetName.length : 0); // `export { targetName as localName };` addResult( factory.createExportDeclaration( /*modifiers*/ undefined, @@ -10072,6 +10449,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const prevDisableTrackSymbol = context.tracker.disableTrackSymbol; context.tracker.disableTrackSymbol = true; if (isExportAssignmentCompatibleSymbolName) { + context.approximateLength += 10; // `export = ;` results.push(factory.createExportAssignment( /*modifiers*/ undefined, isExportEquals, @@ -10089,6 +10467,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { else { // serialize as `import _Ref = t.arg.et; export { _Ref as name }` const varName = getUnusedName(name, symbol); + context.approximateLength += varName.length + 10; // `import name = ;` addResult( factory.createImportEqualsDeclaration( /*modifiers*/ undefined, @@ -10116,6 +10495,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } else { const flags = context.enclosingDeclaration?.kind === SyntaxKind.ModuleDeclaration && (!(symbol.flags & SymbolFlags.Accessor) || symbol.flags & SymbolFlags.SetAccessor) ? NodeFlags.Let : NodeFlags.Const; + context.approximateLength += varName.length + 5; // `var name: ;` const statement = factory.createVariableStatement( /*modifiers*/ undefined, factory.createVariableDeclarationList([ @@ -10132,6 +10512,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ); } if (isExportAssignmentCompatibleSymbolName) { + context.approximateLength += varName.length + 10; // `export = name;` results.push(factory.createExportAssignment( /*modifiers*/ undefined, isExportEquals, @@ -10208,7 +10589,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ): (p: Symbol, isStatic: boolean, baseType: Type | undefined) => T | AccessorDeclaration | (T | AccessorDeclaration)[] { return function serializePropertySymbol(p: Symbol, isStatic: boolean, baseType: Type | undefined): T | AccessorDeclaration | (T | AccessorDeclaration)[] { const modifierFlags = getDeclarationModifierFlagsFromSymbol(p); - const isPrivate = !!(modifierFlags & ModifierFlags.Private); + const omitType = !!(modifierFlags & ModifierFlags.Private) && !isExpanding(context); if (isStatic && (p.flags & (SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias))) { // Only value-only-meaning symbols can be correctly encoded as class statics, type/namespace/alias meaning symbols // need to be merged namespace members @@ -10246,6 +10627,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { Debug.assert(!!setter); const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : undefined; const setterDeclaration = p.declarations?.find(isSetAccessor); + context.approximateLength += modifiersLength(flag) + 7 + (paramSymbol ? symbolName(paramSymbol).length : 5) + (omitType ? 0 : 2); // `modifiers set name(param);`, approximate name result.push(setTextRange( context, factory.createSetAccessorDeclaration( @@ -10256,7 +10638,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { /*dotDotDotToken*/ undefined, paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value", /*questionToken*/ undefined, - isPrivate ? undefined : serializeTypeForDeclaration(context, setterDeclaration, getWriteTypeOfSymbol(p), p), + omitType ? undefined : serializeTypeForDeclaration(context, setterDeclaration, getWriteTypeOfSymbol(p), p), )], /*body*/ undefined, ), @@ -10264,15 +10646,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { )); } if (p.flags & SymbolFlags.GetAccessor) { - const isPrivate = modifierFlags & ModifierFlags.Private; const getterDeclaration = p.declarations?.find(isGetAccessor); + context.approximateLength += modifiersLength(flag) + 8 + (omitType ? 0 : 2); // `modifiers get name(): ;`, approximate name result.push(setTextRange( context, factory.createGetAccessorDeclaration( factory.createModifiersFromModifierFlags(flag), name, [], - isPrivate ? undefined : serializeTypeForDeclaration(context, getterDeclaration, getTypeOfSymbol(p), p), + omitType ? undefined : serializeTypeForDeclaration(context, getterDeclaration, getTypeOfSymbol(p), p), /*body*/ undefined, ), getterDeclaration ?? firstPropertyLikeDecl, @@ -10283,13 +10665,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (SymbolFlags.Property | SymbolFlags.Variable | SymbolFlags.Accessor)) { + const modifierFlags = (isReadonlySymbol(p) ? ModifierFlags.Readonly : 0) | flag; + context.approximateLength += 2 + (omitType ? 0 : 2) + modifiersLength(modifierFlags); // `modifiers name: ;`, approximate name return setTextRange( context, createProperty( - factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? ModifierFlags.Readonly : 0) | flag), + factory.createModifiersFromModifierFlags(modifierFlags), name, p.flags & SymbolFlags.Optional ? factory.createToken(SyntaxKind.QuestionToken) : undefined, - isPrivate ? undefined : serializeTypeForDeclaration(context, p.declarations?.find(isSetAccessorDeclaration), getWriteTypeOfSymbol(p), p), + omitType ? undefined : serializeTypeForDeclaration(context, p.declarations?.find(isSetAccessorDeclaration), getWriteTypeOfSymbol(p), p), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined, @@ -10300,11 +10684,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (p.flags & (SymbolFlags.Method | SymbolFlags.Function)) { const type = getTypeOfSymbol(p); const signatures = getSignaturesOfType(type, SignatureKind.Call); - if (flag & ModifierFlags.Private) { + if (omitType) { + const modifierFlags = (isReadonlySymbol(p) ? ModifierFlags.Readonly : 0) | flag; + context.approximateLength += 1 + modifiersLength(modifierFlags); // `modifiers name;`, approximate name return setTextRange( context, createProperty( - factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? ModifierFlags.Readonly : 0) | flag), + factory.createModifiersFromModifierFlags(modifierFlags), name, p.flags & SymbolFlags.Optional ? factory.createToken(SyntaxKind.QuestionToken) : undefined, /*type*/ undefined, @@ -10316,6 +10702,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const results = []; for (const sig of signatures) { + context.approximateLength += 1; // ; // Each overload becomes a separate method declaration, in order const decl = signatureToSignatureDeclarationHelper( sig, @@ -10337,6 +10724,27 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { }; } + function modifiersLength(flags: ModifierFlags): number { + let result = 0; + // Include the trailing space after the modifier keyword. + if (flags & ModifierFlags.Export) result += 7; + if (flags & ModifierFlags.Ambient) result += 8; + if (flags & ModifierFlags.Default) result += 8; + if (flags & ModifierFlags.Const) result += 6; + if (flags & ModifierFlags.Public) result += 7; + if (flags & ModifierFlags.Private) result += 8; + if (flags & ModifierFlags.Protected) result += 10; + if (flags & ModifierFlags.Abstract) result += 9; + if (flags & ModifierFlags.Static) result += 7; + if (flags & ModifierFlags.Override) result += 9; + if (flags & ModifierFlags.Readonly) result += 9; + if (flags & ModifierFlags.Accessor) result += 9; + if (flags & ModifierFlags.Async) result += 6; + if (flags & ModifierFlags.In) result += 3; + if (flags & ModifierFlags.Out) result += 4; + return result; + } + function serializePropertySymbolForInterface(p: Symbol, baseType: Type | undefined) { return serializePropertySymbolForInterfaceWorker(p, /*isStatic*/ false, baseType); } @@ -10387,6 +10795,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const results = []; for (const sig of signatures) { + context.approximateLength += 1; // ; // Each overload becomes a separate constructor declaration, in order const decl = signatureToSignatureDeclarationHelper(sig, outputKind, context); results.push(setTextRange(context, decl, sig.declaration)); @@ -10506,6 +10915,31 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return localName; } } + + function isExpanding(context: NodeBuilderContext) { + return context.maxExpansionDepth !== -1; + } + + function isHashPrivate(s: Symbol): boolean { + // `valueDeclaration` could be undefined if inherited from + // a union/intersection base type, but inherited properties + // don't matter here. + return !!s.valueDeclaration && isNamedDeclaration(s.valueDeclaration) && isPrivateIdentifier(s.valueDeclaration.name); + } + + function getClonedHashPrivateName(s: Symbol): PrivateIdentifier | undefined { + if (s.valueDeclaration && isNamedDeclaration(s.valueDeclaration) && isPrivateIdentifier(s.valueDeclaration.name)) { + return factory.cloneNode(s.valueDeclaration.name); + } + return undefined; + } + } + + /** Returns true if a type is declared in a lib file. */ + // Don't expand types like `Array` or `Promise`, instead treating them as opaque. + function isLibType(type: Type): boolean { + const symbol = (getObjectFlags(type) & ObjectFlags.Reference) !== 0 ? (type as TypeReference).target.symbol : type.symbol; + return isTupleType(type) || !!(symbol?.declarations?.some(decl => host.isSourceFileDefaultLibrary(getSourceFileOfNode(decl)))); } function typePredicateToString(typePredicate: TypePredicate, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, writer?: EmitTextWriter): string { @@ -10521,14 +10955,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } - function formatUnionTypes(types: readonly Type[]): Type[] { + function formatUnionTypes(types: readonly Type[], expandingEnum: boolean): Type[] { const result: Type[] = []; let flags = 0 as TypeFlags; for (let i = 0; i < types.length; i++) { const t = types[i]; flags |= t.flags; if (!(t.flags & TypeFlags.Nullable)) { - if (t.flags & (TypeFlags.BooleanLiteral | TypeFlags.EnumLike)) { + if (t.flags & (TypeFlags.BooleanLiteral) || !expandingEnum && (t.flags | TypeFlags.EnumLike)) { const baseType = t.flags & TypeFlags.BooleanLiteral ? booleanType : getBaseTypeOfEnumLikeType(t as LiteralType); if (baseType.flags & TypeFlags.Union) { const count = (baseType as UnionType).types.length; @@ -50577,6 +51011,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } }, + symbolToDeclarations: (symbol, meaning, flags, verbosityLevel, out) => { + return nodeBuilder.symbolToDeclarations(symbol, meaning, flags, verbosityLevel, out); + }, }; function isImportRequiredByAugmentation(node: ImportDeclaration) { @@ -52911,6 +53348,8 @@ interface NodeBuilderContext extends SyntacticTypeNodeBuilderContext { flags: NodeBuilderFlags; internalFlags: InternalNodeBuilderFlags; tracker: SymbolTrackerImpl; + /* Maximum depth we're allowed to expand names. */ + readonly maxExpansionDepth: number; // State encounteredError: boolean; @@ -52934,7 +53373,13 @@ interface NodeBuilderContext extends SyntacticTypeNodeBuilderContext { reverseMappedStack: ReverseMappedSymbol[] | undefined; bundled: boolean; mapper: TypeMapper | undefined; + /* How many levels of nested names we have expanded so far. */ + depth: number; suppressReportInferenceFallback: boolean; + typeStack: number[]; + + // Output + out: WriterContextOut; } class SymbolTrackerImpl implements SymbolTracker { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 01a96579861f4..1fd93c74ed455 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1168,6 +1168,7 @@ export const notImplementedResolver: EmitResolver = { isImportRequiredByAugmentation: notImplemented, isDefinitelyReferenceToGlobalSymbolObject: notImplemented, createLateBoundIndexSignatures: notImplemented, + symbolToDeclarations: notImplemented, }; const enum PipelinePhase { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 342c0f2af7146..71f82a6e13d28 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5046,6 +5046,15 @@ export interface TypeCheckerHost extends ModuleSpecifierResolutionHost, SourceFi typesPackageExists(packageName: string): boolean; packageBundlesTypes(packageName: string): boolean; + + isSourceFileDefaultLibrary(file: SourceFile): boolean; +} + +/** @internal */ +export interface WriterContextOut { + /** Whether increasing the expansion depth will cause us to expand more types. */ + canIncreaseExpansionDepth: boolean; + truncated: boolean; } export interface TypeChecker { @@ -5134,6 +5143,7 @@ export interface TypeChecker { symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): ParameterDeclaration | undefined; /** Note that the resulting nodes cannot be checked. */ typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined): TypeParameterDeclaration | undefined; + /** @internal */ typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker, verbosityLevel?: number, out?: WriterContextOut): TypeParameterDeclaration | undefined; // eslint-disable-line @typescript-eslint/unified-signatures getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol | undefined; @@ -5165,8 +5175,8 @@ export interface TypeChecker { symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): string; typePredicateToString(predicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; - /** @internal */ writeSignature(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind, writer?: EmitTextWriter): string; - /** @internal */ writeType(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter): string; + /** @internal */ writeSignature(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind, writer?: EmitTextWriter, verbosityLevel?: number, out?: WriterContextOut): string; + /** @internal */ writeType(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter, verbosityLevel?: number, out?: WriterContextOut): string; /** @internal */ writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags, writer?: EmitTextWriter): string; /** @internal */ writeTypePredicate(predicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter): string; @@ -5435,6 +5445,7 @@ export interface TypeChecker { /** @internal */ fillMissingTypeArguments(typeArguments: readonly Type[], typeParameters: readonly TypeParameter[] | undefined, minTypeArgumentCount: number, isJavaScriptImplicitAny: boolean): Type[]; getTypeArgumentsForResolvedSignature(signature: Signature): readonly Type[] | undefined; + /** @internal */ isLibType(type: Type): boolean; } /** @internal */ @@ -5881,6 +5892,7 @@ export interface EmitResolver { isImportRequiredByAugmentation(decl: ImportDeclaration): boolean; isDefinitelyReferenceToGlobalSymbolObject(node: Node): boolean; createLateBoundIndexSignatures(cls: ClassLikeDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, internalFlags: InternalNodeBuilderFlags, tracker: SymbolTracker): (IndexSignatureDeclaration | PropertyDeclaration)[] | undefined; + symbolToDeclarations(symbol: Symbol, meaning: SymbolFlags, flags: NodeBuilderFlags, verbosityLevel?: number, out?: WriterContextOut): Declaration[]; } // dprint-ignore diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5755369134d8a..bf28d3e8982d5 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2,6 +2,7 @@ import { __String, AccessExpression, AccessorDeclaration, + addEmitFlags, addRange, affectsDeclarationPathOptionDeclarations, affectsEmitOptionDeclarations, @@ -511,6 +512,8 @@ import { ScriptTarget, semanticDiagnosticsOptionDeclarations, SetAccessorDeclaration, + setOriginalNode, + setTextRange, ShorthandPropertyAssignment, shouldAllowImportingTsExtension, Signature, @@ -592,6 +595,7 @@ import { VariableDeclarationList, VariableLikeDeclaration, VariableStatement, + visitEachChild, WhileStatement, WithStatement, WrappedExpression, @@ -12208,3 +12212,121 @@ export function getOptionsSyntaxByValue(optionsObject: ObjectLiteralExpression | export function forEachOptionsSyntaxByName(optionsObject: ObjectLiteralExpression | undefined, name: string, callback: (prop: PropertyAssignment) => T | undefined): T | undefined { return forEachPropertyAssignment(optionsObject, name, callback); } + +/** + * Creates a deep, memberwise clone of a node with no source map location. + * + * WARNING: This is an expensive operation and is only intended to be used in refactorings + * and code fixes (because those are triggered by explicit user actions). + * + * @internal + */ +// Moved here to compiler utilities for usage in node builder for quickinfo. +export function getSynthesizedDeepClone(node: T, includeTrivia = true): T { + const clone = node && getSynthesizedDeepCloneWorker(node); + if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone); + return setParentRecursive(clone, /*incremental*/ false); +} + +/** @internal */ +export function getSynthesizedDeepCloneWithReplacements( + node: T, + includeTrivia: boolean, + replaceNode: (node: Node) => Node | undefined, +): T { + let clone = replaceNode(node); + if (clone) { + setOriginalNode(clone, node); + } + else { + clone = getSynthesizedDeepCloneWorker(node as NonNullable, replaceNode); + } + + if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone); + return clone as T; +} + +function getSynthesizedDeepCloneWorker(node: T, replaceNode?: (node: Node) => Node | undefined): T { + const nodeClone: (n: T) => T = replaceNode + ? n => getSynthesizedDeepCloneWithReplacements(n, /*includeTrivia*/ true, replaceNode) + : getSynthesizedDeepClone; + const nodesClone: (ns: NodeArray | undefined) => NodeArray | undefined = replaceNode + ? ns => ns && getSynthesizedDeepClonesWithReplacements(ns, /*includeTrivia*/ true, replaceNode) + : ns => ns && getSynthesizedDeepClones(ns); + const visited = visitEachChild(node, nodeClone, /*context*/ undefined, nodesClone, nodeClone); + + if (visited === node) { + // This only happens for leaf nodes - internal nodes always see their children change. + const clone = isStringLiteral(node) ? setOriginalNode(factory.createStringLiteralFromNode(node), node) as Node as T : + isNumericLiteral(node) ? setOriginalNode(factory.createNumericLiteral(node.text, node.numericLiteralFlags), node) as Node as T : + factory.cloneNode(node); + return setTextRange(clone, node); + } + + // PERF: As an optimization, rather than calling factory.cloneNode, we'll update + // the new node created by visitEachChild with the extra changes factory.cloneNode + // would have made. + (visited as Mutable).parent = undefined!; + return visited; +} + +/** @internal */ +export function getSynthesizedDeepClones(nodes: NodeArray, includeTrivia?: boolean): NodeArray; +/** @internal */ +export function getSynthesizedDeepClones(nodes: NodeArray | undefined, includeTrivia?: boolean): NodeArray | undefined; +/** @internal */ +export function getSynthesizedDeepClones(nodes: NodeArray | undefined, includeTrivia = true): NodeArray | undefined { + if (nodes) { + const cloned = factory.createNodeArray(nodes.map(n => getSynthesizedDeepClone(n, includeTrivia)), nodes.hasTrailingComma); + setTextRange(cloned, nodes); + return cloned; + } + return nodes; +} + +/** @internal */ +export function getSynthesizedDeepClonesWithReplacements( + nodes: NodeArray, + includeTrivia: boolean, + replaceNode: (node: Node) => Node | undefined, +): NodeArray { + return factory.createNodeArray(nodes.map(n => getSynthesizedDeepCloneWithReplacements(n, includeTrivia, replaceNode)), nodes.hasTrailingComma); +} + +/** + * Sets EmitFlags to suppress leading and trailing trivia on the node. + * + * @internal + */ +export function suppressLeadingAndTrailingTrivia(node: Node): void { + suppressLeadingTrivia(node); + suppressTrailingTrivia(node); +} + +/** + * Sets EmitFlags to suppress leading trivia on the node. + * + * @internal + */ +export function suppressLeadingTrivia(node: Node): void { + addEmitFlagsRecursively(node, EmitFlags.NoLeadingComments, getFirstChild); +} + +/** + * Sets EmitFlags to suppress trailing trivia on the node. + * + * @internal @knipignore + */ +export function suppressTrailingTrivia(node: Node): void { + addEmitFlagsRecursively(node, EmitFlags.NoTrailingComments, getLastChild); +} + +function addEmitFlagsRecursively(node: Node, flag: EmitFlags, getChild: (n: Node) => Node | undefined) { + addEmitFlags(node, flag); + const child = getChild(node); + if (child) addEmitFlagsRecursively(child, flag, getChild); +} + +function getFirstChild(node: Node): Node | undefined { + return forEachChild(node, child => child); +} diff --git a/src/harness/client.ts b/src/harness/client.ts index ec659d738c02a..c735ffa7f3e34 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -254,8 +254,8 @@ export class SessionClient implements LanguageService { return { line, character: offset }; } - getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { - const args = this.createFileLocationRequestArgs(fileName, position); + getQuickInfoAtPosition(fileName: string, position: number, verbosityLevel?: number | undefined): QuickInfo { + const args = { ...this.createFileLocationRequestArgs(fileName, position), verbosityLevel }; const request = this.processRequest(protocol.CommandTypes.Quickinfo, args); const response = this.processResponse(request); @@ -268,6 +268,7 @@ export class SessionClient implements LanguageService { displayParts: [{ kind: "text", text: body.displayString }], documentation: typeof body.documentation === "string" ? [{ kind: "text", text: body.documentation }] : body.documentation, tags: this.decodeLinkDisplayParts(body.tags), + canIncreaseVerbosityLevel: body.canIncreaseVerbosityLevel, }; } diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index e1a410dfb5d3b..81ffed9cd698f 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -86,6 +86,10 @@ export interface TextSpan { end: number; } +export interface VerbosityLevels { + [markerName: string]: number | number[] | undefined; +} + // Name of testcase metadata including ts.CompilerOptions properties that will be used by globalOptions // To add additional option, add property into the testOptMetadataNames, refer the property in either globalMetadataNames or fileMetadataNames // Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data @@ -2451,19 +2455,28 @@ export class TestState { return result; } - public baselineQuickInfo(): void { - const result = ts.arrayFrom(this.testData.markerPositions.entries(), ([name, marker]) => ({ - marker: { ...marker, name }, - item: this.languageService.getQuickInfoAtPosition(marker.fileName, marker.position), - })); + public baselineQuickInfo(verbosityLevels?: VerbosityLevels): void { + const result = ts.arrayFrom(this.testData.markerPositions.entries(), ([name, marker]) => { + const verbosityLevel = toArray(verbosityLevels?.[name]); + const items = verbosityLevel.map(verbosityLevel => { + const item: ts.QuickInfo & { verbosityLevel?: number; } | undefined = this.languageService.getQuickInfoAtPosition(marker.fileName, marker.position, verbosityLevel); + if (item) item.verbosityLevel = verbosityLevel; + return { + marker: { ...marker, name }, + item, + }; + }); + return items; + }).flat(); const annotations = this.annotateContentWithTooltips( result, "quickinfo", item => item.textSpan, - ({ displayParts, documentation, tags }) => [ + ({ displayParts, documentation, tags, verbosityLevel }) => [ ...(displayParts ? displayParts.map(p => p.text).join("").split("\n") : []), ...(documentation?.length ? documentation.map(p => p.text).join("").split("\n") : []), ...(tags?.length ? tags.map(p => `@${p.name} ${p.text?.map(dp => dp.text).join("") ?? ""}`).join("\n").split("\n") : []), + ...(verbosityLevel !== undefined ? [`(verbosity level: ${verbosityLevel})`] : []), ], ); this.baseline("QuickInfo", annotations + "\n\n" + stringify(result)); diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index ec23609de6db0..bb10cbf744a99 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -449,8 +449,8 @@ export class Verify extends VerifyNegatable { this.state.baselineGetEmitOutput(); } - public baselineQuickInfo(): void { - this.state.baselineQuickInfo(); + public baselineQuickInfo(verbosityLevels?: FourSlash.VerbosityLevels): void { + this.state.baselineQuickInfo(verbosityLevels); } public baselineSignatureHelp(): void { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 5cce908761082..6031643109680 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -2005,6 +2005,14 @@ export interface QuickInfoRequest extends FileLocationRequest { arguments: FileLocationRequestArgs; } +export interface QuickInfoRequestArgs extends FileLocationRequestArgs { + /** + * This controls how many levels of definitions will be expanded in the quick info response. + * The default value is 0. + */ + verbosityLevel?: number; +} + /** * Body of QuickInfoResponse. */ @@ -2044,6 +2052,11 @@ export interface QuickInfoResponseBody { * JSDoc tags associated with symbol. */ tags: JSDocTagInfo[]; + + /** + * Whether the verbosity level can be increased for this quick info response. + */ + canIncreaseVerbosityLevel?: boolean; } /** diff --git a/src/server/session.ts b/src/server/session.ts index 006eb57d7af70..120f043e2e83c 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -2392,10 +2392,10 @@ export class Session implements EventSender { return languageService.isValidBraceCompletionAtPosition(file, position, args.openingBrace.charCodeAt(0)); } - private getQuickInfoWorker(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.QuickInfoResponseBody | QuickInfo | undefined { + private getQuickInfoWorker(args: protocol.QuickInfoRequestArgs, simplifiedResult: boolean): protocol.QuickInfoResponseBody | QuickInfo | undefined { const { file, project } = this.getFileAndProject(args); const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; - const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo)); + const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo), args.verbosityLevel); if (!quickInfo) { return undefined; } @@ -2411,6 +2411,7 @@ export class Session implements EventSender { displayString, documentation: useDisplayParts ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation), tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts), + canIncreaseVerbosityLevel: quickInfo.canIncreaseVerbosityLevel, }; } else { diff --git a/src/services/services.ts b/src/services/services.ts index 7236f146ff1c7..fb5e9a0857929 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2274,7 +2274,7 @@ export function createLanguageService( return Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name, source }, host, preferences); } - function getQuickInfoAtPosition(fileName: string, position: number): QuickInfo | undefined { + function getQuickInfoAtPosition(fileName: string, position: number, verbosityLevel?: number): QuickInfo | undefined { synchronizeHostData(); const sourceFile = getValidSourceFile(fileName); @@ -2293,13 +2293,26 @@ export function createLanguageService( kind: ScriptElementKind.unknown, kindModifiers: ScriptElementKindModifier.none, textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile), - displayParts: typeChecker.runWithCancellationToken(cancellationToken, typeChecker => typeToDisplayParts(typeChecker, type, getContainerNode(nodeForQuickInfo))), + displayParts: typeChecker.runWithCancellationToken(cancellationToken, typeChecker => typeToDisplayParts(typeChecker, type, getContainerNode(nodeForQuickInfo), /*flags*/ undefined, verbosityLevel)), documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : undefined, tags: type.symbol ? type.symbol.getJsDocTags(typeChecker) : undefined, }; } - const { symbolKind, displayParts, documentation, tags } = typeChecker.runWithCancellationToken(cancellationToken, typeChecker => SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, getContainerNode(nodeForQuickInfo), nodeForQuickInfo)); + const { symbolKind, displayParts, documentation, tags, canIncreaseVerbosityLevel } = typeChecker.runWithCancellationToken( + cancellationToken, + typeChecker => + SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind( + typeChecker, + symbol, + sourceFile, + getContainerNode(nodeForQuickInfo), + nodeForQuickInfo, + /*semanticMeaning*/ undefined, + /*alias*/ undefined, + verbosityLevel, + ), + ); return { kind: symbolKind, kindModifiers: SymbolDisplay.getSymbolModifiers(typeChecker, symbol), @@ -2307,6 +2320,7 @@ export function createLanguageService( displayParts, documentation, tags, + canIncreaseVerbosityLevel, }; } diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index 0c6a6a8b07fee..1673f52738970 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -107,6 +107,7 @@ import { TypeParameter, typeToDisplayParts, VariableDeclaration, + WriterContextOut, } from "./_namespaces/ts.js"; const symbolDisplayNodeBuilderFlags = NodeBuilderFlags.OmitParameterModifiers | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope; @@ -253,9 +254,20 @@ export interface SymbolDisplayPartsDocumentationAndSymbolKind { documentation: SymbolDisplayPart[]; symbolKind: ScriptElementKind; tags: JSDocTagInfo[] | undefined; + canIncreaseVerbosityLevel?: boolean; } -function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: TypeChecker, symbol: Symbol, sourceFile: SourceFile, enclosingDeclaration: Node | undefined, location: Node, type: Type | undefined, semanticMeaning: SemanticMeaning, alias?: Symbol): SymbolDisplayPartsDocumentationAndSymbolKind { +function getSymbolDisplayPartsDocumentationAndSymbolKindWorker( + typeChecker: TypeChecker, + symbol: Symbol, + sourceFile: SourceFile, + enclosingDeclaration: Node | undefined, + location: Node, + type: Type | undefined, + semanticMeaning: SemanticMeaning, + alias?: Symbol, + verbosityLevel?: number, +): SymbolDisplayPartsDocumentationAndSymbolKind { const displayParts: SymbolDisplayPart[] = []; let documentation: SymbolDisplayPart[] = []; let tags: JSDocTagInfo[] = []; @@ -266,6 +278,8 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: Type let documentationFromAlias: SymbolDisplayPart[] | undefined; let tagsFromAlias: JSDocTagInfo[] | undefined; let hasMultipleSignatures = false; + const typeWriterOut: WriterContextOut = { canIncreaseExpansionDepth: false, truncated: false }; + let symbolWasExpanded = false; if (location.kind === SyntaxKind.ThisKeyword && !isThisExpression) { return { displayParts: [keywordPart(SyntaxKind.ThisKeyword)], documentation: [], symbolKind: ScriptElementKind.primitiveType, tags: undefined }; @@ -438,26 +452,32 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: Type } if (symbolFlags & SymbolFlags.Class && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (getDeclarationOfKind(symbol, SyntaxKind.ClassExpression)) { + const classExpression = getDeclarationOfKind(symbol, SyntaxKind.ClassExpression); + if (classExpression) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class pushSymbolKind(ScriptElementKind.localClassElement); + displayParts.push(spacePart()); } - else { - // Class declaration has name which is not local. - displayParts.push(keywordPart(SyntaxKind.ClassKeyword)); + if (!tryExpandSymbol(symbol, semanticMeaning)) { + if (!classExpression) { + // Class declaration has name which is not local. + displayParts.push(keywordPart(SyntaxKind.ClassKeyword)); + displayParts.push(spacePart()); + } + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); } - displayParts.push(spacePart()); - addFullSymbolName(symbol); - writeTypeParametersOfSymbol(symbol, sourceFile); } if ((symbolFlags & SymbolFlags.Interface) && (semanticMeaning & SemanticMeaning.Type)) { prefixNextMeaning(); - displayParts.push(keywordPart(SyntaxKind.InterfaceKeyword)); - displayParts.push(spacePart()); - addFullSymbolName(symbol); - writeTypeParametersOfSymbol(symbol, sourceFile); + if (!tryExpandSymbol(symbol, semanticMeaning)) { + displayParts.push(keywordPart(SyntaxKind.InterfaceKeyword)); + displayParts.push(spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } } if ((symbolFlags & SymbolFlags.TypeAlias) && (semanticMeaning & SemanticMeaning.Type)) { prefixNextMeaning(); @@ -468,25 +488,39 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: Type displayParts.push(spacePart()); displayParts.push(operatorPart(SyntaxKind.EqualsToken)); displayParts.push(spacePart()); - addRange(displayParts, typeToDisplayParts(typeChecker, location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, TypeFormatFlags.InTypeAlias)); + addRange( + displayParts, + typeToDisplayParts( + typeChecker, + location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), + enclosingDeclaration, + TypeFormatFlags.InTypeAlias, + verbosityLevel, + typeWriterOut, + ), + ); } if (symbolFlags & SymbolFlags.Enum) { prefixNextMeaning(); - if (some(symbol.declarations, d => isEnumDeclaration(d) && isEnumConst(d))) { - displayParts.push(keywordPart(SyntaxKind.ConstKeyword)); + if (!tryExpandSymbol(symbol, semanticMeaning)) { + if (some(symbol.declarations, d => isEnumDeclaration(d) && isEnumConst(d))) { + displayParts.push(keywordPart(SyntaxKind.ConstKeyword)); + displayParts.push(spacePart()); + } + displayParts.push(keywordPart(SyntaxKind.EnumKeyword)); displayParts.push(spacePart()); + addFullSymbolName(symbol, /*enclosingDeclaration*/ undefined); } - displayParts.push(keywordPart(SyntaxKind.EnumKeyword)); - displayParts.push(spacePart()); - addFullSymbolName(symbol); } if (symbolFlags & SymbolFlags.Module && !isThisExpression) { prefixNextMeaning(); - const declaration = getDeclarationOfKind(symbol, SyntaxKind.ModuleDeclaration); - const isNamespace = declaration && declaration.name && declaration.name.kind === SyntaxKind.Identifier; - displayParts.push(keywordPart(isNamespace ? SyntaxKind.NamespaceKeyword : SyntaxKind.ModuleKeyword)); - displayParts.push(spacePart()); - addFullSymbolName(symbol); + if (!tryExpandSymbol(symbol, semanticMeaning)) { + const declaration = getDeclarationOfKind(symbol, SyntaxKind.ModuleDeclaration); + const isNamespace = declaration && declaration.name && declaration.name.kind === SyntaxKind.Identifier; + displayParts.push(keywordPart(isNamespace ? SyntaxKind.NamespaceKeyword : SyntaxKind.ModuleKeyword)); + displayParts.push(spacePart()); + addFullSymbolName(symbol); + } } if ((symbolFlags & SymbolFlags.TypeParameter) && (semanticMeaning & SemanticMeaning.Type)) { prefixNextMeaning(); @@ -568,11 +602,15 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: Type type, semanticMeaning, shouldUseAliasName ? symbol : resolvedSymbol, + verbosityLevel, ); displayParts.push(...resolvedInfo.displayParts); displayParts.push(lineBreakPart()); documentationFromAlias = resolvedInfo.documentation; tagsFromAlias = resolvedInfo.tags; + if (typeWriterOut && resolvedInfo.canIncreaseVerbosityLevel) { + typeWriterOut.canIncreaseExpansionDepth = true; + } } else { documentationFromAlias = resolvedSymbol.getContextualDocumentationComment(resolvedNode, typeChecker); @@ -656,13 +694,31 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: Type // If the type is type parameter, format it specially if (type.symbol && type.symbol.flags & SymbolFlags.TypeParameter && symbolKind !== ScriptElementKind.indexSignatureElement) { const typeParameterParts = mapToDisplayParts(writer => { - const param = typeChecker.typeParameterToDeclaration(type as TypeParameter, enclosingDeclaration, symbolDisplayNodeBuilderFlags)!; + const param = typeChecker.typeParameterToDeclaration( + type as TypeParameter, + enclosingDeclaration, + symbolDisplayNodeBuilderFlags, + /*internalFlags*/ undefined, + /*tracker*/ undefined, + verbosityLevel, + typeWriterOut, + )!; getPrinter().writeNode(EmitHint.Unspecified, param, getSourceFileOfNode(getParseTreeNode(enclosingDeclaration)), writer); }); addRange(displayParts, typeParameterParts); } else { - addRange(displayParts, typeToDisplayParts(typeChecker, type, enclosingDeclaration)); + addRange( + displayParts, + typeToDisplayParts( + typeChecker, + type, + enclosingDeclaration, + /*flags*/ undefined, + verbosityLevel, + typeWriterOut, + ), + ); } if (isTransientSymbol(symbol) && symbol.links.target && isTransientSymbol(symbol.links.target) && symbol.links.target.links.tupleLabelDeclaration) { const labelDecl = symbol.links.target.links.tupleLabelDeclaration; @@ -748,7 +804,14 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: Type tags = tagsFromAlias; } - return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? undefined : tags }; + const canIncreaseVerbosityLevel = !typeWriterOut.truncated && typeWriterOut.canIncreaseExpansionDepth; + return { + displayParts, + documentation, + symbolKind, + tags: tags.length === 0 ? undefined : tags, + canIncreaseVerbosityLevel: verbosityLevel !== undefined ? canIncreaseVerbosityLevel : undefined, + }; function getPrinter() { return createPrinterWithRemoveComments(); @@ -774,9 +837,77 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: Type displayParts.push(spacePart()); } + function canExpandSymbol(symbol: Symbol, out: WriterContextOut | undefined): boolean { + if (verbosityLevel === undefined) { + return false; + } + const type = symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) ? + typeChecker.getDeclaredTypeOfSymbol(symbol) : + typeChecker.getTypeOfSymbolAtLocation(symbol, location); + if (!type || typeChecker.isLibType(type)) { + return false; + } + if (0 < verbosityLevel) { + return true; + } + if (out) { + out.canIncreaseExpansionDepth = true; + } + return false; + } + + function semanticToSymbolMeaning(meaning: SemanticMeaning): SymbolFlags { + let symbolMeaning = SymbolFlags.None; + if (meaning & SemanticMeaning.Value) { + symbolMeaning |= SymbolFlags.Value; + } + if (meaning & SemanticMeaning.Type) { + symbolMeaning |= SymbolFlags.Type; + } + if (meaning & SemanticMeaning.Namespace) { + symbolMeaning |= SymbolFlags.Namespace; + } + return symbolMeaning; + } + + /** + * Attempts to expand the hover for a symbol, returning true if it succeeded. + * e.g. Given a symbol `Foo` corresponding to `class Foo { prop1: number }`, + * we will expand the hover to contain a full declaration of the class. + */ + function tryExpandSymbol(symbol: Symbol, meaning: SemanticMeaning): boolean { + // It's possible we call this function multiple times for the same symbol, if the symbol represents more than one kind of thing. + // For instance, we'll call this function twice for a symbol that is both a function and a namespace. + // In this case, `symbolWasExpanded` will be true the second time we call this function, and we don't need to expand it again. + if (symbolWasExpanded) { + return true; + } + if (canExpandSymbol(symbol, typeWriterOut)) { + const symbolMeaning = semanticToSymbolMeaning(meaning); + const expandedDisplayParts = mapToDisplayParts(writer => { + const nodes = typeChecker.getEmitResolver().symbolToDeclarations( + symbol, + symbolMeaning, + TypeFormatFlags.MultilineObjectLiterals | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, + verbosityLevel !== undefined ? verbosityLevel - 1 : undefined, + typeWriterOut, + ); + const printer = getPrinter(); + const sourceFile = symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration); + nodes.forEach((node, i) => { + if (i > 0) writer.writeLine(); + printer.writeNode(EmitHint.Unspecified, node, sourceFile, writer); + }); + }); + addRange(displayParts, expandedDisplayParts); + symbolWasExpanded = true; + return true; + } + return false; + } + function addFullSymbolName(symbolToDisplay: Symbol, enclosingDeclaration?: Node) { let indexInfos; - if (alias && symbolToDisplay === symbol) { symbolToDisplay = alias; } @@ -842,7 +973,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker: Type } function addSignatureDisplayParts(signature: Signature, allSignatures: readonly Signature[], flags = TypeFormatFlags.None) { - addRange(displayParts, signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | TypeFormatFlags.WriteTypeArgumentsOfSignature)); + addRange(displayParts, signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | TypeFormatFlags.WriteTypeArgumentsOfSignature, verbosityLevel, typeWriterOut)); if (allSignatures.length > 1) { displayParts.push(spacePart()); displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); @@ -880,8 +1011,9 @@ export function getSymbolDisplayPartsDocumentationAndSymbolKind( location: Node, semanticMeaning: SemanticMeaning = getMeaningFromLocation(location), alias?: Symbol, + verbosityLevel?: number, ): SymbolDisplayPartsDocumentationAndSymbolKind { - return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, /*type*/ undefined, semanticMeaning, alias); + return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, /*type*/ undefined, semanticMeaning, alias, verbosityLevel); } function isLocalVariableOrFunction(symbol: Symbol) { diff --git a/src/services/types.ts b/src/services/types.ts index 0811d858e6a6e..39c1636fefcd1 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -583,6 +583,8 @@ export interface LanguageService { * @param position A zero-based index of the character where you want the quick info */ getQuickInfoAtPosition(fileName: string, position: number): QuickInfo | undefined; + /** @internal */ + getQuickInfoAtPosition(fileName: string, position: number, verbosityLevel: number | undefined): QuickInfo | undefined; // eslint-disable-line @typescript-eslint/unified-signatures getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan | undefined; @@ -1324,6 +1326,7 @@ export interface QuickInfo { displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; tags?: JSDocTagInfo[]; + canIncreaseVerbosityLevel?: boolean; } export type RenameInfo = RenameInfoSuccess | RenameInfoFailure; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 83db802709fe3..df0647ec41ea7 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1,6 +1,5 @@ import { __String, - addEmitFlags, addSyntheticLeadingComment, addSyntheticTrailingComment, AnyImportOrRequireStatement, @@ -51,7 +50,6 @@ import { DocumentSpan, DoStatement, ElementAccessExpression, - EmitFlags, emitModuleKindIsNonNodeESM, emptyArray, EndOfFileToken, @@ -101,7 +99,6 @@ import { getImpliedNodeFormatForFileWorker, getIndentString, getJSDocEnumTag, - getLastChild, getLineAndCharacterOfPosition, getLineStarts, getLocaleSpecificMessage, @@ -223,7 +220,6 @@ import { isNamespaceExport, isNamespaceImport, isNewExpression, - isNumericLiteral, isObjectBindingPattern, isObjectLiteralExpression, isOptionalChain, @@ -292,7 +288,6 @@ import { ModuleResolutionKind, ModuleSpecifierResolutionHost, moduleSpecifiers, - Mutable, NewExpression, NewLineKind, Node, @@ -332,9 +327,6 @@ import { ScriptTarget, SemicolonPreference, setConfigFileInOptions, - setOriginalNode, - setParentRecursive, - setTextRange, Signature, SignatureDeclaration, singleOrUndefined, @@ -387,9 +379,9 @@ import { unescapeLeadingUnderscores, UserPreferences, VariableDeclaration, - visitEachChild, VoidExpression, walkUpParenthesizedExpressions, + WriterContextOut, YieldExpression, } from "./_namespaces/ts.js"; @@ -3055,9 +3047,9 @@ export function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbol } /** @internal */ -export function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.None): SymbolDisplayPart[] { +export function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.None, verbosityLevel?: number, out?: WriterContextOut): SymbolDisplayPart[] { return mapToDisplayParts(writer => { - typechecker.writeType(type, enclosingDeclaration, flags | TypeFormatFlags.MultilineObjectLiterals | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, writer); + typechecker.writeType(type, enclosingDeclaration, flags | TypeFormatFlags.MultilineObjectLiterals | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, writer, verbosityLevel, out); }); } @@ -3069,10 +3061,10 @@ export function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, e } /** @internal */ -export function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.None): SymbolDisplayPart[] { +export function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.None, verbosityLevel?: number, out?: WriterContextOut): SymbolDisplayPart[] { flags |= TypeFormatFlags.UseAliasDefinedOutsideCurrentScope | TypeFormatFlags.MultilineObjectLiterals | TypeFormatFlags.WriteTypeArgumentsOfSignature | TypeFormatFlags.OmitParameterModifiers; return mapToDisplayParts(writer => { - typechecker.writeSignature(signature, enclosingDeclaration, flags, /*kind*/ undefined, writer); + typechecker.writeSignature(signature, enclosingDeclaration, flags, /*kind*/ undefined, writer, verbosityLevel, out); }); } @@ -3127,113 +3119,6 @@ export function getPrecedingNonSpaceCharacterPosition(text: string, position: nu return position + 1; } -/** - * Creates a deep, memberwise clone of a node with no source map location. - * - * WARNING: This is an expensive operation and is only intended to be used in refactorings - * and code fixes (because those are triggered by explicit user actions). - * - * @internal - */ -export function getSynthesizedDeepClone(node: T, includeTrivia = true): T { - const clone = node && getSynthesizedDeepCloneWorker(node); - if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone); - return setParentRecursive(clone, /*incremental*/ false); -} - -/** @internal */ -export function getSynthesizedDeepCloneWithReplacements( - node: T, - includeTrivia: boolean, - replaceNode: (node: Node) => Node | undefined, -): T { - let clone = replaceNode(node); - if (clone) { - setOriginalNode(clone, node); - } - else { - clone = getSynthesizedDeepCloneWorker(node as NonNullable, replaceNode); - } - - if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone); - return clone as T; -} - -function getSynthesizedDeepCloneWorker(node: T, replaceNode?: (node: Node) => Node | undefined): T { - const nodeClone: (n: T) => T = replaceNode - ? n => getSynthesizedDeepCloneWithReplacements(n, /*includeTrivia*/ true, replaceNode) - : getSynthesizedDeepClone; - const nodesClone: (ns: NodeArray | undefined) => NodeArray | undefined = replaceNode - ? ns => ns && getSynthesizedDeepClonesWithReplacements(ns, /*includeTrivia*/ true, replaceNode) - : ns => ns && getSynthesizedDeepClones(ns); - const visited = visitEachChild(node, nodeClone, /*context*/ undefined, nodesClone, nodeClone); - - if (visited === node) { - // This only happens for leaf nodes - internal nodes always see their children change. - const clone = isStringLiteral(node) ? setOriginalNode(factory.createStringLiteralFromNode(node), node) as Node as T : - isNumericLiteral(node) ? setOriginalNode(factory.createNumericLiteral(node.text, node.numericLiteralFlags), node) as Node as T : - factory.cloneNode(node); - return setTextRange(clone, node); - } - - // PERF: As an optimization, rather than calling factory.cloneNode, we'll update - // the new node created by visitEachChild with the extra changes factory.cloneNode - // would have made. - (visited as Mutable).parent = undefined!; - return visited; -} - -/** @internal */ -export function getSynthesizedDeepClones(nodes: NodeArray, includeTrivia?: boolean): NodeArray; -/** @internal */ -export function getSynthesizedDeepClones(nodes: NodeArray | undefined, includeTrivia?: boolean): NodeArray | undefined; -/** @internal */ -export function getSynthesizedDeepClones(nodes: NodeArray | undefined, includeTrivia = true): NodeArray | undefined { - if (nodes) { - const cloned = factory.createNodeArray(nodes.map(n => getSynthesizedDeepClone(n, includeTrivia)), nodes.hasTrailingComma); - setTextRange(cloned, nodes); - return cloned; - } - return nodes; -} - -/** @internal */ -export function getSynthesizedDeepClonesWithReplacements( - nodes: NodeArray, - includeTrivia: boolean, - replaceNode: (node: Node) => Node | undefined, -): NodeArray { - return factory.createNodeArray(nodes.map(n => getSynthesizedDeepCloneWithReplacements(n, includeTrivia, replaceNode)), nodes.hasTrailingComma); -} - -/** - * Sets EmitFlags to suppress leading and trailing trivia on the node. - * - * @internal - */ -export function suppressLeadingAndTrailingTrivia(node: Node): void { - suppressLeadingTrivia(node); - suppressTrailingTrivia(node); -} - -/** - * Sets EmitFlags to suppress leading trivia on the node. - * - * @internal - */ -export function suppressLeadingTrivia(node: Node): void { - addEmitFlagsRecursively(node, EmitFlags.NoLeadingComments, getFirstChild); -} - -/** - * Sets EmitFlags to suppress trailing trivia on the node. - * - * @internal @knipignore - */ -export function suppressTrailingTrivia(node: Node): void { - addEmitFlagsRecursively(node, EmitFlags.NoTrailingComments, getLastChild); -} - /** @internal */ export function copyComments(sourceNode: Node, targetNode: Node): void { const sourceFile = sourceNode.getSourceFile(); @@ -3256,16 +3141,6 @@ function hasLeadingLineBreak(node: Node, text: string) { return false; } -function addEmitFlagsRecursively(node: Node, flag: EmitFlags, getChild: (n: Node) => Node | undefined) { - addEmitFlags(node, flag); - const child = getChild(node); - if (child) addEmitFlagsRecursively(child, flag, getChild); -} - -function getFirstChild(node: Node): Node | undefined { - return node.forEachChild(child => child); -} - /** @internal */ export function getUniqueName(baseName: string, sourceFile: SourceFile): string { let nameText = baseName; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 2531c9ea0413d..0e9fc9ce22e9d 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1486,6 +1486,13 @@ declare namespace ts { command: CommandTypes.Quickinfo; arguments: FileLocationRequestArgs; } + export interface QuickInfoRequestArgs extends FileLocationRequestArgs { + /** + * This controls how many levels of definitions will be expanded in the quick info response. + * The default value is 0. + */ + verbosityLevel?: number; + } /** * Body of QuickInfoResponse. */ @@ -1519,6 +1526,10 @@ declare namespace ts { * JSDoc tags associated with symbol. */ tags: JSDocTagInfo[]; + /** + * Whether the verbosity level can be increased for this quick info response. + */ + canIncreaseVerbosityLevel?: boolean; } /** * Quickinfo response message. @@ -10757,6 +10768,7 @@ declare namespace ts { displayParts?: SymbolDisplayPart[]; documentation?: SymbolDisplayPart[]; tags?: JSDocTagInfo[]; + canIncreaseVerbosityLevel?: boolean; } type RenameInfo = RenameInfoSuccess | RenameInfoFailure; interface RenameInfoSuccess { diff --git a/tests/baselines/reference/quickinfoVerbosity1.baseline b/tests/baselines/reference/quickinfoVerbosity1.baseline new file mode 100644 index 0000000000000..e41255cd67c1a --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosity1.baseline @@ -0,0 +1,326 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosity1.ts === +// type FooType = string | number; +// const foo: FooType = 1; +// ^^^ +// | ---------------------------------------------------------------------- +// | const foo: string | number +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | const foo: FooType +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// type BarType = FooType | boolean; +// const bar: BarType = 1; +// ^^^ +// | ---------------------------------------------------------------------- +// | const bar: boolean | (string | number) +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | const bar: boolean | FooType +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | const bar: BarType +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosity1.ts", + "position": 41, + "name": "a" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 38, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosity1.ts", + "position": 41, + "name": "a" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 38, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosity1.ts", + "position": 99, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 96, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BarType", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosity1.ts", + "position": 99, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 96, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosity1.ts", + "position": 99, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 96, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosity2.baseline b/tests/baselines/reference/quickinfoVerbosity2.baseline new file mode 100644 index 0000000000000..844d2f7663f34 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosity2.baseline @@ -0,0 +1,431 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosity2.ts === +// type Str = string | {}; +// type FooType = Str | number; +// type Sym = symbol | (() => void); +// type BarType = Sym | boolean; +// type BothType = FooType | BarType; +// const both: BothType = 1; +// ^^^^ +// | ---------------------------------------------------------------------- +// | const both: (number | (string | {})) | (boolean | (symbol | (() => void))) +// | (verbosity level: 3) +// | ---------------------------------------------------------------------- +// ^^^^ +// | ---------------------------------------------------------------------- +// | const both: (number | Str) | (boolean | Sym) +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^^ +// | ---------------------------------------------------------------------- +// | const both: FooType | BarType +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^ +// | ---------------------------------------------------------------------- +// | const both: BothType +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosity2.ts", + "position": 162, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 158, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "both", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BothType", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosity2.ts", + "position": 162, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 158, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "both", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BarType", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosity2.ts", + "position": 162, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 158, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "both", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Str", + "kind": "aliasName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Sym", + "kind": "aliasName" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosity2.ts", + "position": 162, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 158, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "both", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "symbol", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 3 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosity3.baseline b/tests/baselines/reference/quickinfoVerbosity3.baseline new file mode 100644 index 0000000000000..301aecb7812b5 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosity3.baseline @@ -0,0 +1,1409 @@ +// === QuickInfo === +=== /tests/cases/fourslash/file.tsx === +// interface OptionProp { +// propx: 2 +// } +// class Opt extends React.Component { +// render() { +// return
Hello
; +// } +// } +// const obj1: OptionProp = { +// propx: 2 +// } +// let y1 = ; +// ^^^ +// | ---------------------------------------------------------------------- +// | class Opt { +// | render(): any; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class Opt { +// | render(): any; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class Opt +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +=== /tests/cases/fourslash/a.ts === +// interface Foo { +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo { +// | prop: T; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// prop: T +// } +// class Bar implements Foo { +// ^^^ +// | ---------------------------------------------------------------------- +// | class Bar implements Foo { +// | prop: T; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class Bar implements Foo { +// | prop: T; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class Bar +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// prop!: T +// } + +=== /tests/cases/fourslash/c.ts === +// class c5b { public foo() { } } +// namespace c5b { export var y = 2; } +// ^^^ +// | ---------------------------------------------------------------------- +// | class c5b { +// | public foo(): void; +// | } +// | namespace c5b { +// | let y: number; +// | } +// | +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class c5b { +// | public foo(): void; +// | } +// | namespace c5b { +// | let y: number; +// | } +// | +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class c5b +// | namespace c5b +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +=== /b.ts === +// import { f } from "./a"; +// f({ x: 1 }); +// ^ +// | ---------------------------------------------------------------------- +// | (alias) f(x: { +// | x: number; +// | }): void +// | import f +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | (alias) f(x: X): void +// | import f +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/b.ts", + "position": 25, + "name": "1" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 25, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "aliasName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "X", + "kind": "aliasName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/b.ts", + "position": 25, + "name": "1" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 25, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "aliasName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/file.tsx", + "position": 201, + "name": "2" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 198, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Opt", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/file.tsx", + "position": 201, + "name": "2" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 198, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Opt", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "render", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/file.tsx", + "position": 201, + "name": "2" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 198, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Opt", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "render", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 13, + "name": "3" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 10, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "text" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 13, + "name": "3" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 10, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "text" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 55, + "name": "4" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 52, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "text" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 55, + "name": "4" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 52, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "text" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "text" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "implements", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 55, + "name": "4" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 52, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "text" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "text" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "implements", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/c.ts", + "position": 44, + "name": "5" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 41, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c5b", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c5b", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/c.ts", + "position": 44, + "name": "5" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 41, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c5b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c5b", + "kind": "className" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/c.ts", + "position": 44, + "name": "5" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 41, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c5b", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c5b", + "kind": "className" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityClass1.baseline b/tests/baselines/reference/quickinfoVerbosityClass1.baseline new file mode 100644 index 0000000000000..ba0fa94e7120b --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityClass1.baseline @@ -0,0 +1,1958 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityClass1.ts === +// { +// class Foo { +// a!: "a" | "c"; +// } +// const f = new Foo(); +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: "a" | "c"; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// type FooParam = "a" | "b"; +// class Foo { +// constructor(public x: string) { +// this.x = "a"; +// } +// foo(p: FooParam): void {} +// } +// const f = new Foo(""); +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | x: string; +// | foo(p: "a" | "b"): void; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | x: string; +// | foo(p: FooParam): void; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// class Bar { +// ^^^ +// | ---------------------------------------------------------------------- +// | class Bar { +// | a: string; +// | bar(): void; +// | baz(param: string): void; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class Bar +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// a!: string; +// bar(): void {} +// baz(param: string): void {} +// } +// class Foo extends Bar { +// b!: boolean; +// override baz(param: string | number): void {} +// } +// const f = new Foo(); +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | b: boolean; +// | baz(param: string | number): void; +// | a: string; +// | bar(): void; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// class Bar { +// bar(param: B): void {} +// baz(): this { return this; } +// } +// class Foo extends Bar<"foo"> { +// foo(): this { return this; } +// } +// const b = new Bar(); +// ^ +// | ---------------------------------------------------------------------- +// | const b: { +// | bar(param: string): void; +// | baz(): Bar; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const b: Bar +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const f = new Foo(); +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | foo(): Foo; +// | bar(param: "foo"): void; +// | baz(): Foo; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// class Bar { +// bar(param: B): void {} +// baz(): this { return this; } +// } +// const noname = new (class extends Bar<"foo"> { +// ^^^^^^ +// | ---------------------------------------------------------------------- +// | const noname: { +// | foo(): (Anonymous class); +// | bar(param: "foo"): void; +// | baz(): (Anonymous class); +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^ +// | ---------------------------------------------------------------------- +// | const noname: (Anonymous class) +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// foo(): this { return this; } +// })(); +// const klass = class extends Bar<"foo"> { +// foo(): this { return this; } +// }; +// const k = new klass(); +// ^ +// | ---------------------------------------------------------------------- +// | const k: { +// | foo(): klass; +// | bar(param: "foo"): void; +// | baz(): klass; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const k: klass +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 58, + "name": "f1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 57, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 58, + "name": "f1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 57, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 250, + "name": "f2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 249, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 250, + "name": "f2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 249, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "p", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooParam", + "kind": "aliasName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 250, + "name": "f2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 249, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "p", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"b\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 283, + "name": "B" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 280, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 283, + "name": "B" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 280, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "baz", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "param", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 491, + "name": "f3" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 490, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 491, + "name": "f3" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 490, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "baz", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "param", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 706, + "name": "b1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 705, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 706, + "name": "b1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 705, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "param", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "baz", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 731, + "name": "f4" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 730, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 731, + "name": "f4" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 730, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "param", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "baz", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 873, + "name": "n1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 867, + "length": 6 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "noname", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(Anonymous class)", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 873, + "name": "n1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 867, + "length": 6 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "noname", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(Anonymous class)", + "kind": "className" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "param", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "baz", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(Anonymous class)", + "kind": "className" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 1055, + "name": "k1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 1054, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "k", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "klass", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass1.ts", + "position": 1055, + "name": "k1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 1054, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "k", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "klass", + "kind": "className" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "param", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "baz", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "klass", + "kind": "className" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityClass2.baseline b/tests/baselines/reference/quickinfoVerbosityClass2.baseline new file mode 100644 index 0000000000000..5a72c145eefa8 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityClass2.baseline @@ -0,0 +1,3036 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityClass2.ts === +// interface Apple { +// color: string; +// } +// class Foo { +// ^^^ +// | ---------------------------------------------------------------------- +// | class Foo { +// | static whatever(): void; +// | constructor(public x: T); +// | public x: T; +// | public y: T; +// | private foo(): { +// | color: string; +// | }; +// | protected z: boolean; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class Foo { +// | static whatever(): void; +// | constructor(public x: T); +// | public x: T; +// | public y: T; +// | private foo(): Apple; +// | protected z: boolean; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// constructor(public x: T) { } +// public y!: T; +// static whatever(): void { } +// private foo(): Apple { return { color: "green" }; } +// static { +// const a = class { x?: Apple; }; +// } +// protected z = true; +// } +// type Whatever = Foo; +// ^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type Whatever = { +// | x: string; +// | y: string; +// | foo(): { +// | color: string; +// | }; +// | z: boolean; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type Whatever = { +// | x: string; +// | y: string; +// | foo(): Apple; +// | z: boolean; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type Whatever = Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const a = Foo; +// ^ +// | ---------------------------------------------------------------------- +// | const a: { +// | new (x: T): Foo; +// | whatever(): void; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const a: typeof Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const c = Foo; +// ^ +// | ---------------------------------------------------------------------- +// | const c: { +// | new (x: string): Foo; +// | whatever(): void; +// | } +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// [1].forEach(class { +// ^^^^^ +// | ---------------------------------------------------------------------- +// | (local class) class { +// | static whatever(): void; +// | constructor(public x: T); +// | public x: T; +// | public y: T; +// | private foo(): { +// | color: string; +// | }; +// | protected z: boolean; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^^^ +// | ---------------------------------------------------------------------- +// | (local class) class { +// | static whatever(): void; +// | constructor(public x: T); +// | public x: T; +// | public y: T; +// | private foo(): Apple; +// | protected z: boolean; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^ +// | ---------------------------------------------------------------------- +// | (local class) (Anonymous class) +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// constructor(public x: T) { } +// public y!: T; +// static whatever(): void { } +// private foo(): Apple { return { color: "green" }; } +// static { +// const a = class { x?: Apple; }; +// } +// protected z = true; +// }); +// const b = Bar; +// ^ +// | ---------------------------------------------------------------------- +// | const b: any +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// @random() +// abstract class Animal { +// ^^^^^^ +// | ---------------------------------------------------------------------- +// | abstract class Animal { +// | name: string; +// | abstract makeSound(): void; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^ +// | ---------------------------------------------------------------------- +// | class Animal +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// name!: string; +// abstract makeSound(): void; +// } +// class Dog { +// ^^^ +// | ---------------------------------------------------------------------- +// | class Dog { +// | what(this: this, that: Dog): void; +// | #bones: string[]; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class Dog +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// what(this: this, that: Dog) { } +// #bones: string[]; +// } +// const d = new Dog(); +// ^ +// | ---------------------------------------------------------------------- +// | const d: { +// | what(this: Dog, that: Dog): void; +// | #bones: string[]; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const d: Dog +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 48, + "name": "1" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 45, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 48, + "name": "1" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 45, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "static", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "whatever", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "constructor", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "private", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "protected", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "z", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 48, + "name": "1" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 45, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "static", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "whatever", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "constructor", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "private", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "protected", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "z", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 291, + "name": "2" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 283, + "length": 8 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Whatever", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 291, + "name": "2" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 283, + "length": 8 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Whatever", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "z", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 291, + "name": "2" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 283, + "length": 8 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Whatever", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "z", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 314, + "name": "3" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 313, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 314, + "name": "3" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 313, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "new", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "whatever", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 329, + "name": "4" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 328, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "new", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "whatever", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 362, + "name": "5" + }, + "item": { + "kind": "local class", + "kindModifiers": "", + "textSpan": { + "start": 357, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local class", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(Anonymous class)", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 362, + "name": "5" + }, + "item": { + "kind": "local class", + "kindModifiers": "", + "textSpan": { + "start": 357, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local class", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class", + "kind": "keyword" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "static", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "whatever", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "constructor", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "private", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "protected", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "z", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 362, + "name": "5" + }, + "item": { + "kind": "local class", + "kindModifiers": "", + "textSpan": { + "start": 357, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local class", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class", + "kind": "keyword" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "static", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "whatever", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "constructor", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "public", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "private", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "protected", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "z", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 602, + "name": "6" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 601, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 649, + "name": "7" + }, + "item": { + "kind": "class", + "kindModifiers": "abstract", + "textSpan": { + "start": 643, + "length": 6 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Animal", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 649, + "name": "7" + }, + "item": { + "kind": "class", + "kindModifiers": "abstract", + "textSpan": { + "start": 643, + "length": 6 + }, + "displayParts": [ + { + "text": "abstract", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Animal", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "name", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "abstract", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "makeSound", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 714, + "name": "8" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 711, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Dog", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 714, + "name": "8" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 711, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Dog", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "what", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "this", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "that", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Dog", + "kind": "className" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "#bones", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 784, + "name": "9" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 783, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "d", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Dog", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityClass2.ts", + "position": 784, + "name": "9" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 783, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "d", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "what", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "this", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Dog", + "kind": "className" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "that", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Dog", + "kind": "className" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "#bones", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityConditionalType.baseline b/tests/baselines/reference/quickinfoVerbosityConditionalType.baseline new file mode 100644 index 0000000000000..901ac8820edcf --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityConditionalType.baseline @@ -0,0 +1,385 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityConditionalType.ts === +// interface Apple { +// color: string; +// weight: number; +// } +// type StrInt = string | bigint; +// type T1 = T extends { color: string } ? "one apple" : StrInt; +// function f(x: T1): void { +// x; +// ^ +// | ---------------------------------------------------------------------- +// | (parameter) x: T extends { +// | color: string; +// | } ? "one apple" : string | bigint +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | (parameter) x: T extends { +// | color: string; +// | } ? "one apple" : StrInt +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | (parameter) x: T1 +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityConditionalType.ts", + "position": 240, + "name": "x" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 239, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T1", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityConditionalType.ts", + "position": 240, + "name": "x" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 239, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"one apple\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "StrInt", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityConditionalType.ts", + "position": 240, + "name": "x" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 239, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"one apple\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bigint", + "kind": "keyword" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityEnum.baseline b/tests/baselines/reference/quickinfoVerbosityEnum.baseline new file mode 100644 index 0000000000000..b86afbe3ecfdd --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityEnum.baseline @@ -0,0 +1,1119 @@ +// === QuickInfo === +=== /tests/cases/fourslash/a.ts === +// export {}; +// enum Color { +// ^^^^^ +// | ---------------------------------------------------------------------- +// | enum Color { +// | Red = 0, +// | Green = 1, +// | Blue = 2 +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^ +// | ---------------------------------------------------------------------- +// | enum Color +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// Red, +// Green, +// Blue, +// } +// const x: Color = Color.Red; +// ^ +// | ---------------------------------------------------------------------- +// | const x: Color.Red | Color.Green | Color.Blue +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const x: Color +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const enum Direction { +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | const enum Direction { +// | Up = 0, +// | Down = 1 +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | const enum Direction +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// Up, +// Down, +// } +// const y: Direction = Direction.Up; +// ^ +// | ---------------------------------------------------------------------- +// | const y: Direction.Up | Direction.Down +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const y: Direction +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// enum Flags { +// ^^^^^ +// | ---------------------------------------------------------------------- +// | enum Flags { +// | None = 0, +// | IsDirectory = 1 << 0, +// | IsFile = 1 << 1, +// | IsSymlink = 1 << 2 +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^ +// | ---------------------------------------------------------------------- +// | enum Flags +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// None = 0, +// IsDirectory = 1 << 0, +// IsFile = 1 << 1, +// IsSymlink = 1 << 2, +// } + +=== /tests/cases/fourslash/c.ts === +// import { Color } from "./b"; +// const c: Color = Color.Red; +// ^^^^^ +// | ---------------------------------------------------------------------- +// | (alias) enum Color { +// | Red = "red" +// | } +// | import Color +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^ +// | ---------------------------------------------------------------------- +// | (alias) enum Color +// | import Color +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 21, + "name": "c" + }, + "item": { + "kind": "enum", + "kindModifiers": "", + "textSpan": { + "start": 16, + "length": 5 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "enumName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 21, + "name": "c" + }, + "item": { + "kind": "enum", + "kindModifiers": "", + "textSpan": { + "start": 16, + "length": 5 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Red", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Green", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Blue", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "2", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 63, + "name": "x" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 62, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "enumName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 63, + "name": "x" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 62, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Red", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Green", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Blue", + "kind": "text" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 104, + "name": "d" + }, + "item": { + "kind": "enum", + "kindModifiers": "", + "textSpan": { + "start": 95, + "length": 9 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Direction", + "kind": "enumName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 104, + "name": "d" + }, + "item": { + "kind": "enum", + "kindModifiers": "", + "textSpan": { + "start": 95, + "length": 9 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Direction", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Up", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Down", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 134, + "name": "y" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 133, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Direction", + "kind": "enumName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 134, + "name": "y" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 133, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Direction", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Up", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Direction", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Down", + "kind": "text" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 172, + "name": "f" + }, + "item": { + "kind": "enum", + "kindModifiers": "", + "textSpan": { + "start": 167, + "length": 5 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Flags", + "kind": "enumName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 172, + "name": "f" + }, + "item": { + "kind": "enum", + "kindModifiers": "", + "textSpan": { + "start": 167, + "length": 5 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Flags", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "None", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "IsDirectory", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<<", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "IsFile", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<<", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "IsSymlink", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<<", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "2", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/c.ts", + "position": 43, + "name": "a" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 38, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/c.ts", + "position": 43, + "name": "a" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 38, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Red", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"red\"", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityFunction.baseline b/tests/baselines/reference/quickinfoVerbosityFunction.baseline new file mode 100644 index 0000000000000..64dd6f46907ac --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityFunction.baseline @@ -0,0 +1,1258 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityFunction.ts === +// interface Apple { +// color: string; +// size: number; +// } +// interface Orchard { +// takeOneApple(a: Apple): void; +// getApple(): Apple; +// getApple(size: number): Apple[]; +// } +// const o: Orchard = {} as any; +// ^ +// | ---------------------------------------------------------------------- +// | const o: { +// | takeOneApple(a: { +// | color: string; +// | size: number; +// | }): void; +// | getApple(): { +// | color: string; +// | size: number; +// | }; +// | getApple(size: number): { +// | color: string; +// | size: number; +// | }[]; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const o: { +// | takeOneApple(a: Apple): void; +// | getApple(): Apple; +// | getApple(size: number): Apple[]; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const o: Orchard +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// declare function isApple(x: unknown): x is Apple; +// ^^^^^^^ +// | ---------------------------------------------------------------------- +// | function isApple(x: unknown): x is { +// | color: string; +// | size: number; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^ +// | ---------------------------------------------------------------------- +// | function isApple(x: unknown): x is Apple +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// type SomeType = { +// prop1: string; +// } +// function someFun(a: SomeType): SomeType { +// return a; +// } +// someFun.what = 'what'; +// ^^^^^^^ +// | ---------------------------------------------------------------------- +// | namespace someFun { +// | let what: string; +// | } +// | function someFun(a: { +// | prop1: string; +// | }): { +// | prop1: string; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^ +// | ---------------------------------------------------------------------- +// | module someFun +// | function someFun(a: SomeType): SomeType +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityFunction.ts", + "position": 180, + "name": "o" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 179, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "o", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Orchard", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityFunction.ts", + "position": 180, + "name": "o" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 179, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "o", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "takeOneApple", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "getApple", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "getApple", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "size", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityFunction.ts", + "position": 180, + "name": "o" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 179, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "o", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "takeOneApple", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "size", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "getApple", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "size", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "getApple", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "size", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "size", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityFunction.ts", + "position": 227, + "name": "f" + }, + "item": { + "kind": "function", + "kindModifiers": "declare", + "textSpan": { + "start": 220, + "length": 7 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isApple", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityFunction.ts", + "position": 227, + "name": "f" + }, + "item": { + "kind": "function", + "kindModifiers": "declare", + "textSpan": { + "start": 220, + "length": 7 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isApple", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "is", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "size", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityFunction.ts", + "position": 357, + "name": "s" + }, + "item": { + "kind": "function", + "kindModifiers": "", + "textSpan": { + "start": 350, + "length": 7 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someFun", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someFun", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType", + "kind": "aliasName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityFunction.ts", + "position": 357, + "name": "s" + }, + "item": { + "kind": "function", + "kindModifiers": "", + "textSpan": { + "start": 350, + "length": 7 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someFun", + "kind": "functionName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "what", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someFun", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityImport.baseline b/tests/baselines/reference/quickinfoVerbosityImport.baseline new file mode 100644 index 0000000000000..24cdb389ea3b2 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityImport.baseline @@ -0,0 +1,1518 @@ +// === QuickInfo === +=== /4.ts === +// import Foo from "./3"; +// ^^^ +// | ---------------------------------------------------------------------- +// | import Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const f = new Foo(); +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: boolean; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | (alias) new Foo(): { +// | a: boolean; +// | } +// | import Foo +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | (alias) new Foo(): Foo +// | import Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +=== /2.ts === +// import { a } from "./0"; +// ^ +// | ---------------------------------------------------------------------- +// | (alias) const a: { +// | a: number; +// | b: string; +// | } +// | import a +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | (alias) const a: Apple +// | import a +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// import { Color } from "./0"; +// ^^^^^ +// | ---------------------------------------------------------------------- +// | (alias) enum Color { +// | Red = 0, +// | Green = 1, +// | Blue = 2 +// | } +// | import Color +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^ +// | ---------------------------------------------------------------------- +// | (alias) enum Color +// | import Color +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +=== /1.ts === +// import * as zero from "./0"; +// const b = zero; +// ^ +// | ---------------------------------------------------------------------- +// | const b: { +// | readonly a: { +// | a: number; +// | b: string; +// | }; +// | Color: { +// | readonly [x: number]: string; +// | readonly Red: zero.Color.Red; +// | readonly Green: zero.Color.Green; +// | readonly Blue: zero.Color.Blue; +// | }; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const b: { +// | readonly a: zero.Apple; +// | Color: typeof zero.Color; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const b: typeof zero +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/1.ts", + "position": 36, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 35, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "zero", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/1.ts", + "position": 36, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 35, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "readonly", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "zero", + "kind": "aliasName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Apple", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "zero", + "kind": "aliasName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Color", + "kind": "enumName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/1.ts", + "position": 36, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 35, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "readonly", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "readonly", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "readonly", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Red", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "zero", + "kind": "aliasName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Color", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Red", + "kind": "text" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "readonly", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Green", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "zero", + "kind": "aliasName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Color", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Green", + "kind": "text" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "readonly", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Blue", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "zero", + "kind": "aliasName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Color", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Blue", + "kind": "text" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/2.ts", + "position": 10, + "name": "a" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "aliasName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/2.ts", + "position": 10, + "name": "a" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "aliasName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/2.ts", + "position": 39, + "name": "c" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 34, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/2.ts", + "position": 39, + "name": "c" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 34, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Red", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Green", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Blue", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "2", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Color", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/4.ts", + "position": 10, + "name": "d" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 7, + "length": 3 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/4.ts", + "position": 30, + "name": "e" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 29, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/4.ts", + "position": 30, + "name": "e" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 29, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/4.ts", + "position": 40, + "name": "f" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 37, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "new", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/4.ts", + "position": 40, + "name": "f" + }, + "item": { + "kind": "alias", + "kindModifiers": "export", + "textSpan": { + "start": 37, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "new", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityIndexSignature.baseline b/tests/baselines/reference/quickinfoVerbosityIndexSignature.baseline new file mode 100644 index 0000000000000..221f5181b3153 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityIndexSignature.baseline @@ -0,0 +1,588 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityIndexSignature.ts === +// type Key = string | number; +// interface Apple { +// banana: number; +// } +// interface Foo { +// [a: Key]: Apple; +// ^ +// | ---------------------------------------------------------------------- +// | (parameter) a: string | number +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | (parameter) a: Key +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// const f: Foo = {}; +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | [a: string]: { +// | banana: number; +// | }; +// | [a: number]: { +// | banana: number; +// | }; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | [a: string]: Apple; +// | [a: number]: Apple; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexSignature.ts", + "position": 90, + "name": "a" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 89, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Key", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexSignature.ts", + "position": 90, + "name": "a" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 89, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexSignature.ts", + "position": 114, + "name": "f" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 113, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexSignature.ts", + "position": 114, + "name": "f" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 113, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexSignature.ts", + "position": 114, + "name": "f" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 113, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "banana", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "banana", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityIndexType.baseline b/tests/baselines/reference/quickinfoVerbosityIndexType.baseline new file mode 100644 index 0000000000000..110a99c1f43b4 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityIndexType.baseline @@ -0,0 +1,584 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityIndexType.ts === +// interface T1 { +// banana: string; +// grape: number; +// apple: boolean; +// } +// const x1: keyof T1 = 'banana'; +// ^^ +// | ---------------------------------------------------------------------- +// | const x1: keyof { +// | banana: string; +// | grape: number; +// | apple: boolean; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^ +// | ---------------------------------------------------------------------- +// | const x1: keyof T1 +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const x2: keyof T1 & ("grape" | "apple") = 'grape'; +// ^^ +// | ---------------------------------------------------------------------- +// | const x2: "grape" | "apple" +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// function fn1(obj: T, key: keyof T, k2: keyof T1) { +// if (key === k2) { +// ^^ +// | ---------------------------------------------------------------------- +// | (parameter) k2: keyof { +// | banana: string; +// | grape: number; +// | apple: boolean; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^ +// | ---------------------------------------------------------------------- +// | (parameter) k2: keyof T1 +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// return obj[key]; +// ^^^ +// | ---------------------------------------------------------------------- +// | (parameter) key: keyof T +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// return key; +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexType.ts", + "position": 75, + "name": "x1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 73, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x1", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "keyof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T1", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexType.ts", + "position": 75, + "name": "x1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 73, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x1", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "keyof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "banana", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "grape", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "apple", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexType.ts", + "position": 106, + "name": "x2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 104, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x2", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"grape\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"apple\"", + "kind": "stringLiteral" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexType.ts", + "position": 230, + "name": "k2" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 228, + "length": 2 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "k2", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "keyof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T1", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexType.ts", + "position": 230, + "name": "k2" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 228, + "length": 2 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "k2", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "keyof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "banana", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "grape", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "apple", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexType.ts", + "position": 250, + "name": "key" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 247, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "key", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "keyof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 0 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityIndexedAccessType.baseline b/tests/baselines/reference/quickinfoVerbosityIndexedAccessType.baseline new file mode 100644 index 0000000000000..4feafb280c7b7 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityIndexedAccessType.baseline @@ -0,0 +1,405 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityIndexedAccessType.ts === +// interface T2 { +// "string key": string; +// "number key": number; +// "any key": string | number | symbol; +// } +// type K2 = "string key" | "any key"; +// function fn2(obj: T, key: keyof T) { +// const value: T[K2] = undefined as any; +// ^^^^^ +// | ---------------------------------------------------------------------- +// | const value: T["string key" | "any key"] +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^ +// | ---------------------------------------------------------------------- +// | const value: T[K2] +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// function fn3(obj: T2, key: K) { +// const value: T2[K] = undefined as any;; +// ^^^^^ +// | ---------------------------------------------------------------------- +// | const value: { +// | "string key": string; +// | "number key": number; +// | "any key": string | number | symbol; +// | }[K] +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^ +// | ---------------------------------------------------------------------- +// | const value: T2[K] +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexedAccessType.ts", + "position": 200, + "name": "v1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 195, + "length": 5 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K2", + "kind": "aliasName" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexedAccessType.ts", + "position": 200, + "name": "v1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 195, + "length": 5 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"string key\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"any key\"", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexedAccessType.ts", + "position": 297, + "name": "v2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 292, + "length": 5 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T2", + "kind": "interfaceName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIndexedAccessType.ts", + "position": 297, + "name": "v2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 292, + "length": 5 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"string key\"", + "kind": "stringLiteral" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"number key\"", + "kind": "stringLiteral" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"any key\"", + "kind": "stringLiteral" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "symbol", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityInterface1.baseline b/tests/baselines/reference/quickinfoVerbosityInterface1.baseline new file mode 100644 index 0000000000000..7d0b66bc6b396 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityInterface1.baseline @@ -0,0 +1,2383 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityInterface1.ts === +// { +// interface Foo { +// a: "a" | "c"; +// } +// const f: Foo = { a: "a" }; +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: "a" | "c"; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// interface Bar { +// b: "b" | "d"; +// } +// interface Foo extends Bar { +// a: "a" | "c"; +// } +// const f: Foo = { a: "a", b: "b" }; +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: "a" | "c"; +// | b: "b" | "d"; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// type BarParam = "b" | "d"; +// interface Bar { +// bar(b: BarParam): string; +// } +// type FooType = "a" | "c"; +// interface FooParam { +// param: FooType; +// } +// interface Foo extends Bar { +// a: FooType; +// foo: (a: FooParam) => number; +// } +// const f: Foo = { a: "a", bar: () => "b", foo: () => 1 }; +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: "a" | "c"; +// | foo: (a: { +// | param: "a" | "c"; +// | }) => number; +// | bar(b: "b" | "d"): string; +// | } +// | (verbosity level: 3) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: "a" | "c"; +// | foo: (a: { +// | param: FooType; +// | }) => number; +// | bar(b: "b" | "d"): string; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: FooType; +// | foo: (a: FooParam) => number; +// | bar(b: BarParam): string; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// interface Bar { +// bar(b: B): string; +// } +// interface FooParam { +// param: "a" | "c"; +// } +// interface Foo extends Bar { +// a: "a" | "c"; +// foo: (a: FooParam) => number; +// } +// const f: Foo = { a: "a", bar: () => "b", foo: () => 1 }; +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: "a" | "c"; +// | foo: (a: { +// | param: "a" | "c"; +// | }) => number; +// | bar(b: { +// | param: "a" | "c"; +// | }): string; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: "a" | "c"; +// | foo: (a: FooParam) => number; +// | bar(b: FooParam): string; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const b: Bar = { bar: () => "" }; +// ^ +// | ---------------------------------------------------------------------- +// | const b: { +// | bar(b: number): string; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const b: Bar +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// interface Foo { +// a: A; +// } +// type Alias = Foo; +// const a: Alias = { a: "a" }; +// ^ +// | ---------------------------------------------------------------------- +// | const a: { +// | a: string; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const a: Foo +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const a: Alias +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// interface Foo { +// a: "a"; +// } +// interface Foo { +// b: "b"; +// } +// const f: Foo = { a: "a", b: "b" }; +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: "a"; +// | b: "b"; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const f: Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 61, + "name": "f1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 60, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 61, + "name": "f1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 60, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 204, + "name": "f2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 203, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 204, + "name": "f2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 203, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"b\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"d\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 519, + "name": "f3" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 518, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 519, + "name": "f3" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 518, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooParam", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BarParam", + "kind": "aliasName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 519, + "name": "f3" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 518, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"b\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"d\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 519, + "name": "f3" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 518, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"b\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"d\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 3 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 805, + "name": "f4" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 804, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 805, + "name": "f4" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 804, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooParam", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooParam", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 805, + "name": "f4" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 804, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 866, + "name": "b1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 865, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 866, + "name": "b1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 865, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 989, + "name": "a" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 988, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Alias", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 989, + "name": "a" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 988, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 989, + "name": "a" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 988, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 1110, + "name": "f5" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 1109, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts", + "position": 1110, + "name": "f5" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 1109, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"b\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityInterface2.baseline b/tests/baselines/reference/quickinfoVerbosityInterface2.baseline new file mode 100644 index 0000000000000..a5111b44248ff --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityInterface2.baseline @@ -0,0 +1,1960 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityInterface2.ts === +// { +// interface Foo { +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo { +// | a: "a" | "c"; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// a: "a" | "c"; +// } +// } +// { +// interface Bar { +// b: "b" | "d"; +// } +// interface Foo extends Bar { +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo extends Bar { +// | a: "a" | "c"; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// a: "a" | "c"; +// } +// } +// { +// type BarParam = "b" | "d"; +// interface Bar { +// bar(b: BarParam): string; +// } +// type FooType = "a" | "c"; +// interface FooParam { +// param: FooType; +// } +// interface Foo extends Bar { +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo extends Bar { +// | a: "a" | "c"; +// | foo: (a: { +// | param: FooType; +// | }) => number; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo extends Bar { +// | a: FooType; +// | foo: (a: FooParam) => number; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// a: FooType; +// foo: (a: FooParam) => number; +// } +// } +// { +// interface Bar { +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Bar { +// | bar(b: B): string; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Bar +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// bar(b: B): string; +// } +// interface FooParam { +// param: "a" | "c"; +// } +// interface Foo extends Bar { +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo extends Bar<{ +// | param: "a" | "c"; +// | }> { +// | a: "a" | "c"; +// | foo: (a: { +// | param: "a" | "c"; +// | }) => number; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo extends Bar { +// | a: "a" | "c"; +// | foo: (a: FooParam) => number; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// a: "a" | "c"; +// foo: (a: FooParam) => number; +// } +// } +// { +// interface Foo { +// a: "a"; +// } +// interface Foo { +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo { +// | a: "a"; +// | b: "b"; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// b: "b"; +// } +// } +// interface Foo { +// ^^^ +// | ---------------------------------------------------------------------- +// | namespace Foo { +// | let bar: string; +// | } +// | interface Foo { +// | a: "a"; +// | } +// | +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | interface Foo +// | namespace Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// a: "a"; +// } +// namespace Foo { +// ^^^ +// | ---------------------------------------------------------------------- +// | namespace Foo { +// | let bar: string; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | namespace Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// export const bar: string; +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 19, + "name": "1" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 16, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 19, + "name": "1" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 16, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 119, + "name": "2" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 116, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 119, + "name": "2" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 116, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "interfaceName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 359, + "name": "3" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 356, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 359, + "name": "3" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 356, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "interfaceName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooParam", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 359, + "name": "3" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 356, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "interfaceName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 459, + "name": "4" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 456, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "B", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 459, + "name": "4" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 456, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "text" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "B", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "B", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 572, + "name": "5" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 569, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 572, + "name": "5" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 569, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "FooParam", + "kind": "interfaceName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooParam", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 572, + "name": "5" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 569, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "param", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 726, + "name": "6" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 723, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 726, + "name": "6" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 723, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"b\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 766, + "name": "7" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 763, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 766, + "name": "7" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 763, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 796, + "name": "8" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 793, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface2.ts", + "position": 796, + "name": "8" + }, + "item": { + "kind": "interface", + "kindModifiers": "", + "textSpan": { + "start": 793, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityIntersection1.baseline b/tests/baselines/reference/quickinfoVerbosityIntersection1.baseline new file mode 100644 index 0000000000000..145792e628a26 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityIntersection1.baseline @@ -0,0 +1,357 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityIntersection1.ts === +// { +// type Foo = { a: "a" | "c" }; +// type Bar = { a: "a" | "b" }; +// const obj: Foo & Bar = { a: "a" }; +// ^^^ +// | ---------------------------------------------------------------------- +// | const obj: { +// | a: "a" | "c"; +// | } & { +// | a: "a" | "b"; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | const obj: Foo & Bar +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// type Foo = { a: "c" }; +// type Bar = { a: "b" }; +// const obj: Foo & Bar = { a: "" }; +// ^^^ +// | ---------------------------------------------------------------------- +// | const obj: never +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// { +// type Foo = { a: "c" }; +// type Bar = { a: "b" }; +// type Never = Foo & Bar; +// const obj: Never = { a: "" }; +// ^^^ +// | ---------------------------------------------------------------------- +// | const obj: never +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIntersection1.ts", + "position": 81, + "name": "o1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 78, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Bar", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIntersection1.ts", + "position": 81, + "name": "o1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 78, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"c\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"a\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"b\"", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIntersection1.ts", + "position": 178, + "name": "o2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 175, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "never", + "kind": "keyword" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityIntersection1.ts", + "position": 302, + "name": "o3" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 299, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "never", + "kind": "keyword" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 0 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityJs.baseline b/tests/baselines/reference/quickinfoVerbosityJs.baseline new file mode 100644 index 0000000000000..ae0aabf6777bd --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityJs.baseline @@ -0,0 +1,1242 @@ +// === QuickInfo === +=== /tests/cases/fourslash/somefile.js === +// /** +// * @typedef {Object} SomeType +// * @property {string} prop1 +// */ +// /** @type {SomeType} */ +// const a = { +// ^ +// | ---------------------------------------------------------------------- +// | const a: { +// | prop1: string; +// | } +// | @type {SomeType} +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const a: SomeType +// | @type {SomeType} +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// prop1: 'value', +// } +// /** +// * @typedef {Object} SomeType2 +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type SomeType2 = { +// | prop2: number; +// | prop3: { +// | prop1: string; +// | }; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type SomeType2 = { +// | prop2: number; +// | prop3: SomeType; +// | } +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// * @property {number} prop2 +// * @property {SomeType} prop3 +// */ +// /** @type {SomeType[]} */ +// const ss = [{ prop1: 'value' }, { prop1: 'value' }]; +// const d = ss.map((s) => s.prop1); +// ^ +// | ---------------------------------------------------------------------- +// | (parameter) s: { +// | prop1: string; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | (parameter) s: SomeType +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// /** @param {SomeType} a +// * @returns {SomeType} +// */ +// function someFun(a) { +// ^^^^^^^ +// | ---------------------------------------------------------------------- +// | function someFun(a: { +// | prop1: string; +// | }): { +// | prop1: string; +// | } +// | namespace someFun { +// | let what: string; +// | } +// | @param a +// | @returns +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^ +// | ---------------------------------------------------------------------- +// | function someFun(a: SomeType): SomeType +// | module someFun +// | @param a +// | @returns +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// return a; +// } +// someFun.what = 'what'; +// class SomeClass { +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | class SomeClass { +// | b: { +// | prop2: number; +// | prop3: SomeType; +// | }; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | class SomeClass { +// | b: SomeType2; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | class SomeClass +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// /** @type {SomeType2} */ +// b; +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 97, + "name": "1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 96, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType", + "kind": "aliasName" + } + ], + "documentation": [], + "tags": [ + { + "name": "type", + "text": [ + { + "text": "{SomeType}", + "kind": "text" + } + ] + } + ], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 97, + "name": "1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 96, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "tags": [ + { + "name": "type", + "text": [ + { + "text": "{SomeType}", + "kind": "text" + } + ] + } + ], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 158, + "name": "2" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 149, + "length": 9 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType2", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop2", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop3", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 158, + "name": "2" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 149, + "length": 9 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType2", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop2", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop3", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 319, + "name": "3" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 318, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "s", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 319, + "name": "3" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 318, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "s", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 401, + "name": "4" + }, + "item": { + "kind": "function", + "kindModifiers": "", + "textSpan": { + "start": 394, + "length": 7 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someFun", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType", + "kind": "aliasName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someFun", + "kind": "functionName" + } + ], + "documentation": [], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "a", + "kind": "text" + } + ] + }, + { + "name": "returns" + } + ], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 401, + "name": "4" + }, + "item": { + "kind": "function", + "kindModifiers": "", + "textSpan": { + "start": 394, + "length": 7 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someFun", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someFun", + "kind": "functionName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "what", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "a", + "kind": "text" + } + ] + }, + { + "name": "returns" + } + ], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 461, + "name": "5" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 452, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeClass", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 461, + "name": "5" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 452, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeClass", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType2", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/somefile.js", + "position": 461, + "name": "5" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 452, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeClass", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop2", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "prop3", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SomeType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 2 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityLibType.baseline b/tests/baselines/reference/quickinfoVerbosityLibType.baseline new file mode 100644 index 0000000000000..d4ec5e2e93ab7 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityLibType.baseline @@ -0,0 +1,512 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityLibType.ts === +// interface Apple { +// color: string; +// size: number; +// } +// function f(): Promise { +// return Promise.resolve({ color: "red", size: 5 }); +// } +// const g = f; +// ^ +// | ---------------------------------------------------------------------- +// | const g: () => Promise<{ +// | color: string; +// | size: number; +// | }> +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const g: () => Promise +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const u: Map = new Map; +// ^ +// | ---------------------------------------------------------------------- +// | const u: Map +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const u: Map +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// type Foo = Promise; +// ^^^^^^^ +// | ---------------------------------------------------------------------- +// | interface Promise +// | Represents the completion of an asynchronous operation +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityLibType.ts", + "position": 152, + "name": "g" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 151, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "g", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Promise", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityLibType.ts", + "position": 152, + "name": "g" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 151, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "g", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Promise", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "size", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityLibType.ts", + "position": 165, + "name": "u" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 164, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "u", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Map", + "kind": "text" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityLibType.ts", + "position": 165, + "name": "u" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 164, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "u", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Map", + "kind": "text" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "size", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityLibType.ts", + "position": 218, + "name": "p" + }, + "item": { + "kind": "interface", + "kindModifiers": "declare", + "textSpan": { + "start": 211, + "length": 7 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Promise", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [ + { + "text": "Represents the completion of an asynchronous operation", + "kind": "text" + } + ], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 0 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityMappedType.baseline b/tests/baselines/reference/quickinfoVerbosityMappedType.baseline new file mode 100644 index 0000000000000..385bbf8803a75 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityMappedType.baseline @@ -0,0 +1,1080 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityMappedType.ts === +// type Apple = boolean | number; +// type Orange = string | boolean; +// type F = { +// [K in keyof T as T[K] extends Apple ? never : K]: T[K]; +// } +// type Bar = { +// banana: string; +// apple: boolean; +// } +// const x: F = { banana: 'hello' }; +// ^ +// | ---------------------------------------------------------------------- +// | const x: { +// | banana: string; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const x: F +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | type F = { [K in keyof T as T[K] extends number | boolean ? never : K]: T[K]; } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | type F = { [K in keyof T as T[K] extends Apple ? never : K]: T[K]; } +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const y: { [K in keyof Bar]?: Bar[K] } = { banana: 'hello' }; +// ^ +// | ---------------------------------------------------------------------- +// | const y: { +// | banana?: string; +// | apple?: boolean; +// | } +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// type G = { +// [K in keyof T]: T[K] & Apple +// }; +// const z: G = { banana: 'hello', apple: true }; +// ^ +// | ---------------------------------------------------------------------- +// | type G = { [K in keyof T]: T[K] & (number | boolean); } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | type G = { [K in keyof T]: T[K] & Apple; } +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityMappedType.ts", + "position": 192, + "name": "x" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 191, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "F", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "Bar", + "kind": "aliasName" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityMappedType.ts", + "position": 192, + "name": "x" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 191, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "banana", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityMappedType.ts", + "position": 195, + "name": "F" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 194, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "F", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "keyof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "as", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "never", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityMappedType.ts", + "position": 195, + "name": "F" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 194, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "F", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "keyof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "as", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "never", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityMappedType.ts", + "position": 231, + "name": "y" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 230, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "banana", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "apple", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityMappedType.ts", + "position": 343, + "name": "G" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 342, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "G", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "keyof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityMappedType.ts", + "position": 343, + "name": "G" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 342, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "G", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "keyof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "K", + "kind": "typeParameterName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityNamespace.baseline b/tests/baselines/reference/quickinfoVerbosityNamespace.baseline new file mode 100644 index 0000000000000..3b3a056588300 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityNamespace.baseline @@ -0,0 +1,1561 @@ +// === QuickInfo === +=== /3.ts === +// import * as Foo_1 from "./b"; +// export declare namespace ns { +// ^^ +// | ---------------------------------------------------------------------- +// | namespace ns { +// | export { Foo }; +// | export let c: number; +// | export let d: 1; +// | export let f: { +// | a: string; +// | }; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^ +// | ---------------------------------------------------------------------- +// | namespace ns { +// | export { Foo }; +// | export let c: number; +// | export let d: 1; +// | export let f: Apple; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^ +// | ---------------------------------------------------------------------- +// | namespace ns +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// import Foo = Foo_1.Foo; +// export { Foo }; +// export const c: number; +// export const d = 1; +// let e: Apple; +// export let f: Apple; +// } +// interface Apple { +// a: string; +// } + +=== /1.ts === +// export {}; +// class Foo { +// y: string; +// } +// namespace Foo { +// ^^^ +// | ---------------------------------------------------------------------- +// | class Foo { +// | y: string; +// | } +// | namespace Foo { +// | let y: number; +// | let x: string; +// | let w: string; +// | } +// | +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | class Foo +// | namespace Foo +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// export var y: number = 1; +// export var x: string = "hello"; +// export var w = "world"; +// var z = 2; +// } + +=== /tests/cases/fourslash/foo.ts === +// export function foo() { return "foo"; } +// import("./foo") +// ^^^^^^^ +// | ---------------------------------------------------------------------- +// | module "/tests/cases/fourslash/foo" { +// | function foo(): string; +// | namespace foo { } +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^ +// | ---------------------------------------------------------------------- +// | module "/tests/cases/fourslash/foo" +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// var x = import("./foo") + +=== /4.ts === +// class Foo { +// y!: T; +// } +// namespace Two { +// ^^^ +// | ---------------------------------------------------------------------- +// | namespace Two { +// | let f: { +// | y: number; +// | }; +// | let g: { +// | y: string; +// | }; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | namespace Two { +// | let f: Foo; +// | let g: Foo; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | namespace Two +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// export const f = new Foo(); +// } + +=== /6.ts === +// namespace OnlyLocal { +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | namespace OnlyLocal { } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | namespace OnlyLocal +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const bar: number; +// } + +[ + { + "marker": { + "fileName": "/1.ts", + "position": 56, + "name": "1" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 53, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/1.ts", + "position": 56, + "name": "1" + }, + "item": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 53, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "w", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/3.ts", + "position": 57, + "name": "2" + }, + "item": { + "kind": "module", + "kindModifiers": "export,declare", + "textSpan": { + "start": 55, + "length": 2 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ns", + "kind": "moduleName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/3.ts", + "position": 57, + "name": "2" + }, + "item": { + "kind": "module", + "kindModifiers": "export,declare", + "textSpan": { + "start": 55, + "length": 2 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ns", + "kind": "moduleName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "d", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/3.ts", + "position": 57, + "name": "2" + }, + "item": { + "kind": "module", + "kindModifiers": "export,declare", + "textSpan": { + "start": 55, + "length": 2 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ns", + "kind": "moduleName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "d", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/4.ts", + "position": 41, + "name": "3" + }, + "item": { + "kind": "module", + "kindModifiers": "", + "textSpan": { + "start": 38, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Two", + "kind": "moduleName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/4.ts", + "position": 41, + "name": "3" + }, + "item": { + "kind": "module", + "kindModifiers": "", + "textSpan": { + "start": 38, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Two", + "kind": "moduleName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "g", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/4.ts", + "position": 41, + "name": "3" + }, + "item": { + "kind": "module", + "kindModifiers": "", + "textSpan": { + "start": 38, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Two", + "kind": "moduleName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "let", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "g", + "kind": "text" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/6.ts", + "position": 19, + "name": "4" + }, + "item": { + "kind": "module", + "kindModifiers": "", + "textSpan": { + "start": 10, + "length": 9 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "OnlyLocal", + "kind": "moduleName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/6.ts", + "position": 19, + "name": "4" + }, + "item": { + "kind": "module", + "kindModifiers": "", + "textSpan": { + "start": 10, + "length": 9 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "OnlyLocal", + "kind": "moduleName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/foo.ts", + "position": 48, + "name": "5" + }, + "item": { + "kind": "module", + "kindModifiers": "", + "textSpan": { + "start": 47, + "length": 7 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"/tests/cases/fourslash/foo\"", + "kind": "stringLiteral" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/foo.ts", + "position": 48, + "name": "5" + }, + "item": { + "kind": "module", + "kindModifiers": "", + "textSpan": { + "start": 47, + "length": 7 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"/tests/cases/fourslash/foo\"", + "kind": "stringLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityObjectType1.baseline b/tests/baselines/reference/quickinfoVerbosityObjectType1.baseline new file mode 100644 index 0000000000000..2a4091f720292 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityObjectType1.baseline @@ -0,0 +1,1299 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityObjectType1.ts === +// type Str = string | {}; +// type FooType = Str | number; +// type Sym = symbol | (() => void); +// type BarType = Sym | boolean; +// type Obj = { foo: FooType, bar: BarType, str: Str }; +// const obj1: Obj = { foo: 1, bar: true, str: "3"}; +// ^^^^ +// | ---------------------------------------------------------------------- +// | const obj1: { +// | foo: number | (string | {}); +// | bar: boolean | (symbol | (() => void)); +// | str: string | {}; +// | } +// | (verbosity level: 3) +// | ---------------------------------------------------------------------- +// ^^^^ +// | ---------------------------------------------------------------------- +// | const obj1: { +// | foo: number | Str; +// | bar: boolean | Sym; +// | str: string | {}; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^^ +// | ---------------------------------------------------------------------- +// | const obj1: { +// | foo: FooType; +// | bar: BarType; +// | str: Str; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^ +// | ---------------------------------------------------------------------- +// | const obj1: Obj +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const obj2: { foo: FooType, bar: BarType, str: Str } = { foo: 1, bar: true, str: "3"}; +// ^^^^ +// | ---------------------------------------------------------------------- +// | const obj2: { +// | foo: number | (string | {}); +// | bar: boolean | (symbol | (() => void)); +// | str: string | {}; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^^ +// | ---------------------------------------------------------------------- +// | const obj2: { +// | foo: number | Str; +// | bar: boolean | Sym; +// | str: string | {}; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^ +// | ---------------------------------------------------------------------- +// | const obj2: { +// | foo: FooType; +// | bar: BarType; +// | str: Str; +// | } +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityObjectType1.ts", + "position": 180, + "name": "o1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 176, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj1", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Obj", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityObjectType1.ts", + "position": 180, + "name": "o1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 176, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj1", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BarType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "str", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Str", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityObjectType1.ts", + "position": 180, + "name": "o1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 176, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj1", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Str", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Sym", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "str", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityObjectType1.ts", + "position": 180, + "name": "o1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 176, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj1", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "symbol", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "str", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 3 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityObjectType1.ts", + "position": 230, + "name": "o2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 226, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj2", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BarType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "str", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Str", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityObjectType1.ts", + "position": 230, + "name": "o2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 226, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj2", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Str", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Sym", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "str", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityObjectType1.ts", + "position": 230, + "name": "o2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 226, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj2", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "symbol", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "str", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityRecursiveType.baseline b/tests/baselines/reference/quickinfoVerbosityRecursiveType.baseline new file mode 100644 index 0000000000000..672932bf789b7 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityRecursiveType.baseline @@ -0,0 +1,1526 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts === +// type Node = { +// ^^^^ +// | ---------------------------------------------------------------------- +// | type Node = { +// | value: T; +// | left: Node | undefined; +// | right: Node | undefined; +// | } +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// value: T; +// left: Node | undefined; +// right: Node | undefined; +// } +// const n: Node = { +// ^ +// | ---------------------------------------------------------------------- +// | const n: { +// | value: number; +// | left: Node; +// | right: Node; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const n: Node +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// value: 1, +// left: undefined, +// right: undefined, +// } +// interface Orange { +// name: string; +// } +// type TreeNode = { +// ^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type TreeNode = { +// | value: T; +// | left: TreeNode | undefined; +// | right: TreeNode | undefined; +// | orange?: { +// | name: string; +// | }; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type TreeNode = { +// | value: T; +// | left: TreeNode | undefined; +// | right: TreeNode | undefined; +// | orange?: Orange; +// | } +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// value: T; +// left: TreeNode | undefined; +// right: TreeNode | undefined; +// orange?: Orange; +// } +// const m: TreeNode = { +// ^ +// | ---------------------------------------------------------------------- +// | const m: { +// | value: number; +// | left: TreeNode; +// | right: TreeNode; +// | orange?: { +// | name: string; +// | }; +// | } +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const m: { +// | value: number; +// | left: TreeNode; +// | right: TreeNode; +// | orange?: Orange; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const m: TreeNode +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// value: 1, +// left: undefined, +// right: undefined, +// orange: { name: "orange" }, +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts", + "position": 9, + "name": "N" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 5, + "length": 4 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Node", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "left", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Node", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "right", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Node", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts", + "position": 103, + "name": "n" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 102, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "n", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Node", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts", + "position": 103, + "name": "n" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 102, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "n", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "left", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Node", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "right", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Node", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts", + "position": 233, + "name": "t" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 225, + "length": 8 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "left", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "right", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "orange", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts", + "position": 233, + "name": "t" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 225, + "length": 8 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "left", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "right", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "orange", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "name", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts", + "position": 356, + "name": "m" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 355, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "m", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts", + "position": 356, + "name": "m" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 355, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "m", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "left", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "right", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "orange", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts", + "position": 356, + "name": "m" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 355, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "m", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "value", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "left", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "right", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TreeNode", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "orange", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "name", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityServer.baseline b/tests/baselines/reference/quickinfoVerbosityServer.baseline new file mode 100644 index 0000000000000..6bce07cf78b76 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityServer.baseline @@ -0,0 +1,79 @@ +// === QuickInfo === +=== /tests/cases/fourslash/server/quickinfoVerbosityServer.ts === +// type FooType = string | number +// const foo: FooType = 1 +// ^^^ +// | ---------------------------------------------------------------------- +// | const foo: string | number +// | +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | const foo: FooType +// | +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/server/quickinfoVerbosityServer.ts", + "position": 40, + "name": "a" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 37, + "length": 3 + }, + "displayParts": [ + { + "kind": "text", + "text": "const foo: FooType" + } + ], + "documentation": [ + { + "kind": "text", + "text": "" + } + ], + "tags": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/server/quickinfoVerbosityServer.ts", + "position": 40, + "name": "a" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 37, + "length": 3 + }, + "displayParts": [ + { + "kind": "text", + "text": "const foo: string | number" + } + ], + "documentation": [ + { + "kind": "text", + "text": "" + } + ], + "tags": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityToplevelTruncation.baseline b/tests/baselines/reference/quickinfoVerbosityToplevelTruncation.baseline new file mode 100644 index 0000000000000..c285564e95f35 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityToplevelTruncation.baseline @@ -0,0 +1,1075 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityToplevelTruncation.ts === +// export enum LargeEnum { +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | enum LargeEnum { +// | Member1 = 0, +// | Member2 = 1, +// | Member3 = 2, +// | Member4 = 3, +// | Member5 = 4, +// | Member6 = 5, +// | Member7 = 6, +// | Member8 = 7, +// | Member9 = 8, +// | Member10 = 9, +// | Member11 = 10, +// | Member12 = 11, +// | ... 12 more ... , +// | Member25 = 24 +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// Member1, +// Member2, +// Member3, +// Member4, +// Member5, +// Member6, +// Member7, +// Member8, +// Member9, +// Member10, +// Member11, +// Member12, +// Member13, +// Member14, +// Member15, +// Member16, +// Member17, +// Member18, +// Member19, +// Member20, +// Member21, +// Member22, +// Member23, +// Member24, +// Member25, +// } +// export interface LargeInterface { +// ^^^^^^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | interface LargeInterface { +// | property1: string; +// | property2: number; +// | property3: boolean; +// | property4: Date; +// | property5: string[]; +// | property6: number[]; +// | property7: boolean[]; +// | property8: { +// | [key: string]: unknown; +// | }; +// | property9: string; +// | property10: number; +// | property11: boolean; +// | ... 8 more ... ; +// | property20: () => void; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// property1: string; +// property2: number; +// property3: boolean; +// property4: Date; +// property5: string[]; +// property6: number[]; +// property7: boolean[]; +// property8: { [key: string]: unknown }; +// property9: string | null; +// property10: number | null; +// property11: boolean | null; +// property12: Date | null; +// property13: string | number; +// property14: number | boolean; +// property15: string | boolean; +// property16: Array<{ id: number; name: string }>; +// property17: Array<{ key: string; value: unknown }>; +// property18: { nestedProp1: string; nestedProp2: number }; +// property19: { nestedProp3: boolean; nestedProp4: Date }; +// property20: () => void; +// } + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityToplevelTruncation.ts", + "position": 21, + "name": "1" + }, + "item": { + "kind": "enum", + "kindModifiers": "export", + "textSpan": { + "start": 12, + "length": 9 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LargeEnum", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member1", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member2", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member3", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "2", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member4", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "3", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member5", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "4", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member6", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "5", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member7", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "6", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member8", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "7", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member9", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "8", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member10", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "9", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member11", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "10", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member12", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "11", + "kind": "stringLiteral" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": " ... 12 more ... ", + "kind": "text" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Member25", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "24", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityToplevelTruncation.ts", + "position": 398, + "name": "2" + }, + "item": { + "kind": "interface", + "kindModifiers": "export", + "textSpan": { + "start": 384, + "length": 14 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LargeInterface", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property2", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property3", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property4", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property5", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property6", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property7", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property8", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "key", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property9", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property10", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property11", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "... 8 more ... ", + "kind": "propertyName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property20", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityTruncation.baseline b/tests/baselines/reference/quickinfoVerbosityTruncation.baseline new file mode 100644 index 0000000000000..df94e7ad1d512 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityTruncation.baseline @@ -0,0 +1,405 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityTruncation.ts === +// type Str = string | {}; +// type FooType = Str | number; +// type Sym = symbol | (() => void); +// type BarType = Sym | boolean; +// interface LotsOfProps { +// someLongPropertyName1: Str; +// someLongPropertyName2: FooType; +// someLongPropertyName3: Sym; +// someLongPropertyName4: BarType; +// someLongPropertyName5: Str; +// someLongPropertyName6: FooType; +// someLongPropertyName7: Sym; +// someLongPropertyName8: BarType; +// someLongMethodName1(a: FooType, b: BarType): Sym; +// someLongPropertyName9: Str; +// someLongPropertyName10: FooType; +// someLongPropertyName11: Sym; +// someLongPropertyName12: BarType; +// someLongPropertyName13: Str; +// someLongPropertyName14: FooType; +// someLongPropertyName15: Sym; +// someLongPropertyName16: BarType; +// someLongMethodName2(a: FooType, b: BarType): Sym; +// } +// const obj1: LotsOfProps = undefined as any as LotsOfProps; +// ^^^^ +// | ---------------------------------------------------------------------- +// | const obj1: { +// | someLongPropertyName1: Str; +// | someLongPropertyName2: FooType; +// | someLongPropertyName3: Sym; +// | someLongPropertyName4: BarType; +// | someLongPropertyName5: Str; +// | someLongPropertyName6: FooType; +// | ... 11 more ...; +// | someLongMethodName2(a: FooType, b: BarType): Sym; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^ +// | ---------------------------------------------------------------------- +// | const obj1: LotsOfProps +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTruncation.ts", + "position": 812, + "name": "o1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 808, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj1", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "LotsOfProps", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTruncation.ts", + "position": 812, + "name": "o1" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 808, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj1", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someLongPropertyName1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Str", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someLongPropertyName2", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someLongPropertyName3", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Sym", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someLongPropertyName4", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BarType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someLongPropertyName5", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Str", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someLongPropertyName6", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "... 11 more ...", + "kind": "propertyName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "someLongMethodName2", + "kind": "text" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BarType", + "kind": "aliasName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Sym", + "kind": "aliasName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityTuple.baseline b/tests/baselines/reference/quickinfoVerbosityTuple.baseline new file mode 100644 index 0000000000000..78e92ac4ed3cd --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityTuple.baseline @@ -0,0 +1,2512 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityTuple.ts === +// interface Orange { +// color: string; +// } +// interface Apple { +// color: string; +// other: Orange; +// } +// type TwoFruits = [Orange, Apple]; +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type TwoFruits = [{ +// | color: string; +// | }, { +// | color: string; +// | other: { +// | color: string; +// | }; +// | }] +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type TwoFruits = [{ +// | color: string; +// | }, { +// | color: string; +// | other: Orange; +// | }] +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type TwoFruits = [Orange, Apple] +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const tf: TwoFruits = [ +// ^^ +// | ---------------------------------------------------------------------- +// | const tf: [{ +// | color: string; +// | }, { +// | color: string; +// | other: { +// | color: string; +// | }; +// | }] +// | (verbosity level: 3) +// | ---------------------------------------------------------------------- +// ^^ +// | ---------------------------------------------------------------------- +// | const tf: [{ +// | color: string; +// | }, { +// | color: string; +// | other: Orange; +// | }] +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^ +// | ---------------------------------------------------------------------- +// | const tf: [Orange, Apple] +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^ +// | ---------------------------------------------------------------------- +// | const tf: TwoFruits +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// { color: "orange" }, +// { color: "red", other: { color: "orange" } } +// ]; +// const tf2: [Orange, Apple] = [ +// ^^^ +// | ---------------------------------------------------------------------- +// | const tf2: [{ +// | color: string; +// | }, { +// | color: string; +// | other: { +// | color: string; +// | }; +// | }] +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | const tf2: [{ +// | color: string; +// | }, { +// | color: string; +// | other: Orange; +// | }] +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^ +// | ---------------------------------------------------------------------- +// | const tf2: [Orange, Apple] +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// { color: "orange" }, +// { color: "red", other: { color: "orange" } } +// ]; +// type ManyFruits = (Orange | Apple)[]; +// ^^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type ManyFruits = ({ +// | color: string; +// | } | { +// | color: string; +// | other: { +// | color: string; +// | }; +// | })[] +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type ManyFruits = ({ +// | color: string; +// | } | { +// | color: string; +// | other: Orange; +// | })[] +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^^^^^^^^^ +// | ---------------------------------------------------------------------- +// | type ManyFruits = (Orange | Apple)[] +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// const mf: ManyFruits = []; +// ^^ +// | ---------------------------------------------------------------------- +// | const mf: ({ +// | color: string; +// | } | { +// | color: string; +// | other: { +// | color: string; +// | }; +// | })[] +// | (verbosity level: 3) +// | ---------------------------------------------------------------------- +// ^^ +// | ---------------------------------------------------------------------- +// | const mf: ({ +// | color: string; +// | } | { +// | color: string; +// | other: Orange; +// | })[] +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^^ +// | ---------------------------------------------------------------------- +// | const mf: (Orange | Apple)[] +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^^ +// | ---------------------------------------------------------------------- +// | const mf: ManyFruits +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 112, + "name": "T" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 103, + "length": 9 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TwoFruits", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 112, + "name": "T" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 103, + "length": 9 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TwoFruits", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "other", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 112, + "name": "T" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 103, + "length": 9 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TwoFruits", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "other", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 140, + "name": "f" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 138, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "tf", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TwoFruits", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 140, + "name": "f" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 138, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "tf", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 140, + "name": "f" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 138, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "tf", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "other", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 140, + "name": "f" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 138, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "tf", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "other", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 3 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 242, + "name": "f2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 239, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "tf2", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 242, + "name": "f2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 239, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "tf2", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "other", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 242, + "name": "f2" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 239, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "tf2", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "other", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 356, + "name": "m" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 346, + "length": 10 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ManyFruits", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 356, + "name": "m" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 346, + "length": 10 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ManyFruits", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "other", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 356, + "name": "m" + }, + "item": { + "kind": "type", + "kindModifiers": "", + "textSpan": { + "start": 346, + "length": 10 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ManyFruits", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "other", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 387, + "name": "mf" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 385, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "mf", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ManyFruits", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 387, + "name": "mf" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 385, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "mf", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 387, + "name": "mf" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 385, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "mf", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "other", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Orange", + "kind": "interfaceName" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTuple.ts", + "position": 387, + "name": "mf" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 385, + "length": 2 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "mf", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "other", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 3 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityTypeParameter.baseline b/tests/baselines/reference/quickinfoVerbosityTypeParameter.baseline new file mode 100644 index 0000000000000..4af6119b35d3e --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityTypeParameter.baseline @@ -0,0 +1,771 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts === +// type Str = string | {}; +// type FooType = Str | number; +// function fn(x: T) { +// x; +// ^ +// | ---------------------------------------------------------------------- +// | (parameter) x: T extends number | (string | {}) +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | (parameter) x: T extends number | Str +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | (parameter) x: T extends FooType +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// } +// const y: (x: T) => void = fn; +// ^ +// | ---------------------------------------------------------------------- +// | const y: (x: T) => void +// | (verbosity level: 2) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const y: (x: T) => void +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const y: (x: T) => void +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// type MixinCtor = new () => A & { constructor: MixinCtor }; +// ^ +// | ---------------------------------------------------------------------- +// | (type parameter) A in type MixinCtor +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts", + "position": 97, + "name": "x" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 96, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts", + "position": 97, + "name": "x" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 96, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Str", + "kind": "aliasName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts", + "position": 97, + "name": "x" + }, + "item": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 96, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts", + "position": 108, + "name": "y" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 107, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FooType", + "kind": "aliasName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts", + "position": 108, + "name": "y" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 107, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Str", + "kind": "aliasName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts", + "position": 108, + "name": "y" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 107, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "extends", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 2 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts", + "position": 181, + "name": "a" + }, + "item": { + "kind": "type parameter", + "kindModifiers": "", + "textSpan": { + "start": 180, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixinCtor", + "kind": "aliasName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "A", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 0 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickinfoVerbosityTypeof.baseline b/tests/baselines/reference/quickinfoVerbosityTypeof.baseline new file mode 100644 index 0000000000000..efde843770d46 --- /dev/null +++ b/tests/baselines/reference/quickinfoVerbosityTypeof.baseline @@ -0,0 +1,355 @@ +// === QuickInfo === +=== /tests/cases/fourslash/quickinfoVerbosityTypeof.ts === +// interface Apple { +// color: string; +// weight: number; +// } +// const a: Apple = { color: "red", weight: 150 }; +// const b: typeof a = { color: "green", weight: 120 }; +// ^ +// | ---------------------------------------------------------------------- +// | const b: { +// | color: string; +// | weight: number; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const b: Apple +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- +// class Banana { +// length: number; +// constructor(length: number) { +// this.length = length; +// } +// } +// const c: typeof Banana = Banana; +// ^ +// | ---------------------------------------------------------------------- +// | const c: { +// | new (length: number): Banana; +// | } +// | (verbosity level: 1) +// | ---------------------------------------------------------------------- +// ^ +// | ---------------------------------------------------------------------- +// | const c: typeof Banana +// | (verbosity level: 0) +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeof.ts", + "position": 114, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 113, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Apple", + "kind": "interfaceName" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeof.ts", + "position": 114, + "name": "b" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 113, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "color", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "weight", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": false, + "verbosityLevel": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeof.ts", + "position": 274, + "name": "c" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 273, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Banana", + "kind": "className" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickinfoVerbosityTypeof.ts", + "position": 274, + "name": "c" + }, + "item": { + "kind": "const", + "kindModifiers": "", + "textSpan": { + "start": 273, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "new", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "length", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Banana", + "kind": "className" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "canIncreaseVerbosityLevel": true, + "verbosityLevel": 1 + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/tsserver/fourslashServer/quickinfoVerbosityServer.js b/tests/baselines/reference/tsserver/fourslashServer/quickinfoVerbosityServer.js new file mode 100644 index 0000000000000..7e9762e4fd5f3 --- /dev/null +++ b/tests/baselines/reference/tsserver/fourslashServer/quickinfoVerbosityServer.js @@ -0,0 +1,199 @@ +Info seq [hh:mm:ss:mss] currentDirectory:: /home/src/Vscode/Projects/bin useCaseSensitiveFileNames:: false +Info seq [hh:mm:ss:mss] libs Location:: /home/src/tslibs/TS/Lib +Info seq [hh:mm:ss:mss] globalTypingsCacheLocation:: /home/src/Library/Caches/typescript +Info seq [hh:mm:ss:mss] Provided types map file "/home/src/tslibs/TS/Lib/typesMap.json" doesn't exist +//// [/home/src/tslibs/TS/Lib/lib.d.ts] +lib.d.ts-Text + +//// [/home/src/tslibs/TS/Lib/lib.decorators.d.ts] +lib.decorators.d.ts-Text + +//// [/home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts] +lib.decorators.legacy.d.ts-Text + +//// [/tests/cases/fourslash/server/quickinfoVerbosityServer.ts] +type FooType = string | number +const foo: FooType = 1 + + +Info seq [hh:mm:ss:mss] request: + { + "seq": 0, + "type": "request", + "arguments": { + "file": "/tests/cases/fourslash/server/quickinfoVerbosityServer.ts" + }, + "command": "open" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /tests/cases/fourslash/server/quickinfoVerbosityServer.ts ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Creating InferredProject: /dev/null/inferredProject1*, currentDirectory: /tests/cases/fourslash/server +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/tsconfig.json 2000 undefined WatchType: Config file for the inferred project root +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/jsconfig.json 2000 undefined WatchType: Config file for the inferred project root +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/tslibs/TS/Lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/tslibs/TS/Lib/lib.decorators.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + /home/src/tslibs/TS/Lib/lib.d.ts Text-1 lib.d.ts-Text + /home/src/tslibs/TS/Lib/lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text + /home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text + /tests/cases/fourslash/server/quickinfoVerbosityServer.ts SVC-1-0 "type FooType = string | number\nconst foo: FooType = 1" + + + ../../../../home/src/tslibs/TS/Lib/lib.d.ts + Default library for target 'es5' + ../../../../home/src/tslibs/TS/Lib/lib.decorators.d.ts + Library referenced via 'decorators' from file '../../../../home/src/tslibs/TS/Lib/lib.d.ts' + ../../../../home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts + Library referenced via 'decorators.legacy' from file '../../../../home/src/tslibs/TS/Lib/lib.d.ts' + quickinfoVerbosityServer.ts + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /tests/cases/fourslash/server/quickinfoVerbosityServer.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "open", + "request_seq": 0, + "success": true, + "performanceData": { + "updateGraphDurationMs": * + } + } +After Request +watchedFiles:: +/home/src/tslibs/TS/Lib/lib.d.ts: *new* + {"pollingInterval":500} +/home/src/tslibs/TS/Lib/lib.decorators.d.ts: *new* + {"pollingInterval":500} +/home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts: *new* + {"pollingInterval":500} +/tests/cases/fourslash/server/jsconfig.json: *new* + {"pollingInterval":2000} +/tests/cases/fourslash/server/tsconfig.json: *new* + {"pollingInterval":2000} + +watchedDirectoriesRecursive:: +/tests/cases/fourslash/node_modules: *new* + {} +/tests/cases/fourslash/node_modules/@types: *new* + {} +/tests/cases/fourslash/server/node_modules: *new* + {} +/tests/cases/fourslash/server/node_modules/@types: *new* + {} + +Projects:: +/dev/null/inferredProject1* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + autoImportProviderHost: false + +ScriptInfos:: +/home/src/tslibs/TS/Lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /dev/null/inferredProject1* +/home/src/tslibs/TS/Lib/lib.decorators.d.ts *new* + version: Text-1 + containingProjects: 1 + /dev/null/inferredProject1* +/home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts *new* + version: Text-1 + containingProjects: 1 + /dev/null/inferredProject1* +/tests/cases/fourslash/server/quickinfoVerbosityServer.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject1* *default* + +Info seq [hh:mm:ss:mss] request: + { + "seq": 1, + "type": "request", + "arguments": { + "file": "/tests/cases/fourslash/server/quickinfoVerbosityServer.ts", + "line": 2, + "offset": 10, + "verbosityLevel": 0 + }, + "command": "quickinfo" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "quickinfo", + "request_seq": 1, + "success": true, + "body": { + "kind": "const", + "kindModifiers": "", + "start": { + "line": 2, + "offset": 7 + }, + "end": { + "line": 2, + "offset": 10 + }, + "displayString": "const foo: FooType", + "documentation": "", + "tags": [], + "canIncreaseVerbosityLevel": true + } + } +Info seq [hh:mm:ss:mss] request: + { + "seq": 2, + "type": "request", + "arguments": { + "file": "/tests/cases/fourslash/server/quickinfoVerbosityServer.ts", + "line": 2, + "offset": 10, + "verbosityLevel": 1 + }, + "command": "quickinfo" + } +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "quickinfo", + "request_seq": 2, + "success": true, + "body": { + "kind": "const", + "kindModifiers": "", + "start": { + "line": 2, + "offset": 7 + }, + "end": { + "line": 2, + "offset": 10 + }, + "displayString": "const foo: string | number", + "documentation": "", + "tags": [], + "canIncreaseVerbosityLevel": false + } + } \ No newline at end of file diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 8be19c1cdf649..3b07ac5a4981b 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -361,7 +361,7 @@ declare namespace FourSlashInterface { baselineSyntacticAndSemanticDiagnostics(): void; getEmitOutput(expectedOutputFiles: ReadonlyArray): void; baselineCompletions(preferences?: UserPreferences): void; - baselineQuickInfo(): void; + baselineQuickInfo(verbosityLevels?: VerbosityLevels): void; baselineSmartSelection(): void; baselineSignatureHelp(): void; nameOrDottedNameSpanTextIs(text: string): void; @@ -701,6 +701,9 @@ declare namespace FourSlashInterface { readonly organizeImportsCaseFirst?: "upper" | "lower" | false; readonly organizeImportsTypeOrder?: "first" | "last" | "inline"; } + interface VerbosityLevels { + [markerName: string]: number | number[] | undefined; + } interface InlayHintsOptions extends UserPreferences { readonly includeInlayParameterNameHints?: "none" | "literals" | "all"; readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; diff --git a/tests/cases/fourslash/quickinfoVerbosity1.ts b/tests/cases/fourslash/quickinfoVerbosity1.ts new file mode 100644 index 0000000000000..6d95aa6dbd8a9 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosity1.ts @@ -0,0 +1,10 @@ +/// + +//// type FooType = string | number; +//// const foo/*a*/: FooType = 1; + +//// type BarType = FooType | boolean; +//// const bar/*b*/: BarType = 1; + + +verify.baselineQuickInfo({ "a": [0, 1], "b": [0, 1, 2] }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosity2.ts b/tests/cases/fourslash/quickinfoVerbosity2.ts new file mode 100644 index 0000000000000..7f61912b97e5d --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosity2.ts @@ -0,0 +1,11 @@ +/// + +//// type Str = string | {}; +//// type FooType = Str | number; +//// type Sym = symbol | (() => void); +//// type BarType = Sym | boolean; +//// type BothType = FooType | BarType; +//// const both/*b*/: BothType = 1; + + +verify.baselineQuickInfo({ "b": [0, 1, 2, 3], }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosity3.ts b/tests/cases/fourslash/quickinfoVerbosity3.ts new file mode 100644 index 0000000000000..6d76ec3a6e45e --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosity3.ts @@ -0,0 +1,46 @@ +/// + +// @Filename: /a.ts +////export type X = { x: number }; +////export function f(x: X): void {} + +// @Filename: /b.ts +////import { f } from "./a"; +/////*1*/f({ x: 1 }); + +// @Filename: file.tsx +// @jsx: preserve +// @noLib: true + +//// interface OptionProp { +//// propx: 2 +//// } +//// class Opt extends React.Component { +//// render() { +//// return
Hello
; +//// } +//// } +//// const obj1: OptionProp = { +//// propx: 2 +//// } +//// let y1 = ; + +// @Filename: a.ts +//// interface Foo/*3*/ { +//// prop: T +//// } +//// class Bar/*4*/ implements Foo { +//// prop!: T +//// } + +// @Filename: c.ts +//// class c5b { public foo() { } } +//// namespace c5b/*5*/ { export var y = 2; } + +verify.baselineQuickInfo({ + "1": [0, 1], + "2": [0, 1, 2], + "3": [0, 1], + "4": [0, 1, 2], + "5": [0, 1, 2], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityClass1.ts b/tests/cases/fourslash/quickinfoVerbosityClass1.ts new file mode 100644 index 0000000000000..917b57489c629 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityClass1.ts @@ -0,0 +1,72 @@ +/// + + +// simple case +//// { +//// class Foo { +//// a!: "a" | "c"; +//// } +//// const f/*f1*/ = new Foo(); +//// } +// constructor +//// { +//// type FooParam = "a" | "b"; +//// class Foo { +//// constructor(public x: string) { +//// this.x = "a"; +//// } +//// foo(p: FooParam): void {} +//// } +//// const f/*f2*/ = new Foo(""); +//// } +// inheritance +//// { +//// class Bar/*B*/ { +//// a!: string; +//// bar(): void {} +//// baz(param: string): void {} +//// } +//// class Foo extends Bar { +//// b!: boolean; +//// override baz(param: string | number): void {} +//// } +//// const f/*f3*/ = new Foo(); +//// } +// type parameters +//// { +//// class Bar { +//// bar(param: B): void {} +//// baz(): this { return this; } +//// } +//// class Foo extends Bar<"foo"> { +//// foo(): this { return this; } +//// } +//// const b/*b1*/ = new Bar(); +//// const f/*f4*/ = new Foo(); +//// } +// class expression +//// { +//// class Bar { +//// bar(param: B): void {} +//// baz(): this { return this; } +//// } +//// const noname/*n1*/ = new (class extends Bar<"foo"> { +//// foo(): this { return this; } +//// })(); +//// const klass = class extends Bar<"foo"> { +//// foo(): this { return this; } +//// }; +//// const k/*k1*/ = new klass(); +//// } + + +verify.baselineQuickInfo({ + f1: [0, 1], + f2: [0, 1, 2], + f3: [0, 1], + b1: [0, 1], + f4: [0, 1], + n1: [0, 1], + k1: [0, 1], + B: [0, 1], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityClass2.ts b/tests/cases/fourslash/quickinfoVerbosityClass2.ts new file mode 100644 index 0000000000000..57ca867fa0cfb --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityClass2.ts @@ -0,0 +1,60 @@ +/// + + +//// interface Apple { +//// color: string; +//// } + +//// class Foo/*1*/ { +//// constructor(public x: T) { } +//// public y!: T; +//// static whatever(): void { } +//// private foo(): Apple { return { color: "green" }; } +//// static { +//// const a = class { x?: Apple; }; +//// } +//// protected z = true; +//// } + +//// type Whatever/*2*/ = Foo; +//// const a/*3*/ = Foo; +//// const c/*4*/ = Foo; + +//// [1].forEach(class/*5*/ { +//// constructor(public x: T) { } +//// public y!: T; +//// static whatever(): void { } +//// private foo(): Apple { return { color: "green" }; } +//// static { +//// const a = class { x?: Apple; }; +//// } +//// protected z = true; +//// }); + +//// const b/*6*/ = Bar; + +//// @random() +//// abstract class Animal/*7*/ { +//// name!: string; + +//// abstract makeSound(): void; +//// } + +//// class Dog/*8*/ { +//// what(this: this, that: Dog) { } +//// #bones: string[]; +//// } +//// const d/*9*/ = new Dog(); + + +verify.baselineQuickInfo({ + 1: [0, 1, 2], + 2: [0, 1, 2], + 3: [0, 1], + 4: [0], + 5: [0, 1, 2], + 6: [0], + 7: [0, 1], + 8: [0, 1], + 9: [0, 1], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityConditionalType.ts b/tests/cases/fourslash/quickinfoVerbosityConditionalType.ts new file mode 100644 index 0000000000000..066ce0a8784f8 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityConditionalType.ts @@ -0,0 +1,13 @@ +/// + +//// interface Apple { +//// color: string; +//// weight: number; +//// } +//// type StrInt = string | bigint; +//// type T1 = T extends { color: string } ? "one apple" : StrInt; +//// function f(x: T1): void { +//// x/*x*/; +//// } + +verify.baselineQuickInfo({ "x": [0, 1, 2] }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityEnum.ts b/tests/cases/fourslash/quickinfoVerbosityEnum.ts new file mode 100644 index 0000000000000..c38af64b98ee7 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityEnum.ts @@ -0,0 +1,40 @@ +/// + +// @filename: a.ts +//// export {}; +//// enum Color/*c*/ { +//// Red, +//// Green, +//// Blue, +//// } +//// const x/*x*/: Color = Color.Red; + +//// const enum Direction/*d*/ { +//// Up, +//// Down, +//// } +//// const y/*y*/: Direction = Direction.Up; + +//// enum Flags/*f*/ { +//// None = 0, +//// IsDirectory = 1 << 0, +//// IsFile = 1 << 1, +//// IsSymlink = 1 << 2, +//// } + +// @filename: b.ts +//// export enum Color { +//// Red = "red" +//// } +// @filename: c.ts +//// import { Color } from "./b"; +//// const c: Color/*a*/ = Color.Red; + +verify.baselineQuickInfo({ + c: [0, 1], + x: [0, 1], + d: [0, 1], + y: [0, 1], + f: [0, 1], + a: [0, 1], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityFunction.ts b/tests/cases/fourslash/quickinfoVerbosityFunction.ts new file mode 100644 index 0000000000000..63aefd8a591df --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityFunction.ts @@ -0,0 +1,33 @@ +/// + + +//// interface Apple { +//// color: string; +//// size: number; +//// } + +//// interface Orchard { +//// takeOneApple(a: Apple): void; + +//// getApple(): Apple; +//// getApple(size: number): Apple[]; +//// } + +//// const o/*o*/: Orchard = {} as any; + +//// declare function isApple/*f*/(x: unknown): x is Apple; + +//// type SomeType = { +//// prop1: string; +//// } +//// function someFun(a: SomeType): SomeType { +//// return a; +//// } +//// someFun/*s*/.what = 'what'; + + +verify.baselineQuickInfo({ + "o": [0, 1, 2], + "f": [0, 1], + "s": [0, 1] +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityImport.ts b/tests/cases/fourslash/quickinfoVerbosityImport.ts new file mode 100644 index 0000000000000..9fd309b2857dc --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityImport.ts @@ -0,0 +1,40 @@ +/// + +// @module: esnext +// @filename: /0.ts +//// export type Apple = { +//// a: number; +//// b: string; +//// } +//// export const a: Apple = { a: 1, b: "2"}; +//// export enum Color { +//// Red, +//// Green, +//// Blue, +//// } + +// @filename: /1.ts +//// import * as zero from "./0"; +//// const b/*b*/ = zero; + +// @filename: /2.ts +//// import { a/*a*/ } from "./0"; +//// import { Color/*c*/ } from "./0"; + +// @filename: /3.ts +//// export default class { +//// a: boolean; +//// } + +// @filename: /4.ts +//// import Foo/*d*/ from "./3"; +//// const f/*e*/ = new Foo/*f*/(); + +verify.baselineQuickInfo({ + b: [0, 1, 2], + a: [0, 1], + c: [0, 1], + d: [0], + e: [0, 1], + f: [0, 1], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityIndexSignature.ts b/tests/cases/fourslash/quickinfoVerbosityIndexSignature.ts new file mode 100644 index 0000000000000..0facb3d3f2cf9 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityIndexSignature.ts @@ -0,0 +1,13 @@ +/// + +//// type Key = string | number; +//// interface Apple { +//// banana: number; +//// } +//// interface Foo { +//// [a/*a*/: Key]: Apple; +//// } +//// const f/*f*/: Foo = {}; + + +verify.baselineQuickInfo({ "a": [0, 1], "f": [0, 1, 2] }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityIndexType.ts b/tests/cases/fourslash/quickinfoVerbosityIndexType.ts new file mode 100644 index 0000000000000..c44a0124cac97 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityIndexType.ts @@ -0,0 +1,20 @@ +/// + +//// interface T1 { +//// banana: string; +//// grape: number; +//// apple: boolean; +//// } + +//// const x1/*x1*/: keyof T1 = 'banana'; +//// const x2/*x2*/: keyof T1 & ("grape" | "apple") = 'grape'; + +//// function fn1(obj: T, key: keyof T, k2: keyof T1) { +//// if (key === k2/*k2*/) { +//// return obj[key/*key*/]; +//// } +//// return key; +//// } + + +verify.baselineQuickInfo({ "x1": [0, 1], "x2": [0], "k2": [0, 1], "key": [0] }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityIndexedAccessType.ts b/tests/cases/fourslash/quickinfoVerbosityIndexedAccessType.ts new file mode 100644 index 0000000000000..c58286923b5fa --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityIndexedAccessType.ts @@ -0,0 +1,20 @@ +/// + +//// interface T2 { +//// "string key": string; +//// "number key": number; +//// "any key": string | number | symbol; +//// } + +//// type K2 = "string key" | "any key"; + +//// function fn2(obj: T, key: keyof T) { +//// const value/*v1*/: T[K2] = undefined as any; +//// } + +//// function fn3(obj: T2, key: K) { +//// const value/*v2*/: T2[K] = undefined as any;; +//// } + + +verify.baselineQuickInfo({ "v1": [0, 1], "v2": [0, 1] }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityInterface1.ts b/tests/cases/fourslash/quickinfoVerbosityInterface1.ts new file mode 100644 index 0000000000000..c0898b6fc25c6 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityInterface1.ts @@ -0,0 +1,79 @@ +/// + +// simple case +//// { +//// interface Foo { +//// a: "a" | "c"; +//// } +//// const f/*f1*/: Foo = { a: "a" }; +//// } +// extends +//// { +//// interface Bar { +//// b: "b" | "d"; +//// } +//// interface Foo extends Bar { +//// a: "a" | "c"; +//// } +//// const f/*f2*/: Foo = { a: "a", b: "b" }; +//// } +// methods +//// { +//// type BarParam = "b" | "d"; +//// interface Bar { +//// bar(b: BarParam): string; +//// } +//// type FooType = "a" | "c"; +//// interface FooParam { +//// param: FooType; +//// } +//// interface Foo extends Bar { +//// a: FooType; +//// foo: (a: FooParam) => number; +//// } +//// const f/*f3*/: Foo = { a: "a", bar: () => "b", foo: () => 1 }; +//// } +// type parameters +//// { +//// interface Bar { +//// bar(b: B): string; +//// } +//// interface FooParam { +//// param: "a" | "c"; +//// } +//// interface Foo extends Bar { +//// a: "a" | "c"; +//// foo: (a: FooParam) => number; +//// } +//// const f/*f4*/: Foo = { a: "a", bar: () => "b", foo: () => 1 }; +//// const b/*b1*/: Bar = { bar: () => "" }; +//// } +// alias + interface +//// { +//// interface Foo
{ +//// a: A; +//// } +//// type Alias = Foo; +//// const a/*a*/: Alias = { a: "a" }; +//// } +// decl merging +//// { +//// interface Foo { +//// a: "a"; +//// } +//// interface Foo { +//// b: "b"; +//// } +//// const f/*f5*/: Foo = { a: "a", b: "b" }; +//// } + + +verify.baselineQuickInfo({ + f1: [0, 1], + f2: [0, 1], + f3: [0, 1, 2, 3], + f4: [0, 1, 2], + b1: [0, 1], + a: [0, 1, 2], + f5: [0, 1], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityInterface2.ts b/tests/cases/fourslash/quickinfoVerbosityInterface2.ts new file mode 100644 index 0000000000000..916cc8d9c2e72 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityInterface2.ts @@ -0,0 +1,66 @@ +/// + +//// { +//// interface Foo/*1*/ { +//// a: "a" | "c"; +//// } +//// } +//// { +//// interface Bar { +//// b: "b" | "d"; +//// } +//// interface Foo/*2*/ extends Bar { +//// a: "a" | "c"; +//// } +//// } +//// { +//// type BarParam = "b" | "d"; +//// interface Bar { +//// bar(b: BarParam): string; +//// } +//// type FooType = "a" | "c"; +//// interface FooParam { +//// param: FooType; +//// } +//// interface Foo/*3*/ extends Bar { +//// a: FooType; +//// foo: (a: FooParam) => number; +//// } +//// } +//// { +//// interface Bar/*4*/ { +//// bar(b: B): string; +//// } +//// interface FooParam { +//// param: "a" | "c"; +//// } +//// interface Foo/*5*/ extends Bar { +//// a: "a" | "c"; +//// foo: (a: FooParam) => number; +//// } +//// } +//// { +//// interface Foo { +//// a: "a"; +//// } +//// interface Foo/*6*/ { +//// b: "b"; +//// } +//// } +//// interface Foo/*7*/ { +//// a: "a"; +//// } +//// namespace Foo/*8*/ { +//// export const bar: string; +//// } + +verify.baselineQuickInfo({ + "1": [0, 1], + "2": [0, 1], + "3": [0, 1, 2], + "4": [0, 1], + "5": [0, 1, 2], + "6": [0, 1], + "7": [0, 1], + "8": [0, 1], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityIntersection1.ts b/tests/cases/fourslash/quickinfoVerbosityIntersection1.ts new file mode 100644 index 0000000000000..521e624880750 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityIntersection1.ts @@ -0,0 +1,22 @@ +/// + + + +//// { +//// type Foo = { a: "a" | "c" }; +//// type Bar = { a: "a" | "b" }; +//// const obj/*o1*/: Foo & Bar = { a: "a" }; +//// } +//// { +//// type Foo = { a: "c" }; +//// type Bar = { a: "b" }; +//// const obj/*o2*/: Foo & Bar = { a: "" }; +//// } +//// { +//// type Foo = { a: "c" }; +//// type Bar = { a: "b" }; +//// type Never = Foo & Bar; +//// const obj/*o3*/: Never = { a: "" }; +//// } + +verify.baselineQuickInfo({ "o1": [0, 1], "o2": 0, "o3": 0 }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityJs.ts b/tests/cases/fourslash/quickinfoVerbosityJs.ts new file mode 100644 index 0000000000000..398674f7bfd38 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityJs.ts @@ -0,0 +1,46 @@ +/// + +// @Filename: somefile.js +// @allowJs: true +//// /** +//// * @typedef {Object} SomeType +//// * @property {string} prop1 +//// */ + +//// /** @type {SomeType} */ +//// const a/*1*/ = { +//// prop1: 'value', +//// } + +//// /** +//// * @typedef {Object} SomeType2/*2*/ +//// * @property {number} prop2 +//// * @property {SomeType} prop3 +//// */ + +//// /** @type {SomeType[]} */ +//// const ss = [{ prop1: 'value' }, { prop1: 'value' }]; +//// const d = ss.map((s/*3*/) => s.prop1); + +// expando + +//// /** @param {SomeType} a +//// * @returns {SomeType} +//// */ +//// function someFun/*4*/(a) { +//// return a; +//// } +//// someFun.what = 'what'; + +//// class SomeClass/*5*/ { +//// /** @type {SomeType2} */ +//// b; +//// } + +verify.baselineQuickInfo({ + 1: [0, 1], + 2: [0, 1], + 3: [0, 1], + 4: [0, 1], + 5: [0, 1, 2], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityLibType.ts b/tests/cases/fourslash/quickinfoVerbosityLibType.ts new file mode 100644 index 0000000000000..c6f5ee46d0599 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityLibType.ts @@ -0,0 +1,21 @@ +/// + +//// interface Apple { +//// color: string; +//// size: number; +//// } + +//// function f(): Promise { +//// return Promise.resolve({ color: "red", size: 5 }); +//// } + +//// const g/*g*/ = f; +//// const u/*u*/: Map = new Map; + +//// type Foo = Promise/*p*/; + +verify.baselineQuickInfo({ + "g": [0, 1], + "u": [0, 1], + "p": [0], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityMappedType.ts b/tests/cases/fourslash/quickinfoVerbosityMappedType.ts new file mode 100644 index 0000000000000..e6b3588445412 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityMappedType.ts @@ -0,0 +1,20 @@ +/// + +//// type Apple = boolean | number; +//// type Orange = string | boolean; +//// type F = { +//// [K in keyof T as T[K] extends Apple ? never : K]: T[K]; +//// } +//// type Bar = { +//// banana: string; +//// apple: boolean; +//// } +//// const x/*x*/: F/*F*/ = { banana: 'hello' }; +//// const y/*y*/: { [K in keyof Bar]?: Bar[K] } = { banana: 'hello' }; +//// type G = { +//// [K in keyof T]: T[K] & Apple +//// }; +//// const z: G/*G*/ = { banana: 'hello', apple: true }; + + +verify.baselineQuickInfo({ "x": [0, 1], "y": [0], "F": [0, 1], "G": [0, 1] }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityNamespace.ts b/tests/cases/fourslash/quickinfoVerbosityNamespace.ts new file mode 100644 index 0000000000000..1927a3c8e4ba6 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityNamespace.ts @@ -0,0 +1,64 @@ +/// + +// @filename: /1.ts +//// export {}; +//// class Foo { +//// y: string; +//// } +//// namespace Foo/*1*/ { +//// export var y: number = 1; +//// export var x: string = "hello"; +//// export var w = "world"; +//// var z = 2; +//// } + +// @filename: /2.ts +//// export namespace Foo { +//// export var y: number = 1; +//// export var x: string = "hello"; +//// } + +// @filename: /3.ts +//// import * as Foo_1 from "./b"; +//// export declare namespace ns/*2*/ { +//// import Foo = Foo_1.Foo; +//// export { Foo }; +//// export const c: number; +//// export const d = 1; +//// let e: Apple; +//// export let f: Apple; +//// } +//// interface Apple { +//// a: string; +//// } + +// @filename: /4.ts +//// class Foo { +//// y!: T; +//// } +//// namespace Two/*3*/ { +//// export const f = new Foo(); +//// } + +// @filename: /5.ts +//// namespace Two { +//// export const g = new Foo(); +//// } + +// @filename: /6.ts +//// namespace OnlyLocal/*4*/ { +//// const bar: number; +//// } + +// @filename: foo.ts +//// export function foo() { return "foo"; } +//// import("/*5*/./foo") +//// var x = import("./foo") + +verify.baselineQuickInfo({ + 1: [0, 1], + 2: [0, 1, 2], + 3: [0, 1, 2], + 4: [0, 1], + 5: [0, 1], +}) diff --git a/tests/cases/fourslash/quickinfoVerbosityObjectType1.ts b/tests/cases/fourslash/quickinfoVerbosityObjectType1.ts new file mode 100644 index 0000000000000..d255f61622014 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityObjectType1.ts @@ -0,0 +1,13 @@ +/// + + +//// type Str = string | {}; +//// type FooType = Str | number; +//// type Sym = symbol | (() => void); +//// type BarType = Sym | boolean; +//// type Obj = { foo: FooType, bar: BarType, str: Str }; +//// const obj1/*o1*/: Obj = { foo: 1, bar: true, str: "3"}; +//// const obj2/*o2*/: { foo: FooType, bar: BarType, str: Str } = { foo: 1, bar: true, str: "3"}; + + +verify.baselineQuickInfo({ "o1": [0, 1, 2, 3], "o2": [0, 1, 2] }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts b/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts new file mode 100644 index 0000000000000..8bd4d17edb297 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityRecursiveType.ts @@ -0,0 +1,34 @@ +/// + +//// type Node/*N*/ = { +//// value: T; +//// left: Node | undefined; +//// right: Node | undefined; +//// } +//// const n/*n*/: Node = { +//// value: 1, +//// left: undefined, +//// right: undefined, +//// } +//// interface Orange { +//// name: string; +//// } +//// type TreeNode/*t*/ = { +//// value: T; +//// left: TreeNode | undefined; +//// right: TreeNode | undefined; +//// orange?: Orange; +//// } +//// const m/*m*/: TreeNode = { +//// value: 1, +//// left: undefined, +//// right: undefined, +//// orange: { name: "orange" }, +//// } + +verify.baselineQuickInfo({ + "N": [0], + "n": [0, 1], + "t": [0, 1], + "m": [0, 1, 2], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityToplevelTruncation.ts b/tests/cases/fourslash/quickinfoVerbosityToplevelTruncation.ts new file mode 100644 index 0000000000000..43b48b7ccb680 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityToplevelTruncation.ts @@ -0,0 +1,57 @@ +/// + +//// export enum LargeEnum/*1*/ { +//// Member1, +//// Member2, +//// Member3, +//// Member4, +//// Member5, +//// Member6, +//// Member7, +//// Member8, +//// Member9, +//// Member10, +//// Member11, +//// Member12, +//// Member13, +//// Member14, +//// Member15, +//// Member16, +//// Member17, +//// Member18, +//// Member19, +//// Member20, +//// Member21, +//// Member22, +//// Member23, +//// Member24, +//// Member25, +//// } + +//// export interface LargeInterface/*2*/ { +//// property1: string; +//// property2: number; +//// property3: boolean; +//// property4: Date; +//// property5: string[]; +//// property6: number[]; +//// property7: boolean[]; +//// property8: { [key: string]: unknown }; +//// property9: string | null; +//// property10: number | null; +//// property11: boolean | null; +//// property12: Date | null; +//// property13: string | number; +//// property14: number | boolean; +//// property15: string | boolean; +//// property16: Array<{ id: number; name: string }>; +//// property17: Array<{ key: string; value: unknown }>; +//// property18: { nestedProp1: string; nestedProp2: number }; +//// property19: { nestedProp3: boolean; nestedProp4: Date }; +//// property20: () => void; +//// } + +verify.baselineQuickInfo({ + 1: [1], + 2: [1], +}) \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityTruncation.ts b/tests/cases/fourslash/quickinfoVerbosityTruncation.ts new file mode 100644 index 0000000000000..8c11276edb8be --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityTruncation.ts @@ -0,0 +1,31 @@ +/// + +//// type Str = string | {}; +//// type FooType = Str | number; +//// type Sym = symbol | (() => void); +//// type BarType = Sym | boolean; + +//// interface LotsOfProps { +//// someLongPropertyName1: Str; +//// someLongPropertyName2: FooType; +//// someLongPropertyName3: Sym; +//// someLongPropertyName4: BarType; +//// someLongPropertyName5: Str; +//// someLongPropertyName6: FooType; +//// someLongPropertyName7: Sym; +//// someLongPropertyName8: BarType; +//// someLongMethodName1(a: FooType, b: BarType): Sym; +//// someLongPropertyName9: Str; +//// someLongPropertyName10: FooType; +//// someLongPropertyName11: Sym; +//// someLongPropertyName12: BarType; +//// someLongPropertyName13: Str; +//// someLongPropertyName14: FooType; +//// someLongPropertyName15: Sym; +//// someLongPropertyName16: BarType; +//// someLongMethodName2(a: FooType, b: BarType): Sym; +//// } +//// const obj1/*o1*/: LotsOfProps = undefined as any as LotsOfProps; + + +verify.baselineQuickInfo({ "o1": [0, 1], }); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityTuple.ts b/tests/cases/fourslash/quickinfoVerbosityTuple.ts new file mode 100644 index 0000000000000..163dc4f0afa72 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityTuple.ts @@ -0,0 +1,28 @@ +/// + +//// interface Orange { +//// color: string; +//// } +//// interface Apple { +//// color: string; +//// other: Orange; +//// } +//// type TwoFruits/*T*/ = [Orange, Apple]; +//// const tf/*f*/: TwoFruits = [ +//// { color: "orange" }, +//// { color: "red", other: { color: "orange" } } +//// ]; +//// const tf2/*f2*/: [Orange, Apple] = [ +//// { color: "orange" }, +//// { color: "red", other: { color: "orange" } } +//// ]; +//// type ManyFruits/*m*/ = (Orange | Apple)[]; +//// const mf/*mf*/: ManyFruits = []; + +verify.baselineQuickInfo({ + "T": [0, 1, 2], + "f": [0, 1, 2, 3], + "f2": [0, 1, 2], + "m": [0, 1, 2], + "mf": [0, 1, 2, 3], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts b/tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts new file mode 100644 index 0000000000000..dccf12badf757 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityTypeParameter.ts @@ -0,0 +1,16 @@ +/// + +//// type Str = string | {}; +//// type FooType = Str | number; +//// function fn(x: T) { +//// x/*x*/; +//// } +//// const y/*y*/: (x: T) => void = fn; +//// type MixinCtor = new () => A/*a*/ & { constructor: MixinCtor }; + + +verify.baselineQuickInfo({ + "x": [0, 1, 2], + "y": [0, 1, 2], + "a": [0], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickinfoVerbosityTypeof.ts b/tests/cases/fourslash/quickinfoVerbosityTypeof.ts new file mode 100644 index 0000000000000..76d79ab34d1e3 --- /dev/null +++ b/tests/cases/fourslash/quickinfoVerbosityTypeof.ts @@ -0,0 +1,23 @@ +/// + +//// interface Apple { +//// color: string; +//// weight: number; +//// } + +//// const a: Apple = { color: "red", weight: 150 }; +//// const b/*b*/: typeof a = { color: "green", weight: 120 }; + +//// class Banana { +//// length: number; +//// constructor(length: number) { +//// this.length = length; +//// } +//// } + +//// const c/*c*/: typeof Banana = Banana; + +verify.baselineQuickInfo({ + b: [0, 1], + c: [0, 1], +}); \ No newline at end of file diff --git a/tests/cases/fourslash/server/quickinfoVerbosityServer.ts b/tests/cases/fourslash/server/quickinfoVerbosityServer.ts new file mode 100644 index 0000000000000..9fc9eeb7082e1 --- /dev/null +++ b/tests/cases/fourslash/server/quickinfoVerbosityServer.ts @@ -0,0 +1,6 @@ +/// + +//// type FooType = string | number +//// const foo/*a*/: FooType = 1 + +verify.baselineQuickInfo({ "a": [0, 1] }); \ No newline at end of file