mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add configurable maximum hover length (#61662)
This commit is contained in:
+45
-25
@@ -1719,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, verbosityLevel, out) => {
|
||||
return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer, verbosityLevel, out);
|
||||
writeSignature: (signature, enclosingDeclaration, flags, kind, writer, maximumLength, verbosityLevel, out) => {
|
||||
return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer, maximumLength, verbosityLevel, out);
|
||||
},
|
||||
writeType: (type, enclosingDeclaration, flags, writer, verbosityLevel, out) => {
|
||||
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer, verbosityLevel, out);
|
||||
writeType: (type, enclosingDeclaration, flags, writer, maximumLength, verbosityLevel, out) => {
|
||||
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer, maximumLength, verbosityLevel, out);
|
||||
},
|
||||
writeSymbol: (symbol, enclosingDeclaration, meaning, flags, writer) => {
|
||||
return symbolToString(symbol, getParseTreeNode(enclosingDeclaration), meaning, flags, writer);
|
||||
@@ -6047,7 +6047,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
}
|
||||
|
||||
function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags = TypeFormatFlags.None, kind?: SignatureKind, writer?: EmitTextWriter, verbosityLevel?: number, out?: WriterContextOut): string {
|
||||
function signatureToString(
|
||||
signature: Signature,
|
||||
enclosingDeclaration?: Node,
|
||||
flags = TypeFormatFlags.None,
|
||||
kind?: SignatureKind,
|
||||
writer?: EmitTextWriter,
|
||||
maximumLength?: number,
|
||||
verbosityLevel?: number,
|
||||
out?: WriterContextOut,
|
||||
): string {
|
||||
return writer ? signatureToStringWorker(writer).getText() : usingSingleLineStringWriter(signatureToStringWorker);
|
||||
|
||||
function signatureToStringWorker(writer: EmitTextWriter) {
|
||||
@@ -6065,6 +6074,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.WriteTypeParametersInQualifiedName,
|
||||
/*internalFlags*/ undefined,
|
||||
/*tracker*/ undefined,
|
||||
maximumLength,
|
||||
verbosityLevel,
|
||||
out,
|
||||
);
|
||||
@@ -6080,6 +6090,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
enclosingDeclaration?: Node,
|
||||
flags: TypeFormatFlags = TypeFormatFlags.AllowUniqueESSymbolType | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope,
|
||||
writer: EmitTextWriter = createTextWriter(""),
|
||||
maximumLength?: number,
|
||||
verbosityLevel?: number,
|
||||
out?: WriterContextOut,
|
||||
): string {
|
||||
@@ -6091,6 +6102,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | (noTruncation ? NodeBuilderFlags.NoTruncation : 0),
|
||||
/*internalFlags*/ undefined,
|
||||
/*tracker*/ undefined,
|
||||
maximumLength,
|
||||
verbosityLevel,
|
||||
out,
|
||||
);
|
||||
@@ -6102,7 +6114,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
printer.writeNode(EmitHint.Unspecified, typeNode, /*sourceFile*/ sourceFile, writer);
|
||||
const result = writer.getText();
|
||||
|
||||
const maxLength = noTruncation ? noTruncationMaximumTruncationLength * 2 : defaultMaximumTruncationLength * 2;
|
||||
const maxLength = maximumLength || (noTruncation ? noTruncationMaximumTruncationLength * 2 : defaultMaximumTruncationLength * 2);
|
||||
if (maxLength && result && result.length >= maxLength) {
|
||||
return result.substr(0, maxLength - "...".length) + "...";
|
||||
}
|
||||
@@ -6314,20 +6326,20 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
};
|
||||
return {
|
||||
syntacticBuilderResolver,
|
||||
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)),
|
||||
typeToTypeNode: (type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker, maximumLength?: number, verbosityLevel?: number, out?: WriterContextOut) => withContext(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, context => typeToTypeNodeHelper(type, context), out),
|
||||
typePredicateToTypePredicateNode: (typePredicate: TypePredicate, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*maximumLength*/ undefined, /*verbosityLevel*/ undefined, context => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
||||
serializeTypeForDeclaration: (declaration: HasInferredType, symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*maximumLength*/ undefined, /*verbosityLevel*/ undefined, context => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol, context)),
|
||||
serializeReturnTypeForSignature: (signature: SignatureDeclaration, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*maximumLength*/ undefined, /*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, /*maximumLength*/ undefined, /*verbosityLevel*/ undefined, context => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)),
|
||||
indexInfoToIndexSignatureDeclaration: (indexInfo: IndexInfo, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*maximumLength*/ undefined, /*verbosityLevel*/ undefined, context => indexInfoToIndexSignatureDeclarationHelper(indexInfo, context, /*typeNode*/ undefined)),
|
||||
signatureToSignatureDeclaration: (signature: Signature, kind: SignatureDeclaration["kind"], enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker, maximumLength?: number, verbosityLevel?: number, out?: WriterContextOut) => withContext(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, 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, /*maximumLength*/ undefined, /*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, /*maximumLength*/ undefined, /*verbosityLevel*/ undefined, context => symbolToExpression(symbol, context, meaning)),
|
||||
symbolToTypeParameterDeclarations: (symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*maximumLength*/ undefined, /*verbosityLevel*/ undefined, context => typeParametersToTypeParameterDeclarations(symbol, context)),
|
||||
symbolToParameterDeclaration: (symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*maximumLength*/ undefined, /*verbosityLevel*/ undefined, context => symbolToParameterDeclaration(symbol, context)),
|
||||
typeParameterToDeclaration: (parameter: TypeParameter, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker, maximumLength?: number, verbosityLevel?: number, out?: WriterContextOut) => withContext(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, context => typeParameterToDeclaration(parameter, context), out),
|
||||
symbolTableToDeclarationStatements: (symbolTable: SymbolTable, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*maximumLength*/ undefined, /*verbosityLevel*/ undefined, context => symbolTableToDeclarationStatements(symbolTable, context)),
|
||||
symbolToNode: (symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, /*maximumLength*/ undefined, /*verbosityLevel*/ undefined, context => symbolToNode(symbol, context, meaning)),
|
||||
symbolToDeclarations,
|
||||
};
|
||||
|
||||
@@ -6388,12 +6400,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return symbolToExpression(symbol, context, meaning);
|
||||
}
|
||||
|
||||
function symbolToDeclarations(symbol: Symbol, meaning: SymbolFlags, flags: NodeBuilderFlags, verbosityLevel?: number, out?: WriterContextOut): Declaration[] {
|
||||
function symbolToDeclarations(symbol: Symbol, meaning: SymbolFlags, flags: NodeBuilderFlags, maximumLength?: number, verbosityLevel?: number, out?: WriterContextOut): Declaration[] {
|
||||
const nodes = withContext(
|
||||
/*enclosingDeclaration*/ undefined,
|
||||
flags,
|
||||
/*internalFlags*/ undefined,
|
||||
/*tracker*/ undefined,
|
||||
maximumLength,
|
||||
verbosityLevel,
|
||||
context => symbolToDeclarationsWorker(symbol, context),
|
||||
out,
|
||||
@@ -6463,6 +6476,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
flags: NodeBuilderFlags | undefined,
|
||||
internalFlags: InternalNodeBuilderFlags | undefined,
|
||||
tracker: SymbolTracker | undefined,
|
||||
maximumLength: number | undefined,
|
||||
verbosityLevel: number | undefined,
|
||||
cb: (context: NodeBuilderContext) => T,
|
||||
out?: WriterContextOut,
|
||||
@@ -6470,12 +6484,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const moduleResolverHost = tracker?.trackSymbol ? tracker.moduleResolverHost :
|
||||
(internalFlags || InternalNodeBuilderFlags.None) & InternalNodeBuilderFlags.DoNotIncludeSymbolChain ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) :
|
||||
undefined;
|
||||
flags = flags || NodeBuilderFlags.None;
|
||||
const maxTruncationLength = maximumLength ||
|
||||
(flags & NodeBuilderFlags.NoTruncation ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
||||
const context: NodeBuilderContext = {
|
||||
enclosingDeclaration,
|
||||
enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
|
||||
flags: flags || NodeBuilderFlags.None,
|
||||
flags,
|
||||
internalFlags: internalFlags || InternalNodeBuilderFlags.None,
|
||||
tracker: undefined!,
|
||||
maxTruncationLength,
|
||||
maxExpansionDepth: verbosityLevel ?? -1,
|
||||
encounteredError: false,
|
||||
suppressReportInferenceFallback: false,
|
||||
@@ -6552,7 +6570,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
|
||||
function checkTruncationLength(context: NodeBuilderContext): boolean {
|
||||
if (context.truncating) return context.truncating;
|
||||
return context.truncating = context.approximateLength > ((context.flags & NodeBuilderFlags.NoTruncation) ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
||||
return context.truncating = context.approximateLength > context.maxTruncationLength;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51034,8 +51052,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
}
|
||||
},
|
||||
symbolToDeclarations: (symbol, meaning, flags, verbosityLevel, out) => {
|
||||
return nodeBuilder.symbolToDeclarations(symbol, meaning, flags, verbosityLevel, out);
|
||||
symbolToDeclarations: (symbol, meaning, flags, maximumLength, verbosityLevel, out) => {
|
||||
return nodeBuilder.symbolToDeclarations(symbol, meaning, flags, maximumLength, verbosityLevel, out);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -53373,6 +53391,8 @@ interface NodeBuilderContext extends SyntacticTypeNodeBuilderContext {
|
||||
tracker: SymbolTrackerImpl;
|
||||
/* Maximum depth we're allowed to expand names. */
|
||||
readonly maxExpansionDepth: number;
|
||||
/* Maximum length before we truncate the output. */
|
||||
readonly maxTruncationLength: number;
|
||||
|
||||
// State
|
||||
encounteredError: boolean;
|
||||
|
||||
+36
-4
@@ -5143,7 +5143,16 @@ 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
|
||||
/** @internal */ typeParameterToDeclaration(
|
||||
parameter: TypeParameter,
|
||||
enclosingDeclaration: Node | undefined,
|
||||
flags: NodeBuilderFlags | undefined,
|
||||
internalFlags?: InternalNodeBuilderFlags,
|
||||
tracker?: SymbolTracker,
|
||||
maximumLength?: number,
|
||||
verbosityLevel?: number,
|
||||
out?: WriterContextOut, // eslint-disable-line @typescript-eslint/unified-signatures
|
||||
): TypeParameterDeclaration | undefined;
|
||||
|
||||
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
||||
getSymbolAtLocation(node: Node): Symbol | undefined;
|
||||
@@ -5175,8 +5184,25 @@ 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, verbosityLevel?: number, out?: WriterContextOut): string;
|
||||
/** @internal */ writeType(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter, verbosityLevel?: number, out?: WriterContextOut): string;
|
||||
/** @internal */ writeSignature(
|
||||
signature: Signature,
|
||||
enclosingDeclaration?: Node,
|
||||
flags?: TypeFormatFlags,
|
||||
kind?: SignatureKind,
|
||||
writer?: EmitTextWriter,
|
||||
maximumLength?: number,
|
||||
verbosityLevel?: number,
|
||||
out?: WriterContextOut,
|
||||
): string;
|
||||
/** @internal */ writeType(
|
||||
type: Type,
|
||||
enclosingDeclaration?: Node,
|
||||
flags?: TypeFormatFlags,
|
||||
writer?: EmitTextWriter,
|
||||
maximumLength?: number,
|
||||
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;
|
||||
|
||||
@@ -5896,7 +5922,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[];
|
||||
symbolToDeclarations(symbol: Symbol, meaning: SymbolFlags, flags: NodeBuilderFlags, maximumLength?: number, verbosityLevel?: number, out?: WriterContextOut): Declaration[];
|
||||
}
|
||||
|
||||
// dprint-ignore
|
||||
@@ -10517,6 +10543,12 @@ export interface UserPreferences {
|
||||
readonly displayPartsForJSDoc?: boolean;
|
||||
readonly generateReturnInDocTemplate?: boolean;
|
||||
readonly disableLineTextInReferences?: boolean;
|
||||
/**
|
||||
* A positive integer indicating the maximum length of a hover text before it is truncated.
|
||||
*
|
||||
* Default: `500`
|
||||
*/
|
||||
readonly maximumHoverLength?: number;
|
||||
}
|
||||
|
||||
export type OrganizeImportsTypeOrder = "last" | "inline" | "first";
|
||||
|
||||
@@ -614,6 +614,8 @@ export const externalHelpersModuleNameText = "tslib";
|
||||
export const defaultMaximumTruncationLength = 160;
|
||||
/** @internal */
|
||||
export const noTruncationMaximumTruncationLength = 1_000_000;
|
||||
/** @internal */
|
||||
export const defaultHoverMaximumTruncationLength = 500;
|
||||
|
||||
/** @internal */
|
||||
export function getDeclarationOfKind<T extends Declaration>(symbol: Symbol, kind: T["kind"]): T | undefined {
|
||||
|
||||
@@ -254,7 +254,7 @@ export class SessionClient implements LanguageService {
|
||||
return { line, character: offset };
|
||||
}
|
||||
|
||||
getQuickInfoAtPosition(fileName: string, position: number, verbosityLevel?: number | undefined): QuickInfo {
|
||||
getQuickInfoAtPosition(fileName: string, position: number, maximumLength?: number, verbosityLevel?: number | undefined): QuickInfo {
|
||||
const args = { ...this.createFileLocationRequestArgs(fileName, position), verbosityLevel };
|
||||
|
||||
const request = this.processRequest<protocol.QuickInfoRequest>(protocol.CommandTypes.Quickinfo, args);
|
||||
|
||||
@@ -2455,11 +2455,16 @@ export class TestState {
|
||||
return result;
|
||||
}
|
||||
|
||||
public baselineQuickInfo(verbosityLevels?: VerbosityLevels): void {
|
||||
public baselineQuickInfo(verbosityLevels?: VerbosityLevels, maximumLength?: number): 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);
|
||||
const item: ts.QuickInfo & { verbosityLevel?: number; } | undefined = this.languageService.getQuickInfoAtPosition(
|
||||
marker.fileName,
|
||||
marker.position,
|
||||
maximumLength,
|
||||
verbosityLevel,
|
||||
);
|
||||
if (item) item.verbosityLevel = verbosityLevel;
|
||||
return {
|
||||
marker: { ...marker, name },
|
||||
|
||||
@@ -449,8 +449,8 @@ export class Verify extends VerifyNegatable {
|
||||
this.state.baselineGetEmitOutput();
|
||||
}
|
||||
|
||||
public baselineQuickInfo(verbosityLevels?: FourSlash.VerbosityLevels): void {
|
||||
this.state.baselineQuickInfo(verbosityLevels);
|
||||
public baselineQuickInfo(verbosityLevels?: FourSlash.VerbosityLevels, maximumLength?: number): void {
|
||||
this.state.baselineQuickInfo(verbosityLevels, maximumLength);
|
||||
}
|
||||
|
||||
public baselineSignatureHelp(): void {
|
||||
|
||||
@@ -2395,12 +2395,18 @@ export class Session<TMessage = string> implements EventSender {
|
||||
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), args.verbosityLevel);
|
||||
const userPreferences = this.getPreferences(file);
|
||||
const quickInfo = project.getLanguageService().getQuickInfoAtPosition(
|
||||
file,
|
||||
this.getPosition(args, scriptInfo),
|
||||
userPreferences.maximumHoverLength,
|
||||
args.verbosityLevel,
|
||||
);
|
||||
if (!quickInfo) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const useDisplayParts = !!this.getPreferences(file).displayPartsForJSDoc;
|
||||
const useDisplayParts = !!userPreferences.displayPartsForJSDoc;
|
||||
if (simplifiedResult) {
|
||||
const displayString = displayPartsToString(quickInfo.displayParts);
|
||||
return {
|
||||
|
||||
@@ -49,6 +49,7 @@ import {
|
||||
Debug,
|
||||
Declaration,
|
||||
deduplicate,
|
||||
defaultHoverMaximumTruncationLength,
|
||||
DefinitionInfo,
|
||||
DefinitionInfoAndBoundSpan,
|
||||
Diagnostic,
|
||||
@@ -2274,7 +2275,7 @@ export function createLanguageService(
|
||||
return Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name, source }, host, preferences);
|
||||
}
|
||||
|
||||
function getQuickInfoAtPosition(fileName: string, position: number, verbosityLevel?: number): QuickInfo | undefined {
|
||||
function getQuickInfoAtPosition(fileName: string, position: number, maximumLength?: number, verbosityLevel?: number): QuickInfo | undefined {
|
||||
synchronizeHostData();
|
||||
|
||||
const sourceFile = getValidSourceFile(fileName);
|
||||
@@ -2310,6 +2311,7 @@ export function createLanguageService(
|
||||
nodeForQuickInfo,
|
||||
/*semanticMeaning*/ undefined,
|
||||
/*alias*/ undefined,
|
||||
maximumLength ?? defaultHoverMaximumTruncationLength,
|
||||
verbosityLevel,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -266,6 +266,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
||||
type: Type | undefined,
|
||||
semanticMeaning: SemanticMeaning,
|
||||
alias?: Symbol,
|
||||
maximumLength?: number,
|
||||
verbosityLevel?: number,
|
||||
): SymbolDisplayPartsDocumentationAndSymbolKind {
|
||||
const displayParts: SymbolDisplayPart[] = [];
|
||||
@@ -495,6 +496,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
||||
location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol),
|
||||
enclosingDeclaration,
|
||||
TypeFormatFlags.InTypeAlias,
|
||||
maximumLength,
|
||||
verbosityLevel,
|
||||
typeWriterOut,
|
||||
),
|
||||
@@ -602,6 +604,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
||||
type,
|
||||
semanticMeaning,
|
||||
shouldUseAliasName ? symbol : resolvedSymbol,
|
||||
maximumLength,
|
||||
verbosityLevel,
|
||||
);
|
||||
displayParts.push(...resolvedInfo.displayParts);
|
||||
@@ -700,11 +703,12 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
||||
symbolDisplayNodeBuilderFlags,
|
||||
/*internalFlags*/ undefined,
|
||||
/*tracker*/ undefined,
|
||||
maximumLength,
|
||||
verbosityLevel,
|
||||
typeWriterOut,
|
||||
)!;
|
||||
getPrinter().writeNode(EmitHint.Unspecified, param, getSourceFileOfNode(getParseTreeNode(enclosingDeclaration)), writer);
|
||||
});
|
||||
}, maximumLength);
|
||||
addRange(displayParts, typeParameterParts);
|
||||
}
|
||||
else {
|
||||
@@ -715,6 +719,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
||||
type,
|
||||
enclosingDeclaration,
|
||||
/*flags*/ undefined,
|
||||
maximumLength,
|
||||
verbosityLevel,
|
||||
typeWriterOut,
|
||||
),
|
||||
@@ -889,6 +894,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
||||
symbol,
|
||||
symbolMeaning,
|
||||
TypeFormatFlags.MultilineObjectLiterals | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope,
|
||||
maximumLength,
|
||||
verbosityLevel !== undefined ? verbosityLevel - 1 : undefined,
|
||||
typeWriterOut,
|
||||
);
|
||||
@@ -898,7 +904,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
||||
if (i > 0) writer.writeLine();
|
||||
printer.writeNode(EmitHint.Unspecified, node, sourceFile, writer);
|
||||
});
|
||||
});
|
||||
}, maximumLength);
|
||||
addRange(displayParts, expandedDisplayParts);
|
||||
symbolWasExpanded = true;
|
||||
return true;
|
||||
@@ -973,7 +979,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
||||
}
|
||||
|
||||
function addSignatureDisplayParts(signature: Signature, allSignatures: readonly Signature[], flags = TypeFormatFlags.None) {
|
||||
addRange(displayParts, signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | TypeFormatFlags.WriteTypeArgumentsOfSignature, verbosityLevel, typeWriterOut));
|
||||
addRange(displayParts, signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | TypeFormatFlags.WriteTypeArgumentsOfSignature, maximumLength, verbosityLevel, typeWriterOut));
|
||||
if (allSignatures.length > 1) {
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
@@ -1011,9 +1017,21 @@ export function getSymbolDisplayPartsDocumentationAndSymbolKind(
|
||||
location: Node,
|
||||
semanticMeaning: SemanticMeaning = getMeaningFromLocation(location),
|
||||
alias?: Symbol,
|
||||
maximumLength?: number,
|
||||
verbosityLevel?: number,
|
||||
): SymbolDisplayPartsDocumentationAndSymbolKind {
|
||||
return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, /*type*/ undefined, semanticMeaning, alias, verbosityLevel);
|
||||
return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
||||
typeChecker,
|
||||
symbol,
|
||||
sourceFile,
|
||||
enclosingDeclaration,
|
||||
location,
|
||||
/*type*/ undefined,
|
||||
semanticMeaning,
|
||||
alias,
|
||||
maximumLength,
|
||||
verbosityLevel,
|
||||
);
|
||||
}
|
||||
|
||||
function isLocalVariableOrFunction(symbol: Symbol) {
|
||||
|
||||
@@ -581,10 +581,11 @@ export interface LanguageService {
|
||||
*
|
||||
* @param fileName The path to the file
|
||||
* @param position A zero-based index of the character where you want the quick info
|
||||
* @param maximumLength Maximum length of a quickinfo text before it is truncated.
|
||||
*/
|
||||
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo | undefined;
|
||||
getQuickInfoAtPosition(fileName: string, position: number, maximumLength?: number): QuickInfo | undefined;
|
||||
/** @internal */
|
||||
getQuickInfoAtPosition(fileName: string, position: number, verbosityLevel: number | undefined): QuickInfo | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
|
||||
getQuickInfoAtPosition(fileName: string, position: number, maximumLength: number | undefined, verbosityLevel: number | undefined): QuickInfo | undefined;
|
||||
|
||||
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan | undefined;
|
||||
|
||||
|
||||
+35
-10
@@ -2761,9 +2761,17 @@ export function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean {
|
||||
return !!findAncestor(declaration, n => isParameter(n) ? true : isBindingElement(n) || isObjectBindingPattern(n) || isArrayBindingPattern(n) ? false : "quit");
|
||||
}
|
||||
|
||||
const displayPartWriter = getDisplayPartWriter();
|
||||
function getDisplayPartWriter(): DisplayPartsSymbolWriter {
|
||||
const absoluteMaximumLength = defaultMaximumTruncationLength * 10; // A hard cutoff to avoid overloading the messaging channel in worst-case scenarios
|
||||
const displayPartWriterCache = new Map<number, DisplayPartsSymbolWriter>();
|
||||
function getDisplayPartWriter(maximumLength: number | undefined): DisplayPartsSymbolWriter {
|
||||
maximumLength = maximumLength || defaultMaximumTruncationLength;
|
||||
if (!displayPartWriterCache.has(maximumLength)) {
|
||||
displayPartWriterCache.set(maximumLength, getDisplayPartWriterWorker(maximumLength));
|
||||
}
|
||||
return displayPartWriterCache.get(maximumLength)!;
|
||||
}
|
||||
|
||||
function getDisplayPartWriterWorker(maximumLength: number): DisplayPartsSymbolWriter {
|
||||
const absoluteMaximumLength = maximumLength * 10; // A hard cutoff to avoid overloading the messaging channel in worst-case scenarios
|
||||
let displayParts: SymbolDisplayPart[];
|
||||
let lineStart: boolean;
|
||||
let indent: number;
|
||||
@@ -3036,7 +3044,8 @@ export function lineBreakPart(): SymbolDisplayPart {
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[] {
|
||||
export function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void, maximumLength?: number): SymbolDisplayPart[] {
|
||||
const displayPartWriter = getDisplayPartWriter(maximumLength);
|
||||
try {
|
||||
writeDisplayParts(displayPartWriter);
|
||||
return displayPartWriter.displayParts();
|
||||
@@ -3047,10 +3056,18 @@ export function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbol
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.None, verbosityLevel?: number, out?: WriterContextOut): SymbolDisplayPart[] {
|
||||
export function typeToDisplayParts(
|
||||
typechecker: TypeChecker,
|
||||
type: Type,
|
||||
enclosingDeclaration?: Node,
|
||||
flags: TypeFormatFlags = TypeFormatFlags.None,
|
||||
maximumLength?: number,
|
||||
verbosityLevel?: number,
|
||||
out?: WriterContextOut,
|
||||
): SymbolDisplayPart[] {
|
||||
return mapToDisplayParts(writer => {
|
||||
typechecker.writeType(type, enclosingDeclaration, flags | TypeFormatFlags.MultilineObjectLiterals | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, writer, verbosityLevel, out);
|
||||
});
|
||||
typechecker.writeType(type, enclosingDeclaration, flags | TypeFormatFlags.MultilineObjectLiterals | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, writer, maximumLength, verbosityLevel, out);
|
||||
}, maximumLength);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
@@ -3061,11 +3078,19 @@ export function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, e
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.None, verbosityLevel?: number, out?: WriterContextOut): SymbolDisplayPart[] {
|
||||
export function signatureToDisplayParts(
|
||||
typechecker: TypeChecker,
|
||||
signature: Signature,
|
||||
enclosingDeclaration?: Node,
|
||||
flags: TypeFormatFlags = TypeFormatFlags.None,
|
||||
maximumLength?: number,
|
||||
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, verbosityLevel, out);
|
||||
});
|
||||
typechecker.writeSignature(signature, enclosingDeclaration, flags, /*kind*/ undefined, writer, maximumLength, verbosityLevel, out);
|
||||
}, maximumLength);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
||||
+8
-1
@@ -8406,6 +8406,12 @@ declare namespace ts {
|
||||
readonly displayPartsForJSDoc?: boolean;
|
||||
readonly generateReturnInDocTemplate?: boolean;
|
||||
readonly disableLineTextInReferences?: boolean;
|
||||
/**
|
||||
* A positive integer indicating the maximum length of a hover text before it is truncated.
|
||||
*
|
||||
* Default: `500`
|
||||
*/
|
||||
readonly maximumHoverLength?: number;
|
||||
}
|
||||
type OrganizeImportsTypeOrder = "last" | "inline" | "first";
|
||||
/** Represents a bigint literal value without requiring bigint support */
|
||||
@@ -10183,8 +10189,9 @@ declare namespace ts {
|
||||
*
|
||||
* @param fileName The path to the file
|
||||
* @param position A zero-based index of the character where you want the quick info
|
||||
* @param maximumLength Maximum length of a quickinfo text before it is truncated.
|
||||
*/
|
||||
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo | undefined;
|
||||
getQuickInfoAtPosition(fileName: string, position: number, maximumLength?: number): QuickInfo | undefined;
|
||||
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan | undefined;
|
||||
getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan | undefined;
|
||||
getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined;
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
// === QuickInfo ===
|
||||
=== /tests/cases/fourslash/quickinfoVerbosityToplevelTruncation.ts ===
|
||||
=== /tests/cases/fourslash/quickinfoVerbosityToplevelTruncation1.ts ===
|
||||
// export enum LargeEnum {
|
||||
// ^^^^^^^^^
|
||||
// | ----------------------------------------------------------------------
|
||||
@@ -94,7 +94,7 @@
|
||||
[
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickinfoVerbosityToplevelTruncation.ts",
|
||||
"fileName": "/tests/cases/fourslash/quickinfoVerbosityToplevelTruncation1.ts",
|
||||
"position": 21,
|
||||
"name": "1"
|
||||
},
|
||||
@@ -570,7 +570,7 @@
|
||||
},
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickinfoVerbosityToplevelTruncation.ts",
|
||||
"fileName": "/tests/cases/fourslash/quickinfoVerbosityToplevelTruncation1.ts",
|
||||
"position": 398,
|
||||
"name": "2"
|
||||
},
|
||||
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,5 +1,5 @@
|
||||
// === QuickInfo ===
|
||||
=== /tests/cases/fourslash/quickinfoVerbosityTruncation.ts ===
|
||||
=== /tests/cases/fourslash/quickinfoVerbosityTruncation1.ts ===
|
||||
// type Str = string | {};
|
||||
// type FooType = Str | number;
|
||||
// type Sym = symbol | (() => void);
|
||||
@@ -48,7 +48,7 @@
|
||||
[
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickinfoVerbosityTruncation.ts",
|
||||
"fileName": "/tests/cases/fourslash/quickinfoVerbosityTruncation1.ts",
|
||||
"position": 812,
|
||||
"name": "o1"
|
||||
},
|
||||
@@ -92,7 +92,7 @@
|
||||
},
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickinfoVerbosityTruncation.ts",
|
||||
"fileName": "/tests/cases/fourslash/quickinfoVerbosityTruncation1.ts",
|
||||
"position": 812,
|
||||
"name": "o1"
|
||||
},
|
||||
File diff suppressed because it is too large
Load Diff
@@ -361,7 +361,7 @@ declare namespace FourSlashInterface {
|
||||
baselineSyntacticAndSemanticDiagnostics(): void;
|
||||
getEmitOutput(expectedOutputFiles: ReadonlyArray<string>): void;
|
||||
baselineCompletions(preferences?: UserPreferences): void;
|
||||
baselineQuickInfo(verbosityLevels?: VerbosityLevels): void;
|
||||
baselineQuickInfo(verbosityLevels?: VerbosityLevels, maximumLength?: number): void;
|
||||
baselineSmartSelection(): void;
|
||||
baselineSignatureHelp(): void;
|
||||
nameOrDottedNameSpanTextIs(text: string): void;
|
||||
|
||||
@@ -515,7 +515,7 @@
|
||||
goTo.marker("1");
|
||||
verify.quickInfoIs(`type A = keyof Foo`);
|
||||
goTo.marker("2");
|
||||
verify.quickInfoIs(`type Less = "_1" | "_2" | "_3" | "_4" | "_5" | "_6" | "_7" | "_8" | "_9" | "_10" | "_11" | "_12" | "_13" | "_14" | "_15" | "_16" | "_17" | "_18" | "_19" | "_20" | "_21" | "_22" | "_23" | "_24" | "_25" | ... 473 more ... | "_499"`);
|
||||
verify.quickInfoIs(`type Less = "_1" | "_2" | "_3" | "_4" | "_5" | "_6" | "_7" | "_8" | "_9" | "_10" | "_11" | "_12" | "_13" | "_14" | "_15" | "_16" | "_17" | "_18" | "_19" | "_20" | "_21" | "_22" | "_23" | "_24" | "_25" | "_26" | "_27" | "_28" | "_29" | "_30" | "_31" | "_32" | "_33" | "_34" | "_35" | "_36" | "_37" | "_38" | "_39" | "_40" | "_41" | "_42" | "_43" | "_44" | "_45" | "_46" | "_47" | "_48" | "_49" | "_50" | "_51" | "_52" | "_53" | "_54" | "_55" | "_56" | "_57" | "_58" | "_59" | "_60" | "_61" | "_62" | "_63" | "_64" | "_65" | "_66" | "_67" | "_68" | "_69" | "_70" | "_71" | "_72" | "_73" | ... 425 more ... | "_499"`);
|
||||
goTo.marker("3");
|
||||
verify.signatureHelp({
|
||||
marker: "3",
|
||||
@@ -554,11 +554,67 @@ verify.quickInfoIs(`type Decomposed = {
|
||||
_28: 28;
|
||||
_29: 29;
|
||||
_30: 30;
|
||||
... 468 more ...;
|
||||
_31: 31;
|
||||
_32: 32;
|
||||
_33: 33;
|
||||
_34: 34;
|
||||
_35: 35;
|
||||
_36: 36;
|
||||
_37: 37;
|
||||
_38: 38;
|
||||
_39: 39;
|
||||
_40: 40;
|
||||
_41: 41;
|
||||
_42: 42;
|
||||
_43: 43;
|
||||
_44: 44;
|
||||
_45: 45;
|
||||
_46: 46;
|
||||
_47: 47;
|
||||
_48: 48;
|
||||
_49: 49;
|
||||
_50: 50;
|
||||
_51: 51;
|
||||
_52: 52;
|
||||
_53: 53;
|
||||
_54: 54;
|
||||
_55: 55;
|
||||
_56: 56;
|
||||
_57: 57;
|
||||
_58: 58;
|
||||
_59: 59;
|
||||
_60: 60;
|
||||
_61: 61;
|
||||
_62: 62;
|
||||
_63: 63;
|
||||
_64: 64;
|
||||
_65: 65;
|
||||
_66: 66;
|
||||
_67: 67;
|
||||
_68: 68;
|
||||
_69: 69;
|
||||
_70: 70;
|
||||
_71: 71;
|
||||
_72: 72;
|
||||
_73: 73;
|
||||
_74: 74;
|
||||
_75: 75;
|
||||
_76: 76;
|
||||
_77: 77;
|
||||
_78: 78;
|
||||
_79: 79;
|
||||
_80: 80;
|
||||
_81: 81;
|
||||
_82: 82;
|
||||
_83: 83;
|
||||
_84: 84;
|
||||
_85: 85;
|
||||
_86: 86;
|
||||
... 412 more ...;
|
||||
_499: 499;
|
||||
}`);
|
||||
goTo.marker("5");
|
||||
verify.quickInfoIs(`type LongTuple = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17.18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, ... 27 more ..., 70]`);
|
||||
verify.quickInfoIs(`type LongTuple = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17.18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70]`);
|
||||
goTo.marker("6");
|
||||
verify.quickInfoIs(`type DeeplyMapped = {
|
||||
_0: {
|
||||
@@ -570,7 +626,21 @@ verify.quickInfoIs(`type DeeplyMapped = {
|
||||
_5: ["_0", "_5", 0, 5];
|
||||
_6: ["_0", "_6", 0, 6];
|
||||
_7: ["_0", "_7", 0, 7];
|
||||
... 491 more ...;
|
||||
_8: ["_0", "_8", 0, 8];
|
||||
_9: ["_0", "_9", 0, 9];
|
||||
_10: ["_0", "_10", 0, 10];
|
||||
_11: ["_0", "_11", 0, 11];
|
||||
_12: ["_0", "_12", 0, 12];
|
||||
_13: ["_0", "_13", 0, 13];
|
||||
_14: ["_0", "_14", 0, 14];
|
||||
_15: ["_0", "_15", 0, 15];
|
||||
_16: ["_0", "_16", 0, 16];
|
||||
_17: ["_0", "_17", 0, 17];
|
||||
_18: ["_0", "_18", 0, 18];
|
||||
_19: ["_0", "_19", 0, 19];
|
||||
_20: ["_0", "_20", 0, 20];
|
||||
_21: ["_0", "_21", 0, 21];
|
||||
... 477 more ...;
|
||||
_499: [...];
|
||||
};
|
||||
... 498 more ...;
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// 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],
|
||||
}, 160)
|
||||
+1
-1
@@ -28,4 +28,4 @@
|
||||
//// const obj1/*o1*/: LotsOfProps = undefined as any as LotsOfProps;
|
||||
|
||||
|
||||
verify.baselineQuickInfo({ "o1": [0, 1], });
|
||||
verify.baselineQuickInfo({ "o1": [0, 1], }, 160);
|
||||
@@ -0,0 +1,304 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface LargeInterface/*o1*/ {
|
||||
//// prop1: any;
|
||||
//// prop2: any;
|
||||
//// prop3: any;
|
||||
//// prop4: any;
|
||||
//// prop5: any;
|
||||
//// prop6: any;
|
||||
//// prop7: any;
|
||||
//// prop8: any;
|
||||
//// prop9: any;
|
||||
//// prop10: any;
|
||||
//// prop11: any;
|
||||
//// prop12: any;
|
||||
//// prop13: any;
|
||||
//// prop14: any;
|
||||
//// prop15: any;
|
||||
//// prop16: any;
|
||||
//// prop17: any;
|
||||
//// prop18: any;
|
||||
//// prop19: any;
|
||||
//// prop20: any;
|
||||
//// prop21: any;
|
||||
//// prop22: any;
|
||||
//// prop23: any;
|
||||
//// prop24: any;
|
||||
//// prop25: any;
|
||||
//// prop26: any;
|
||||
//// prop27: any;
|
||||
//// prop28: any;
|
||||
//// prop29: any;
|
||||
//// prop30: any;
|
||||
//// prop31: any;
|
||||
//// prop32: any;
|
||||
//// prop33: any;
|
||||
//// prop34: any;
|
||||
//// prop35: any;
|
||||
//// prop36: any;
|
||||
//// prop37: any;
|
||||
//// prop38: any;
|
||||
//// prop39: any;
|
||||
//// prop40: any;
|
||||
//// prop41: any;
|
||||
//// prop42: any;
|
||||
//// prop43: any;
|
||||
//// prop44: any;
|
||||
//// prop45: any;
|
||||
//// prop46: any;
|
||||
//// prop47: any;
|
||||
//// prop48: any;
|
||||
//// prop49: any;
|
||||
//// prop50: any;
|
||||
//// prop51: any;
|
||||
//// prop52: any;
|
||||
//// prop53: any;
|
||||
//// prop54: any;
|
||||
//// prop55: any;
|
||||
//// prop56: any;
|
||||
//// prop57: any;
|
||||
//// prop58: any;
|
||||
//// prop59: any;
|
||||
//// prop60: any;
|
||||
//// prop61: any;
|
||||
//// prop62: any;
|
||||
//// prop63: any;
|
||||
//// prop64: any;
|
||||
//// prop65: any;
|
||||
//// prop66: any;
|
||||
//// prop67: any;
|
||||
//// prop68: any;
|
||||
//// prop69: any;
|
||||
//// prop70: any;
|
||||
//// prop71: any;
|
||||
//// prop72: any;
|
||||
//// prop73: any;
|
||||
//// prop74: any;
|
||||
//// prop75: any;
|
||||
//// prop76: any;
|
||||
//// prop77: any;
|
||||
//// prop78: any;
|
||||
//// prop79: any;
|
||||
//// prop80: any;
|
||||
//// prop81: any;
|
||||
//// prop82: any;
|
||||
//// prop83: any;
|
||||
//// prop84: any;
|
||||
//// prop85: any;
|
||||
//// prop86: any;
|
||||
//// prop87: any;
|
||||
//// prop88: any;
|
||||
//// prop89: any;
|
||||
//// prop90: any;
|
||||
//// prop91: any;
|
||||
//// prop92: any;
|
||||
//// prop93: any;
|
||||
//// prop94: any;
|
||||
//// prop95: any;
|
||||
//// prop96: any;
|
||||
//// prop97: any;
|
||||
//// prop98: any;
|
||||
//// prop99: any;
|
||||
//// prop100: any;
|
||||
//// prop101: any;
|
||||
//// prop102: any;
|
||||
//// prop103: any;
|
||||
//// prop104: any;
|
||||
//// prop105: any;
|
||||
//// prop106: any;
|
||||
//// prop107: any;
|
||||
//// prop108: any;
|
||||
//// prop109: any;
|
||||
//// prop110: any;
|
||||
//// prop111: any;
|
||||
//// prop112: any;
|
||||
//// prop113: any;
|
||||
//// prop114: any;
|
||||
//// prop115: any;
|
||||
//// prop116: any;
|
||||
//// prop117: any;
|
||||
//// prop118: any;
|
||||
//// prop119: any;
|
||||
//// prop120: any;
|
||||
//// prop121: any;
|
||||
//// prop122: any;
|
||||
//// prop123: any;
|
||||
//// prop124: any;
|
||||
//// prop125: any;
|
||||
//// prop126: any;
|
||||
//// prop127: any;
|
||||
//// prop128: any;
|
||||
//// prop129: any;
|
||||
//// prop130: any;
|
||||
//// prop131: any;
|
||||
//// prop132: any;
|
||||
//// prop133: any;
|
||||
//// prop134: any;
|
||||
//// prop135: any;
|
||||
//// prop136: any;
|
||||
//// prop137: any;
|
||||
//// prop138: any;
|
||||
//// prop139: any;
|
||||
//// prop140: any;
|
||||
//// prop141: any;
|
||||
//// prop142: any;
|
||||
//// prop143: any;
|
||||
//// prop144: any;
|
||||
//// prop145: any;
|
||||
//// prop146: any;
|
||||
//// prop147: any;
|
||||
//// prop148: any;
|
||||
//// prop149: any;
|
||||
//// prop150: any;
|
||||
//// prop151: any;
|
||||
//// prop152: any;
|
||||
//// prop153: any;
|
||||
//// prop154: any;
|
||||
//// prop155: any;
|
||||
//// prop156: any;
|
||||
//// prop157: any;
|
||||
//// prop158: any;
|
||||
//// prop159: any;
|
||||
//// prop160: any;
|
||||
//// prop161: any;
|
||||
//// prop162: any;
|
||||
//// prop163: any;
|
||||
//// prop164: any;
|
||||
//// prop165: any;
|
||||
//// prop166: any;
|
||||
//// prop167: any;
|
||||
//// prop168: any;
|
||||
//// prop169: any;
|
||||
//// prop170: any;
|
||||
//// prop171: any;
|
||||
//// prop172: any;
|
||||
//// prop173: any;
|
||||
//// prop174: any;
|
||||
//// prop175: any;
|
||||
//// prop176: any;
|
||||
//// prop177: any;
|
||||
//// prop178: any;
|
||||
//// prop179: any;
|
||||
//// prop180: any;
|
||||
//// prop181: any;
|
||||
//// prop182: any;
|
||||
//// prop183: any;
|
||||
//// prop184: any;
|
||||
//// prop185: any;
|
||||
//// prop186: any;
|
||||
//// prop187: any;
|
||||
//// prop188: any;
|
||||
//// prop189: any;
|
||||
//// prop190: any;
|
||||
//// prop191: any;
|
||||
//// prop192: any;
|
||||
//// prop193: any;
|
||||
//// prop194: any;
|
||||
//// prop195: any;
|
||||
//// prop196: any;
|
||||
//// prop197: any;
|
||||
//// prop198: any;
|
||||
//// prop199: any;
|
||||
//// prop200: any;
|
||||
//// prop201: any;
|
||||
//// prop202: any;
|
||||
//// prop203: any;
|
||||
//// prop204: any;
|
||||
//// prop205: any;
|
||||
//// prop206: any;
|
||||
//// prop207: any;
|
||||
//// prop208: any;
|
||||
//// prop209: any;
|
||||
//// prop210: any;
|
||||
//// prop211: any;
|
||||
//// prop212: any;
|
||||
//// prop213: any;
|
||||
//// prop214: any;
|
||||
//// prop215: any;
|
||||
//// prop216: any;
|
||||
//// prop217: any;
|
||||
//// prop218: any;
|
||||
//// prop219: any;
|
||||
//// prop220: any;
|
||||
//// prop221: any;
|
||||
//// prop222: any;
|
||||
//// prop223: any;
|
||||
//// prop224: any;
|
||||
//// prop225: any;
|
||||
//// prop226: any;
|
||||
//// prop227: any;
|
||||
//// prop228: any;
|
||||
//// prop229: any;
|
||||
//// prop230: any;
|
||||
//// prop231: any;
|
||||
//// prop232: any;
|
||||
//// prop233: any;
|
||||
//// prop234: any;
|
||||
//// prop235: any;
|
||||
//// prop236: any;
|
||||
//// prop237: any;
|
||||
//// prop238: any;
|
||||
//// prop239: any;
|
||||
//// prop240: any;
|
||||
//// prop241: any;
|
||||
//// prop242: any;
|
||||
//// prop243: any;
|
||||
//// prop244: any;
|
||||
//// prop245: any;
|
||||
//// prop246: any;
|
||||
//// prop247: any;
|
||||
//// prop248: any;
|
||||
//// prop249: any;
|
||||
//// prop250: any;
|
||||
//// prop251: any;
|
||||
//// prop252: any;
|
||||
//// prop253: any;
|
||||
//// prop254: any;
|
||||
//// prop255: any;
|
||||
//// prop256: any;
|
||||
//// prop257: any;
|
||||
//// prop258: any;
|
||||
//// prop259: any;
|
||||
//// prop260: any;
|
||||
//// prop261: any;
|
||||
//// prop262: any;
|
||||
//// prop263: any;
|
||||
//// prop264: any;
|
||||
//// prop265: any;
|
||||
//// prop266: any;
|
||||
//// prop267: any;
|
||||
//// prop268: any;
|
||||
//// prop269: any;
|
||||
//// prop270: any;
|
||||
//// prop271: any;
|
||||
//// prop272: any;
|
||||
//// prop273: any;
|
||||
//// prop274: any;
|
||||
//// prop275: any;
|
||||
//// prop276: any;
|
||||
//// prop277: any;
|
||||
//// prop278: any;
|
||||
//// prop279: any;
|
||||
//// prop280: any;
|
||||
//// prop281: any;
|
||||
//// prop282: any;
|
||||
//// prop283: any;
|
||||
//// prop284: any;
|
||||
//// prop285: any;
|
||||
//// prop286: any;
|
||||
//// prop287: any;
|
||||
//// prop288: any;
|
||||
//// prop289: any;
|
||||
//// prop290: any;
|
||||
//// prop291: any;
|
||||
//// prop292: any;
|
||||
//// prop293: any;
|
||||
//// prop294: any;
|
||||
//// prop295: any;
|
||||
//// prop296: any;
|
||||
//// prop297: any;
|
||||
//// prop298: any;
|
||||
//// }
|
||||
|
||||
verify.baselineQuickInfo({ "o1": [0, 1], }, 1_000_000);
|
||||
Reference in New Issue
Block a user