From ce6ed79852538387623af61f619ba1a253cb20ff Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 26 Feb 2024 16:42:52 -0800 Subject: [PATCH 01/74] WIP --- src/compiler/checker.ts | 12 +++- src/compiler/program.ts | 47 ++++++++++++++ src/compiler/types.ts | 1 + src/server/protocol.ts | 54 +++++++++------- src/server/session.ts | 134 +++++++++++++++++++++++++++++++++++++-- src/services/services.ts | 20 ++++++ src/services/types.ts | 10 +++ 7 files changed, 249 insertions(+), 29 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0d12a7f74fdb4..e331563151668 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -46941,7 +46941,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { tracing?.pop(); } - function checkSourceFile(node: SourceFile) { + function checkSourceFile(node: SourceFile) { // >> TODO: change here? tracing?.push(tracing.Phase.Check, "checkSourceFile", { path: node.path }, /*separateBeginAndEnd*/ true); performance.mark("beforeCheck"); checkSourceFileWorker(node); @@ -46994,6 +46994,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { registerForUnusedIdentifiersCheck(node); } + // >> TODO: probably skip for region??? unused would require checking potentially outside region to be sure, otherwise will most likely be wrong? addLazyDiagnostic(() => { // This relies on the results of other lazy diagnostics, so must be computed after them if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) { @@ -47008,6 +47009,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } }); + // >> TODO: region?? this one goes through all statements in file, maybe it's ok if ( compilerOptions.importsNotUsedAsValues === ImportsNotUsedAsValues.Error && !node.isDeclarationFile && @@ -47016,30 +47018,36 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { checkImportsForTypeOnlyConversion(node); } + // >> TODO: skip region?? this one may require checking the whole file to have reliable information if (isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } + // >> TODO: skip region?? unreliable info if (potentialThisCollisions.length) { forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); clear(potentialThisCollisions); } + // >> TODO: skip region?? unreliable info if (potentialNewTargetCollisions.length) { forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); clear(potentialNewTargetCollisions); } + // >> TODO: skip region?? unreliable info if (potentialWeakMapSetCollisions.length) { forEach(potentialWeakMapSetCollisions, checkWeakMapSetCollision); clear(potentialWeakMapSetCollisions); } + // >> TODO: skip region?? unreliable info if (potentialReflectCollisions.length) { forEach(potentialReflectCollisions, checkReflectCollision); clear(potentialReflectCollisions); } + // >> TODO: also don't set this links.flags |= NodeCheckFlags.TypeChecked; } } @@ -47087,7 +47095,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length; - checkSourceFileWithEagerDiagnostics(sourceFile); + checkSourceFileWithEagerDiagnostics(sourceFile); // >> TODO: change this const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index d34984bca506c..202ec98180dba 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -327,6 +327,7 @@ import { WriteFileCallback, WriteFileCallbackData, writeFileEnsuringDirectories, + TextRange, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; @@ -2822,6 +2823,13 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } + function getRegionSemanticDiagnostics(sourceFile: SourceFile, ranges: TextRange[], cancellationToken?: CancellationToken): readonly Diagnostic[] { + return getDiagnosticsHelper( + sourceFile, + (sourceFile, cancellationToken) => getRegionSemanticDiagnosticsForFile(sourceFile, ranges, cancellationToken), + cancellationToken); + } + function getCachedSemanticDiagnostics(sourceFile?: SourceFile): readonly Diagnostic[] | undefined { return sourceFile ? cachedBindAndCheckDiagnosticsForFile.perFile?.get(sourceFile.path) @@ -2890,6 +2898,45 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg ); } + function getRegionSemanticDiagnosticsForFile(sourceFile: SourceFile, ranges: TextRange[], cancellationToken: CancellationToken | undefined): readonly Diagnostic[] { + return filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFileRegion(sourceFile, cancellationToken), options); + // >> TODO: what the hell is `getProgramDiagnostics` doing??? it does something related to directives/comments... + } + + // TODO: similar to `getBindAndCheckDiagnosticsForFileNoCache` + function getBindAndCheckDiagnosticsForFileRegion(sourceFile: SourceFile, ranges: TextRange[], cancellationToken: CancellationToken | undefined): readonly Diagnostic[] { + // >> TODO: we should cache/avoid re-doing the binding diagnostics + return runWithCancellationToken(() => { + if (skipTypeChecking(sourceFile, options, program)) { + return emptyArray; + } + + const typeChecker = getTypeChecker(); + + Debug.assert(!!sourceFile.bindDiagnostics); + + const isJs = sourceFile.scriptKind === ScriptKind.JS || sourceFile.scriptKind === ScriptKind.JSX; + const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options); + const isPlainJs = isPlainJsFile(sourceFile, options.checkJs); + const isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false; + + // By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External + // - plain JS: .js files with no // ts-check and checkJs: undefined + // - check JS: .js files with either // ts-check or checkJs: true + // - external: files that are added by plugins + const includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === ScriptKind.TS || sourceFile.scriptKind === ScriptKind.TSX + || sourceFile.scriptKind === ScriptKind.External || isPlainJs || isCheckJs || sourceFile.scriptKind === ScriptKind.Deferred); + let bindDiagnostics: readonly Diagnostic[] = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; + let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray; + if (isPlainJs) { + bindDiagnostics = filter(bindDiagnostics, d => plainJSErrors.has(d.code)); + checkDiagnostics = filter(checkDiagnostics, d => plainJSErrors.has(d.code)); + } + // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS + return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); + }); + } + function getBindAndCheckDiagnosticsForFile(sourceFile: SourceFile, cancellationToken: CancellationToken | undefined): readonly Diagnostic[] { return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 28061c88e94bb..67132b1f360d2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4731,6 +4731,7 @@ export interface Program extends ScriptReferenceHost { getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; /** The first time this is called, it will return global diagnostics (no location). */ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; + getRegionSemanticDiagnostics(sourceFile: SourceFile, ranges: TextRange[], cancellationToken?: CancellationToken): readonly Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; getConfigFileParsingDiagnostics(): readonly Diagnostic[]; /** @internal */ getSuggestionDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; diff --git a/src/server/protocol.ts b/src/server/protocol.ts index e61c2393f1d14..f43d01e62ec40 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -794,17 +794,7 @@ export interface ApplyCodeActionCommandRequest extends Request { // All we need is the `success` and `message` fields of Response. export interface ApplyCodeActionCommandResponse extends Response {} -export interface FileRangeRequestArgs extends FileRequestArgs { - /** - * The line number for the request (1-based). - */ - startLine: number; - - /** - * The character offset (on the line) for the request (1-based). - */ - startOffset: number; - +export interface FileRangeRequestArgs extends FileRequestArgs, FileRange { /** * Position (can be specified instead of line/offset pair) * @@ -812,16 +802,6 @@ export interface FileRangeRequestArgs extends FileRequestArgs { */ startPosition?: number; - /** - * The line number for the request (1-based). - */ - endLine: number; - - /** - * The character offset (on the line) for the request (1-based). - */ - endOffset: number; - /** * Position (can be specified instead of line/offset pair) * @@ -2780,7 +2760,7 @@ export interface GeterrRequestArgs { * List of file names for which to compute compiler errors. * The files will be checked in list order. */ - files: string[]; + files: (string | FileRangesRequestArgs)[]; /** * Delay in milliseconds to wait before starting to compute @@ -2804,6 +2784,32 @@ export interface GeterrRequest extends Request { arguments: GeterrRequestArgs; } +export interface FileRange { + /** + * The line number for the request (1-based). + */ + startLine: number; + + /** + * The character offset (on the line) for the request (1-based). + */ + startOffset: number; + + /** + * The line number for the request (1-based). + */ + endLine: number; + + /** + * The character offset (on the line) for the request (1-based). + */ + endOffset: number; +} + +export interface FileRangesRequestArgs extends FileRequestArgs { + ranges: FileRange[]; +} + export type RequestCompletedEventName = "requestCompleted"; /** @@ -2901,9 +2907,11 @@ export interface DiagnosticEventBody { * An array of diagnostic information items. */ diagnostics: Diagnostic[]; + + // >> TODO: maybe we need to send back the ranges for a region semantic diagnostic event } -export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag"; +export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag" | "regionSemanticDiag"; /** * Event message for DiagnosticEventKind event types. diff --git a/src/server/session.ts b/src/server/session.ts index dc2efe45ee4f2..28802a4498201 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -39,6 +39,7 @@ import { EmitOutput, equateValues, FileTextChanges, + FileWithRanges, filter, find, FindAllReferences, @@ -1277,6 +1278,12 @@ export class Session implements EventSender { tracing?.pop(); } + private regionSemanticCheck(file: NormalizedPath, project: Project, ranges: TextRange[]) { + tracing?.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails + this.sendDiagnosticsEvent(file, project, project.getLanguageService().getRegionSemanticDiagnostics(file, ranges), "regionSemanticDiag"); + tracing?.pop(); + } + private sendDiagnosticsEvent(file: NormalizedPath, project: Project, diagnostics: readonly Diagnostic[], kind: protocol.DiagnosticEventKind): void { try { this.event({ file, diagnostics: diagnostics.map(diag => formatDiag(file, project, diag)) }, kind); @@ -1287,11 +1294,30 @@ export class Session implements EventSender { } /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ - private updateErrorCheck(next: NextStep, checkList: readonly string[] | readonly PendingErrorCheck[], ms: number, requireOpen = true) { + private updateErrorCheck( + next: NextStep, + checkList: readonly (string | FileWithRanges)[] | readonly PendingErrorCheck[], + ms: number, + requireOpen = true) { Debug.assert(!this.suppressDiagnosticEvents); // Caller's responsibility const seq = this.changeSeq; const followMs = Math.min(ms, 200); + + if (checkList.length === 0) { + return; + } + + const first: string | PendingErrorCheck | FileWithRanges = checkList[0]; + if (isString(first) || (first as FileWithRanges).ranges) { + // checkList is not of pending error checks + const filesWithRanges = (checkList as (string | FileWithRanges)[]).filter(item => !isString(item)); + const files = (checkList as (string | FileWithRanges)[]).filter(isString); + if (filesWithRanges.length) { + return this.updateErrorCheckWithRanges(next, { filesWithRanges, files }, ms, requireOpen); + } + } + // const checkList = let index = 0; const goNext = () => { @@ -1356,6 +1382,91 @@ export class Session implements EventSender { } } + + private updateErrorCheckWithRanges( + next: NextStep, + checkList: { filesWithRanges: (FileWithRanges & { ranges: TextRange[] })[], files: string[] }, + ms: number, + requireOpen: boolean): void { + const seq = this.changeSeq; + const followMs = Math.min(ms, 200); + + const rangesLength = checkList.filesWithRanges.length; + const filesLength = checkList.files.length; + const totalLength = rangesLength + filesLength; + + let index = 0; + const goNext = () => { + index++; + if (totalLength > index) { + next.delay("checkOne", followMs, checkOne); + } + }; + + const checkOne = () => { + if (this.changeSeq !== seq) { + return; + } + + const item: FileWithRanges = + index > rangesLength ? { fileName: checkList.files[index - rangesLength] } : checkList.filesWithRanges[index]; + // Find out project for the file name + const pendingCheck = this.toPendingErrorCheck(item.fileName); + if (!pendingCheck) { + // Ignore file if there is no project for the file + goNext(); + return; + } + + const { fileName, project } = pendingCheck; + + // Ensure the project is up to date before checking if this file is present in the project. + updateProjectIfDirty(project); + if (!project.containsFile(fileName, requireOpen)) { + return; + } + + this.syntacticCheck(fileName, project); + if (this.changeSeq !== seq) { + return; + } + + // Don't provide semantic diagnostics unless we're in full semantic mode. + if (project.projectService.serverMode !== LanguageServiceMode.Semantic) { + goNext(); + return; + } + + next.immediate("regionSemanticCheck", () => { + if (item.ranges) { + // do stuff + this.regionSemanticCheck(fileName, project, item.ranges); + } + // do semantic check like below + }); + + next.immediate("semanticCheck", () => { + this.semanticCheck(fileName, project); + if (this.changeSeq !== seq) { + return; + } + + if (this.getPreferences(fileName).disableSuggestions) { + goNext(); + return; + } + next.immediate("suggestionCheck", () => { + this.suggestionCheck(fileName, project); + goNext(); + }); + }); + }; + + if (checkList.filesWithRanges.length + checkList.files.length > index && this.changeSeq === seq) { + next.delay("checkOne", ms, checkOne); + } + } + private cleanProjects(caption: string, projects: Project[]) { if (!projects) { return; @@ -2484,13 +2595,28 @@ export class Session implements EventSender { return project && { fileName, project }; } - private getDiagnostics(next: NextStep, delay: number, fileNames: string[]): void { + private getDiagnostics(next: NextStep, delay: number, files: (string | protocol.FileRangesRequestArgs)[]): void { if (this.suppressDiagnosticEvents) { return; } - if (fileNames.length > 0) { - this.updateErrorCheck(next, fileNames, delay); + if (files.length > 0) { + const newFiles = mapDefined(files, arg => { + if (isString(arg)) { + return arg; + } + const { file: filePath, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(arg); + const scriptInfo = this.projectService.getScriptInfo(filePath); + if (!scriptInfo) { + return undefined; + } + const ranges = arg.ranges.map(range => this.getRange({ file: arg.file, ...range }, scriptInfo)); + return { + file: arg.file, + ranges + }; + }); + this.updateErrorCheck(next, newFiles, delay); } } diff --git a/src/services/services.ts b/src/services/services.ts index 32a54a897242b..cf7b9a5cf9a09 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2001,6 +2001,26 @@ export function createLanguageService( return [...semanticDiagnostics, ...declarationDiagnostics]; } + // TODO: + // same as `getSemanticDiagnostics`. Maybe should be a single function that takes an optional ranges arg. We'll see. + function getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): Diagnostic[] { + synchronizeHostData(); + + const targetSourceFile = getValidSourceFile(fileName); + + // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. + // Therefore only get diagnostics for given file. + + const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken); + if (!getEmitDeclarations(program.getCompilerOptions())) { + return semanticDiagnostics.slice(); + } + + // If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface + const declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); + return [...semanticDiagnostics, ...declarationDiagnostics]; + } + function getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[] { synchronizeHostData(); return computeSuggestionDiagnostics(getValidSourceFile(fileName), program, cancellationToken); diff --git a/src/services/types.ts b/src/services/types.ts index 9bb560af02ac9..05c45fc7f1a8e 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -498,6 +498,11 @@ export interface LanguageService { */ getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[]; + /** + * TODO + */ + getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): Diagnostic[]; + // TODO: Rename this to getProgramDiagnostics to better indicate that these are any // diagnostics present for the program level, and not just 'options' diagnostics. @@ -1845,3 +1850,8 @@ export interface InlayHintsContext { span: TextSpan; preferences: UserPreferences; } + +export interface FileWithRanges { + fileName: string, + ranges?: TextRange[], +} \ No newline at end of file From 33ed16ab88b1af5f77aa4705502c50c0f2b6ab75 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 29 Feb 2024 21:22:53 -0800 Subject: [PATCH 02/74] add nodesToCheck param; compute it from ranges --- src/compiler/checker.ts | 33 +++++++++++++-- src/compiler/program.ts | 73 ++++++++++----------------------- src/compiler/types.ts | 5 +-- src/compiler/utilitiesPublic.ts | 47 ++++++++++++++++++--- src/services/services.ts | 42 ++++++++++++++++++- 5 files changed, 134 insertions(+), 66 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e331563151668..865e3e37a6346 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -47047,18 +47047,43 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { clear(potentialReflectCollisions); } - // >> TODO: also don't set this + // >> TODO: region: also don't set this links.flags |= NodeCheckFlags.TypeChecked; } } - function getDiagnostics(sourceFile: SourceFile, ct: CancellationToken): Diagnostic[] { + function checkSourceFileRanges(node: SourceFile, nodes: readonly Node[]) { + const links = getNodeLinks(node); + if (!(links.flags & NodeCheckFlags.TypeChecked)) { + if (skipTypeChecking(node, compilerOptions, host)) { + return; + } + + // >> TODO: skip this? do this? + // Grammar checking + checkGrammarSourceFile(node); + + // >> TODO: filter nodes that touch the ranges somehow + // >> TODO: consolidate ranges? + + + forEach(node.statements, checkSourceElement); + checkSourceElement(node.endOfFileToken); + + // >> TODO: what about this? + checkDeferredNodes(node); + } + + + } + + function getDiagnostics(sourceFile: SourceFile, ct: CancellationToken, nodesToCheck: Node[] | undefined): Diagnostic[] { try { // Record the cancellation token so it can be checked later on during checkSourceElement. // Do this in a finally block so we can ensure that it gets reset back to nothing after // this call is done. cancellationToken = ct; - return getDiagnosticsWorker(sourceFile); + return getDiagnosticsWorker(sourceFile, nodesToCheck); } finally { cancellationToken = undefined; @@ -47086,7 +47111,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { addLazyDiagnostic = oldAddLazyDiagnostics; } - function getDiagnosticsWorker(sourceFile: SourceFile): Diagnostic[] { + function getDiagnosticsWorker(sourceFile: SourceFile, nodesToCheck: Node[] | undefined): Diagnostic[] { if (sourceFile) { ensurePendingDiagnosticWorkComplete(); // Some global diagnostics are deferred until they are needed and diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 202ec98180dba..97b6757fc2da4 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2819,14 +2819,10 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken); } - function getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[] { - return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); - } - - function getRegionSemanticDiagnostics(sourceFile: SourceFile, ranges: TextRange[], cancellationToken?: CancellationToken): readonly Diagnostic[] { + function getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[] { return getDiagnosticsHelper( sourceFile, - (sourceFile, cancellationToken) => getRegionSemanticDiagnosticsForFile(sourceFile, ranges, cancellationToken), + (sourceFile, cancellationToken) => getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), // >> TODO: this is slightly sketchy because relies on this function only being called with the same sourcefile that originated the nodesToCheck cancellationToken); } @@ -2837,7 +2833,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } function getBindAndCheckDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[] { - return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken); + return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, /*nodesToCheck*/ undefined); } function getProgramDiagnostics(sourceFile: SourceFile): readonly Diagnostic[] { @@ -2891,57 +2887,32 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } } - function getSemanticDiagnosticsForFile(sourceFile: SourceFile, cancellationToken: CancellationToken | undefined): readonly Diagnostic[] { + function getSemanticDiagnosticsForFile( + sourceFile: SourceFile, + cancellationToken: CancellationToken | undefined, + nodesToCheck: Node[] | undefined): readonly Diagnostic[] { + // >> TODO: what the hell is `getProgramDiagnostics` doing??? it does something related to directives/comments... return concatenate( - filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options), + filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options), getProgramDiagnostics(sourceFile), ); } - function getRegionSemanticDiagnosticsForFile(sourceFile: SourceFile, ranges: TextRange[], cancellationToken: CancellationToken | undefined): readonly Diagnostic[] { - return filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFileRegion(sourceFile, cancellationToken), options); - // >> TODO: what the hell is `getProgramDiagnostics` doing??? it does something related to directives/comments... - } - - // TODO: similar to `getBindAndCheckDiagnosticsForFileNoCache` - function getBindAndCheckDiagnosticsForFileRegion(sourceFile: SourceFile, ranges: TextRange[], cancellationToken: CancellationToken | undefined): readonly Diagnostic[] { - // >> TODO: we should cache/avoid re-doing the binding diagnostics - return runWithCancellationToken(() => { - if (skipTypeChecking(sourceFile, options, program)) { - return emptyArray; - } - - const typeChecker = getTypeChecker(); - - Debug.assert(!!sourceFile.bindDiagnostics); - - const isJs = sourceFile.scriptKind === ScriptKind.JS || sourceFile.scriptKind === ScriptKind.JSX; - const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options); - const isPlainJs = isPlainJsFile(sourceFile, options.checkJs); - const isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false; - - // By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External - // - plain JS: .js files with no // ts-check and checkJs: undefined - // - check JS: .js files with either // ts-check or checkJs: true - // - external: files that are added by plugins - const includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === ScriptKind.TS || sourceFile.scriptKind === ScriptKind.TSX - || sourceFile.scriptKind === ScriptKind.External || isPlainJs || isCheckJs || sourceFile.scriptKind === ScriptKind.Deferred); - let bindDiagnostics: readonly Diagnostic[] = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; - let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray; - if (isPlainJs) { - bindDiagnostics = filter(bindDiagnostics, d => plainJSErrors.has(d.code)); - checkDiagnostics = filter(checkDiagnostics, d => plainJSErrors.has(d.code)); - } - // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS - return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); - }); - } - - function getBindAndCheckDiagnosticsForFile(sourceFile: SourceFile, cancellationToken: CancellationToken | undefined): readonly Diagnostic[] { + function getBindAndCheckDiagnosticsForFile( + sourceFile: SourceFile, + cancellationToken: CancellationToken | undefined, + nodesToCheck: Node[] | undefined): readonly Diagnostic[] { + // >> TODO: we might not want to cache if `nodesToCheck` is provided?? + if (nodesToCheck) { + return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck); + } return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache); } - function getBindAndCheckDiagnosticsForFileNoCache(sourceFile: SourceFile, cancellationToken: CancellationToken | undefined): readonly Diagnostic[] { + function getBindAndCheckDiagnosticsForFileNoCache( + sourceFile: SourceFile, + cancellationToken: CancellationToken | undefined, + nodesToCheck?: Node[]): readonly Diagnostic[] { return runWithCancellationToken(() => { if (skipTypeChecking(sourceFile, options, program)) { return emptyArray; @@ -2963,7 +2934,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === ScriptKind.TS || sourceFile.scriptKind === ScriptKind.TSX || sourceFile.scriptKind === ScriptKind.External || isPlainJs || isCheckJs || sourceFile.scriptKind === ScriptKind.Deferred); let bindDiagnostics: readonly Diagnostic[] = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; - let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray; + let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken, nodesToCheck) : emptyArray; if (isPlainJs) { bindDiagnostics = filter(bindDiagnostics, d => plainJSErrors.has(d.code)); checkDiagnostics = filter(checkDiagnostics, d => plainJSErrors.has(d.code)); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 67132b1f360d2..4dd246d1ef697 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4730,8 +4730,7 @@ export interface Program extends ScriptReferenceHost { getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; /** The first time this is called, it will return global diagnostics (no location). */ - getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; - getRegionSemanticDiagnostics(sourceFile: SourceFile, ranges: TextRange[], cancellationToken?: CancellationToken): readonly Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; getConfigFileParsingDiagnostics(): readonly Diagnostic[]; /** @internal */ getSuggestionDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; @@ -5213,7 +5212,7 @@ export interface TypeChecker { /** @internal */ getSymbolWalker(accept?: (symbol: Symbol) => boolean): SymbolWalker; // Should not be called directly. Should only be accessed through the Program instance. - /** @internal */ getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + /** @internal */ getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): Diagnostic[]; /** @internal */ getGlobalDiagnostics(): Diagnostic[]; /** @internal */ getEmitResolver(sourceFile?: SourceFile, cancellationToken?: CancellationToken): EmitResolver; diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 6392455c75a25..cca7b54d2f650 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1,3 +1,4 @@ +import { text } from "stream/consumers"; import { __String, AccessExpression, @@ -347,8 +348,8 @@ export function textSpanContainsPosition(span: TextSpan, position: number) { } /** @internal */ -export function textRangeContainsPositionInclusive(span: TextRange, position: number): boolean { - return position >= span.pos && position <= span.end; +export function textRangeContainsPositionInclusive(range: TextRange, position: number): boolean { + return position >= range.pos && position <= range.end; } // Returns true if 'span' contains 'other'. @@ -356,6 +357,10 @@ export function textSpanContainsTextSpan(span: TextSpan, other: TextSpan) { return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); } +export function textSpanContainsTextRange(span: TextSpan, range: TextRange) { + return range.pos >= span.start && range.end <= textSpanEnd(span); +} + export function textSpanOverlapsWith(span: TextSpan, other: TextSpan) { return textSpanOverlap(span, other) !== undefined; } @@ -365,30 +370,60 @@ export function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan | un return overlap && overlap.length === 0 ? undefined : overlap; } -export function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan) { +export function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean { return decodedTextSpanIntersectsWith(span.start, span.length, other.start, other.length); } -export function textSpanIntersectsWith(span: TextSpan, start: number, length: number) { +export function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean { return decodedTextSpanIntersectsWith(span.start, span.length, start, length); } -export function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number) { +export function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean { const end1 = start1 + length1; const end2 = start2 + length2; return start2 <= end1 && end2 >= start1; } -export function textSpanIntersectsWithPosition(span: TextSpan, position: number) { +export function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean { return position <= textSpanEnd(span) && position >= span.start; } +export function textRangeIntersectsWithTextSpan(range: TextRange, span: TextSpan): boolean { + return textSpanIntersectsWith(span, range.pos, range.end - range.pos); +} + export function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan | undefined { const start = Math.max(span1.start, span2.start); const end = Math.min(textSpanEnd(span1), textSpanEnd(span2)); return start <= end ? createTextSpanFromBounds(start, end) : undefined; } +/** @internal */ +/** + * Assumes non-empty spans. + */ +export function normalizeSpans(spans: TextSpan[]): TextSpan[] { + spans.sort((a, b) => { + return a.start != b.start ? a.start - b.start : a.length - b.length; + }); + + const result: TextSpan[] = []; + let i = 0; + while (i < spans.length) { + let span = spans[i]; + let j = i + 1; + while (j < spans.length && textSpanIntersectsWithTextSpan(span, spans[j])) { + const start = Math.min(span.start, spans[j].start); + const end = Math.max(textSpanEnd(span), textSpanEnd(spans[j])); + span = createTextSpanFromBounds(start, end); + } + i = j; + result.push(span); + } + + return result; +} + export function createTextSpan(start: number, length: number): TextSpan { if (start < 0) { throw new Error("start < 0"); diff --git a/src/services/services.ts b/src/services/services.ts index cf7b9a5cf9a09..e6ad2434cd1d7 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -319,6 +319,13 @@ import { updateSourceFile, UserPreferences, VariableDeclaration, + normalizeSpans, + findTokenOnLeftOfPosition, + textSpanContainsTextSpan, + textRangeContainsTextSpan as textSpanContainsTextRange, + textSpanOverlapsWith, + textSpanIntersectsWithTextSpan, + textRangeIntersectsWithTextSpan, } from "./_namespaces/ts"; import * as NavigateTo from "./_namespaces/ts.NavigateTo"; import * as NavigationBar from "./_namespaces/ts.NavigationBar"; @@ -2010,17 +2017,48 @@ export function createLanguageService( // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. // Therefore only get diagnostics for given file. - - const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken); + const nodes = getNodesForRanges(targetSourceFile, ranges); + const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes); if (!getEmitDeclarations(program.getCompilerOptions())) { return semanticDiagnostics.slice(); } + // >> TODO: check if we need to update this too? // If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface const declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); return [...semanticDiagnostics, ...declarationDiagnostics]; } + function getNodesForRanges(file: SourceFile, ranges: TextRange[]): Node[] | undefined { + const nodes: Node[] = []; + const spans = normalizeSpans(ranges.map(range => createTextSpanFromRange(range))); + for (const span of spans) { + const nodesForSpan = getNodesForSpan(file, span); + if (!nodesForSpan) { + return undefined; + } + nodes.push(...nodesForSpan); + } + return nodes; + } + + function getNodesForSpan(file: SourceFile, span: TextSpan): Node[] | undefined { + // Span is the whole file + if (textSpanContainsTextRange(span, file)) { + return undefined; + } + + const endToken = findTokenOnLeftOfPosition(file, textSpanEnd(span)) || file; + const enclosingNode = findAncestor(endToken, node => textSpanContainsTextRange(node, span))!; + + let nodes = enclosingNode === file ? file.statements.filter(s => textRangeIntersectsWithTextSpan(s, span)) : [enclosingNode]; + if (file.end === span.start + span.length) { + nodes.push(file.endOfFileToken); + } + return nodes; + } + + function getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[] { synchronizeHostData(); return computeSuggestionDiagnostics(getValidSourceFile(fileName), program, cancellationToken); From cf54694aed02b08b3ad0aae1b59afbefb594ddaa Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 1 Mar 2024 18:45:23 -0800 Subject: [PATCH 03/74] more end-to-end changes --- src/compiler/checker.ts | 54 +++++------- src/compiler/utilitiesPublic.ts | 11 +-- src/server/session.ts | 149 +++++++++----------------------- src/services/services.ts | 24 ++--- src/services/types.ts | 7 +- 5 files changed, 84 insertions(+), 161 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 865e3e37a6346..d41101d03624e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -46941,12 +46941,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { tracing?.pop(); } - function checkSourceFile(node: SourceFile) { // >> TODO: change here? - tracing?.push(tracing.Phase.Check, "checkSourceFile", { path: node.path }, /*separateBeginAndEnd*/ true); - performance.mark("beforeCheck"); - checkSourceFileWorker(node); - performance.mark("afterCheck"); - performance.measure("Check", "beforeCheck", "afterCheck"); + function checkSourceFile(node: SourceFile, nodesToCheck: Node[] | undefined) { // >> TODO: change here? + tracing?.push(tracing.Phase.Check, nodesToCheck ? "checkSourceFileNodes" : "checkSourceFile", { path: node.path }, /*separateBeginAndEnd*/ true); + const beforeMark = nodesToCheck ? "beforeCheckNodes" : "beforeCheck"; + const afterMark = nodesToCheck ? "afterCheckNodes" : "afterCheck"; + performance.mark(beforeMark); + nodesToCheck ? checkSourceFileNodesWorker(node, nodesToCheck) : checkSourceFileWorker(node); + performance.mark(afterMark); + performance.measure("Check", beforeMark, afterMark); tracing?.pop(); } @@ -46994,7 +46996,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { registerForUnusedIdentifiersCheck(node); } - // >> TODO: probably skip for region??? unused would require checking potentially outside region to be sure, otherwise will most likely be wrong? addLazyDiagnostic(() => { // This relies on the results of other lazy diagnostics, so must be computed after them if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) { @@ -47009,7 +47010,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } }); - // >> TODO: region?? this one goes through all statements in file, maybe it's ok if ( compilerOptions.importsNotUsedAsValues === ImportsNotUsedAsValues.Error && !node.isDeclarationFile && @@ -47018,66 +47018,54 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { checkImportsForTypeOnlyConversion(node); } - // >> TODO: skip region?? this one may require checking the whole file to have reliable information if (isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); } - // >> TODO: skip region?? unreliable info if (potentialThisCollisions.length) { forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); clear(potentialThisCollisions); } - // >> TODO: skip region?? unreliable info if (potentialNewTargetCollisions.length) { forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); clear(potentialNewTargetCollisions); } - // >> TODO: skip region?? unreliable info if (potentialWeakMapSetCollisions.length) { forEach(potentialWeakMapSetCollisions, checkWeakMapSetCollision); clear(potentialWeakMapSetCollisions); } - // >> TODO: skip region?? unreliable info if (potentialReflectCollisions.length) { forEach(potentialReflectCollisions, checkReflectCollision); clear(potentialReflectCollisions); } - // >> TODO: region: also don't set this links.flags |= NodeCheckFlags.TypeChecked; } } - function checkSourceFileRanges(node: SourceFile, nodes: readonly Node[]) { - const links = getNodeLinks(node); + function checkSourceFileNodesWorker(file: SourceFile, nodes: readonly Node[]) { + const links = getNodeLinks(file); if (!(links.flags & NodeCheckFlags.TypeChecked)) { - if (skipTypeChecking(node, compilerOptions, host)) { + if (skipTypeChecking(file, compilerOptions, host)) { return; } // >> TODO: skip this? do this? // Grammar checking - checkGrammarSourceFile(node); + checkGrammarSourceFile(file); - // >> TODO: filter nodes that touch the ranges somehow - // >> TODO: consolidate ranges? - + forEach(nodes, checkSourceElement); - forEach(node.statements, checkSourceElement); - checkSourceElement(node.endOfFileToken); + checkDeferredNodes(file); - // >> TODO: what about this? - checkDeferredNodes(node); + // >> TODO: do `checkPotentialUncheckedRenamedBindingElementsInTypes`? } - - } - function getDiagnostics(sourceFile: SourceFile, ct: CancellationToken, nodesToCheck: Node[] | undefined): Diagnostic[] { + function getDiagnostics(sourceFile: SourceFile, ct: CancellationToken, nodesToCheck?: Node[]): Diagnostic[] { try { // Record the cancellation token so it can be checked later on during checkSourceElement. // Do this in a finally block so we can ensure that it gets reset back to nothing after @@ -47098,7 +47086,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { deferredDiagnosticsCallbacks = []; } - function checkSourceFileWithEagerDiagnostics(sourceFile: SourceFile) { + function checkSourceFileWithEagerDiagnostics(sourceFile: SourceFile, nodesToCheck?: Node[]) { ensurePendingDiagnosticWorkComplete(); // then setup diagnostics for immediate invocation (as we are about to collect them, and // this avoids the overhead of longer-lived callbacks we don't need to allocate) @@ -47107,7 +47095,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // thus much more likely retaining the same union ordering as before we had lazy diagnostics) const oldAddLazyDiagnostics = addLazyDiagnostic; addLazyDiagnostic = cb => cb(); - checkSourceFile(sourceFile); + checkSourceFile(sourceFile, nodesToCheck); addLazyDiagnostic = oldAddLazyDiagnostics; } @@ -47120,8 +47108,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length; - checkSourceFileWithEagerDiagnostics(sourceFile); // >> TODO: change this - + checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck); // >> TODO: change this + // >> TODO: where do we clean up the diagnostics? const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); if (currentGlobalDiagnostics !== previousGlobalDiagnostics) { @@ -47141,7 +47129,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Global diagnostics are always added when a file is not provided to // getDiagnostics - forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics); + forEach(host.getSourceFiles(), file => checkSourceFileWithEagerDiagnostics(file)); return diagnostics.getDiagnostics(); } diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index cca7b54d2f650..a40be8644db2a 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -361,6 +361,10 @@ export function textSpanContainsTextRange(span: TextSpan, range: TextRange) { return range.pos >= span.start && range.end <= textSpanEnd(span); } +export function textRangeContainsTextSpan(range: TextRange, span: TextSpan) { + return span.start >= range.pos && textSpanEnd(span) <= range.end; +} + export function textSpanOverlapsWith(span: TextSpan, other: TextSpan) { return textSpanOverlap(span, other) !== undefined; } @@ -399,11 +403,8 @@ export function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan } /** @internal */ -/** - * Assumes non-empty spans. - */ -export function normalizeSpans(spans: TextSpan[]): TextSpan[] { - spans.sort((a, b) => { +export function normalizeSpans(spans: readonly TextSpan[]): TextSpan[] { + spans = spans.filter(span => span.length <= 0).sort((a, b) => { return a.start != b.start ? a.start - b.start : a.length - b.length; }); diff --git a/src/server/session.ts b/src/server/session.ts index 28802a4498201..b3bf3a019aa33 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1140,7 +1140,7 @@ export class Session implements EventSender { if (!this.suppressDiagnosticEvents && !this.noGetErrOnBackgroundUpdate) { this.projectService.logger.info(`Queueing diagnostics update for ${openFiles}`); // For now only queue error checking for open files. We can change this to include non open files as well - this.errorCheck.startNew(next => this.updateErrorCheck(next, openFiles, 100, /*requireOpen*/ true)); + this.errorCheck.startNew(next => this.updateErrorCheck(next, mapDefined(openFiles, fileName => this.toPendingErrorCheck(fileName)), 100, /*requireOpen*/ true)); } // Send project changed event @@ -1280,7 +1280,7 @@ export class Session implements EventSender { private regionSemanticCheck(file: NormalizedPath, project: Project, ranges: TextRange[]) { tracing?.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails - this.sendDiagnosticsEvent(file, project, project.getLanguageService().getRegionSemanticDiagnostics(file, ranges), "regionSemanticDiag"); + this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSemanticDiagnostics(file, ranges), "regionSemanticDiag"); tracing?.pop(); } @@ -1296,52 +1296,39 @@ export class Session implements EventSender { /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ private updateErrorCheck( next: NextStep, - checkList: readonly (string | FileWithRanges)[] | readonly PendingErrorCheck[], + checkList: readonly (PendingErrorCheck & { ranges?: TextRange[] })[], ms: number, requireOpen = true) { Debug.assert(!this.suppressDiagnosticEvents); // Caller's responsibility const seq = this.changeSeq; const followMs = Math.min(ms, 200); - - if (checkList.length === 0) { - return; - } - - const first: string | PendingErrorCheck | FileWithRanges = checkList[0]; - if (isString(first) || (first as FileWithRanges).ranges) { - // checkList is not of pending error checks - const filesWithRanges = (checkList as (string | FileWithRanges)[]).filter(item => !isString(item)); - const files = (checkList as (string | FileWithRanges)[]).filter(isString); - if (filesWithRanges.length) { - return this.updateErrorCheckWithRanges(next, { filesWithRanges, files }, ms, requireOpen); - } - } - // const checkList = + const filesFullCheck: PendingErrorCheck[] = []; let index = 0; const goNext = () => { index++; if (checkList.length > index) { - next.delay("checkOne", followMs, checkOne); + return next.delay("checkOne", followMs, checkOne); + } + if (filesFullCheck.length) { + index = 0; + return next.delay("checkFullOne", followMs, checkFull); } }; + const goNextFull = () => { + index++; + if (filesFullCheck.length > index) { + return next.delay("checkFullOne", followMs, checkFull); + } + } + const checkOne = () => { if (this.changeSeq !== seq) { return; } - let item: string | PendingErrorCheck | undefined = checkList[index]; - if (isString(item)) { - // Find out project for the file name - item = this.toPendingErrorCheck(item); - if (!item) { - // Ignore file if there is no project for the file - goNext(); - return; - } - } - + const item = checkList[index]; const { fileName, project } = item; // Ensure the project is up to date before checking if this file is present in the project. @@ -1360,6 +1347,15 @@ export class Session implements EventSender { goNext(); return; } + + if (item.ranges) { + return next.immediate("regionSemanticCheck", () => { + this.regionSemanticCheck(fileName, project, item.ranges!); + filesFullCheck.push({ fileName, project }); + goNext(); + }); + } + next.immediate("semanticCheck", () => { this.semanticCheck(fileName, project); if (this.changeSeq !== seq) { @@ -1377,74 +1373,12 @@ export class Session implements EventSender { }); }; - if (checkList.length > index && this.changeSeq === seq) { - next.delay("checkOne", ms, checkOne); - } - } - - - private updateErrorCheckWithRanges( - next: NextStep, - checkList: { filesWithRanges: (FileWithRanges & { ranges: TextRange[] })[], files: string[] }, - ms: number, - requireOpen: boolean): void { - const seq = this.changeSeq; - const followMs = Math.min(ms, 200); - - const rangesLength = checkList.filesWithRanges.length; - const filesLength = checkList.files.length; - const totalLength = rangesLength + filesLength; - - let index = 0; - const goNext = () => { - index++; - if (totalLength > index) { - next.delay("checkOne", followMs, checkOne); - } - }; - - const checkOne = () => { + const checkFull = () => { if (this.changeSeq !== seq) { return; } - const item: FileWithRanges = - index > rangesLength ? { fileName: checkList.files[index - rangesLength] } : checkList.filesWithRanges[index]; - // Find out project for the file name - const pendingCheck = this.toPendingErrorCheck(item.fileName); - if (!pendingCheck) { - // Ignore file if there is no project for the file - goNext(); - return; - } - - const { fileName, project } = pendingCheck; - - // Ensure the project is up to date before checking if this file is present in the project. - updateProjectIfDirty(project); - if (!project.containsFile(fileName, requireOpen)) { - return; - } - - this.syntacticCheck(fileName, project); - if (this.changeSeq !== seq) { - return; - } - - // Don't provide semantic diagnostics unless we're in full semantic mode. - if (project.projectService.serverMode !== LanguageServiceMode.Semantic) { - goNext(); - return; - } - - next.immediate("regionSemanticCheck", () => { - if (item.ranges) { - // do stuff - this.regionSemanticCheck(fileName, project, item.ranges); - } - // do semantic check like below - }); - + const { fileName, project } = filesFullCheck[index]; next.immediate("semanticCheck", () => { this.semanticCheck(fileName, project); if (this.changeSeq !== seq) { @@ -1452,17 +1386,17 @@ export class Session implements EventSender { } if (this.getPreferences(fileName).disableSuggestions) { - goNext(); + goNextFull(); return; } next.immediate("suggestionCheck", () => { this.suggestionCheck(fileName, project); - goNext(); + goNextFull(); }); }); - }; + } - if (checkList.filesWithRanges.length + checkList.files.length > index && this.changeSeq === seq) { + if (checkList.length > index && this.changeSeq === seq) { next.delay("checkOne", ms, checkOne); } } @@ -2595,28 +2529,29 @@ export class Session implements EventSender { return project && { fileName, project }; } - private getDiagnostics(next: NextStep, delay: number, files: (string | protocol.FileRangesRequestArgs)[]): void { + private getDiagnostics(next: NextStep, delay: number, fileArgs: (string | protocol.FileRangesRequestArgs)[]): void { if (this.suppressDiagnosticEvents) { return; } - if (files.length > 0) { - const newFiles = mapDefined(files, arg => { - if (isString(arg)) { - return arg; + if (fileArgs.length > 0) { + const files = mapDefined(fileArgs.filter(isString), fileName => this.toPendingErrorCheck(fileName)); + const filesWithRange = mapDefined(fileArgs.filter((arg): arg is protocol.FileRangesRequestArgs => !isString(arg)), arg => { + const errorCheck = this.toPendingErrorCheck(arg.file); + if (!errorCheck) { + return undefined; } - const { file: filePath, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(arg); - const scriptInfo = this.projectService.getScriptInfo(filePath); + const scriptInfo = this.projectService.getScriptInfo(errorCheck.fileName); if (!scriptInfo) { return undefined; } const ranges = arg.ranges.map(range => this.getRange({ file: arg.file, ...range }, scriptInfo)); return { - file: arg.file, + ...errorCheck, ranges }; }); - this.updateErrorCheck(next, newFiles, delay); + this.updateErrorCheck(next, [...filesWithRange, ...files], delay); } } diff --git a/src/services/services.ts b/src/services/services.ts index e6ad2434cd1d7..2d82be8600b75 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -321,11 +321,9 @@ import { VariableDeclaration, normalizeSpans, findTokenOnLeftOfPosition, - textSpanContainsTextSpan, - textRangeContainsTextSpan as textSpanContainsTextRange, - textSpanOverlapsWith, - textSpanIntersectsWithTextSpan, textRangeIntersectsWithTextSpan, + textSpanContainsTextRange, + textRangeContainsTextSpan, } from "./_namespaces/ts"; import * as NavigateTo from "./_namespaces/ts.NavigateTo"; import * as NavigationBar from "./_namespaces/ts.NavigationBar"; @@ -1990,7 +1988,10 @@ export function createLanguageService( * getSemanticDiagnostics return array of Diagnostics. If '-d' is not enabled, only report semantic errors * If '-d' enabled, report both semantic and emitter errors */ - function getSemanticDiagnostics(fileName: string): Diagnostic[] { + function getSemanticDiagnostics(fileName: string, ranges?: TextRange[]): Diagnostic[] { + if (ranges) { + return getRegionSemanticDiagnostics(fileName, ranges); + } synchronizeHostData(); const targetSourceFile = getValidSourceFile(fileName); @@ -2019,14 +2020,14 @@ export function createLanguageService( // Therefore only get diagnostics for given file. const nodes = getNodesForRanges(targetSourceFile, ranges); const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes); - if (!getEmitDeclarations(program.getCompilerOptions())) { + // if (!getEmitDeclarations(program.getCompilerOptions())) { return semanticDiagnostics.slice(); - } + // } // >> TODO: check if we need to update this too? // If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface - const declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); - return [...semanticDiagnostics, ...declarationDiagnostics]; + // const declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); + // return [...semanticDiagnostics, ...declarationDiagnostics]; } function getNodesForRanges(file: SourceFile, ranges: TextRange[]): Node[] | undefined { @@ -2039,6 +2040,9 @@ export function createLanguageService( } nodes.push(...nodesForSpan); } + if (!nodes.length) { + return undefined; + } return nodes; } @@ -2049,7 +2053,7 @@ export function createLanguageService( } const endToken = findTokenOnLeftOfPosition(file, textSpanEnd(span)) || file; - const enclosingNode = findAncestor(endToken, node => textSpanContainsTextRange(node, span))!; + const enclosingNode = findAncestor(endToken, node => textRangeContainsTextSpan(node, span))!; let nodes = enclosingNode === file ? file.statements.filter(s => textRangeIntersectsWithTextSpan(s, span)) : [enclosingNode]; if (file.end === span.start + span.length) { diff --git a/src/services/types.ts b/src/services/types.ts index 05c45fc7f1a8e..0e7530b8e6ae7 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -487,7 +487,7 @@ export interface LanguageService { * * @param fileName A path to the file you want semantic diagnostics for */ - getSemanticDiagnostics(fileName: string): Diagnostic[]; + getSemanticDiagnostics(fileName: string, ranges?: TextRange[]): Diagnostic[]; /** * Gets suggestion diagnostics for a specific file. These diagnostics tend to @@ -498,11 +498,6 @@ export interface LanguageService { */ getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[]; - /** - * TODO - */ - getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): Diagnostic[]; - // TODO: Rename this to getProgramDiagnostics to better indicate that these are any // diagnostics present for the program level, and not just 'options' diagnostics. From 9647997c126f0b554c1e1dab7940b007dd6d005c Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 1 Mar 2024 19:16:44 -0800 Subject: [PATCH 04/74] lint fixes, api baseline changes --- src/compiler/program.ts | 13 +++-- src/compiler/utilitiesPublic.ts | 6 +-- src/server/session.ts | 12 ++--- src/services/services.ts | 15 +++--- src/services/types.ts | 5 -- tests/baselines/reference/api/typescript.d.ts | 51 +++++++++++-------- 6 files changed, 54 insertions(+), 48 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 97b6757fc2da4..3ddc112c86c28 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -327,7 +327,6 @@ import { WriteFileCallback, WriteFileCallbackData, writeFileEnsuringDirectories, - TextRange, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; @@ -2823,7 +2822,8 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg return getDiagnosticsHelper( sourceFile, (sourceFile, cancellationToken) => getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), // >> TODO: this is slightly sketchy because relies on this function only being called with the same sourcefile that originated the nodesToCheck - cancellationToken); + cancellationToken, + ); } function getCachedSemanticDiagnostics(sourceFile?: SourceFile): readonly Diagnostic[] | undefined { @@ -2890,7 +2890,8 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg function getSemanticDiagnosticsForFile( sourceFile: SourceFile, cancellationToken: CancellationToken | undefined, - nodesToCheck: Node[] | undefined): readonly Diagnostic[] { + nodesToCheck: Node[] | undefined, + ): readonly Diagnostic[] { // >> TODO: what the hell is `getProgramDiagnostics` doing??? it does something related to directives/comments... return concatenate( filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options), @@ -2901,7 +2902,8 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg function getBindAndCheckDiagnosticsForFile( sourceFile: SourceFile, cancellationToken: CancellationToken | undefined, - nodesToCheck: Node[] | undefined): readonly Diagnostic[] { + nodesToCheck: Node[] | undefined, + ): readonly Diagnostic[] { // >> TODO: we might not want to cache if `nodesToCheck` is provided?? if (nodesToCheck) { return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck); @@ -2912,7 +2914,8 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg function getBindAndCheckDiagnosticsForFileNoCache( sourceFile: SourceFile, cancellationToken: CancellationToken | undefined, - nodesToCheck?: Node[]): readonly Diagnostic[] { + nodesToCheck?: Node[], + ): readonly Diagnostic[] { return runWithCancellationToken(() => { if (skipTypeChecking(sourceFile, options, program)) { return emptyArray; diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index a40be8644db2a..745442bf1b907 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1,4 +1,3 @@ -import { text } from "stream/consumers"; import { __String, AccessExpression, @@ -405,9 +404,9 @@ export function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan /** @internal */ export function normalizeSpans(spans: readonly TextSpan[]): TextSpan[] { spans = spans.filter(span => span.length <= 0).sort((a, b) => { - return a.start != b.start ? a.start - b.start : a.length - b.length; + return a.start !== b.start ? a.start - b.start : a.length - b.length; }); - + const result: TextSpan[] = []; let i = 0; while (i < spans.length) { @@ -417,6 +416,7 @@ export function normalizeSpans(spans: readonly TextSpan[]): TextSpan[] { const start = Math.min(span.start, spans[j].start); const end = Math.max(textSpanEnd(span), textSpanEnd(spans[j])); span = createTextSpanFromBounds(start, end); + j++; } i = j; result.push(span); diff --git a/src/server/session.ts b/src/server/session.ts index b3bf3a019aa33..522447aef9f44 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -39,7 +39,6 @@ import { EmitOutput, equateValues, FileTextChanges, - FileWithRanges, filter, find, FindAllReferences, @@ -1296,9 +1295,10 @@ export class Session implements EventSender { /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ private updateErrorCheck( next: NextStep, - checkList: readonly (PendingErrorCheck & { ranges?: TextRange[] })[], + checkList: readonly (PendingErrorCheck & { ranges?: TextRange[]; })[], ms: number, - requireOpen = true) { + requireOpen = true, + ) { Debug.assert(!this.suppressDiagnosticEvents); // Caller's responsibility const seq = this.changeSeq; @@ -1321,7 +1321,7 @@ export class Session implements EventSender { if (filesFullCheck.length > index) { return next.delay("checkFullOne", followMs, checkFull); } - } + }; const checkOne = () => { if (this.changeSeq !== seq) { @@ -1394,7 +1394,7 @@ export class Session implements EventSender { goNextFull(); }); }); - } + }; if (checkList.length > index && this.changeSeq === seq) { next.delay("checkOne", ms, checkOne); @@ -2548,7 +2548,7 @@ export class Session implements EventSender { const ranges = arg.ranges.map(range => this.getRange({ file: arg.file, ...range }, scriptInfo)); return { ...errorCheck, - ranges + ranges, }; }); this.updateErrorCheck(next, [...filesWithRange, ...files], delay); diff --git a/src/services/services.ts b/src/services/services.ts index 2d82be8600b75..9675fe8da47e4 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -75,6 +75,7 @@ import { findAncestor, findChildOfKind, findPrecedingToken, + findTokenOnLeftOfPosition, first, firstDefined, firstOrOnly, @@ -223,6 +224,7 @@ import { NodeFlags, noop, normalizePath, + normalizeSpans, NumberLiteralType, NumericLiteral, ObjectAllocator, @@ -297,7 +299,10 @@ import { TextChangeRange, TextInsertion, TextRange, + textRangeContainsTextSpan, + textRangeIntersectsWithTextSpan, TextSpan, + textSpanContainsTextRange, textSpanEnd, timestamp, TodoComment, @@ -319,11 +324,6 @@ import { updateSourceFile, UserPreferences, VariableDeclaration, - normalizeSpans, - findTokenOnLeftOfPosition, - textRangeIntersectsWithTextSpan, - textSpanContainsTextRange, - textRangeContainsTextSpan, } from "./_namespaces/ts"; import * as NavigateTo from "./_namespaces/ts.NavigateTo"; import * as NavigationBar from "./_namespaces/ts.NavigationBar"; @@ -2021,7 +2021,7 @@ export function createLanguageService( const nodes = getNodesForRanges(targetSourceFile, ranges); const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes); // if (!getEmitDeclarations(program.getCompilerOptions())) { - return semanticDiagnostics.slice(); + return semanticDiagnostics.slice(); // } // >> TODO: check if we need to update this too? @@ -2055,14 +2055,13 @@ export function createLanguageService( const endToken = findTokenOnLeftOfPosition(file, textSpanEnd(span)) || file; const enclosingNode = findAncestor(endToken, node => textRangeContainsTextSpan(node, span))!; - let nodes = enclosingNode === file ? file.statements.filter(s => textRangeIntersectsWithTextSpan(s, span)) : [enclosingNode]; + const nodes = enclosingNode === file ? file.statements.filter(s => textRangeIntersectsWithTextSpan(s, span)) : [enclosingNode]; if (file.end === span.start + span.length) { nodes.push(file.endOfFileToken); } return nodes; } - function getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[] { synchronizeHostData(); return computeSuggestionDiagnostics(getValidSourceFile(fileName), program, cancellationToken); diff --git a/src/services/types.ts b/src/services/types.ts index 0e7530b8e6ae7..d19ae9fe5590a 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1845,8 +1845,3 @@ export interface InlayHintsContext { span: TextSpan; preferences: UserPreferences; } - -export interface FileWithRanges { - fileName: string, - ranges?: TextRange[], -} \ No newline at end of file diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index a131733463740..bd85ed3f2f8e1 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -681,23 +681,7 @@ declare namespace ts { } interface ApplyCodeActionCommandResponse extends Response { } - interface FileRangeRequestArgs extends FileRequestArgs { - /** - * The line number for the request (1-based). - */ - startLine: number; - /** - * The character offset (on the line) for the request (1-based). - */ - startOffset: number; - /** - * The line number for the request (1-based). - */ - endLine: number; - /** - * The character offset (on the line) for the request (1-based). - */ - endOffset: number; + interface FileRangeRequestArgs extends FileRequestArgs, FileRange { } /** * Instances of this interface specify errorcodes on a specific location in a sourcefile. @@ -2221,7 +2205,7 @@ declare namespace ts { * List of file names for which to compute compiler errors. * The files will be checked in list order. */ - files: string[]; + files: (string | FileRangesRequestArgs)[]; /** * Delay in milliseconds to wait before starting to compute * errors for the files in the file list @@ -2242,6 +2226,27 @@ declare namespace ts { command: CommandTypes.Geterr; arguments: GeterrRequestArgs; } + interface FileRange { + /** + * The line number for the request (1-based). + */ + startLine: number; + /** + * The character offset (on the line) for the request (1-based). + */ + startOffset: number; + /** + * The line number for the request (1-based). + */ + endLine: number; + /** + * The character offset (on the line) for the request (1-based). + */ + endOffset: number; + } + interface FileRangesRequestArgs extends FileRequestArgs { + ranges: FileRange[]; + } type RequestCompletedEventName = "requestCompleted"; /** * Event that is sent when server have finished processing request with specified id. @@ -2325,7 +2330,7 @@ declare namespace ts { */ diagnostics: Diagnostic[]; } - type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag"; + type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag" | "regionSemanticDiag"; /** * Event message for DiagnosticEventKind event types. * These events provide syntactic and semantic errors for a file. @@ -3994,6 +3999,7 @@ declare namespace ts { private semanticCheck; private syntacticCheck; private suggestionCheck; + private regionSemanticCheck; private sendDiagnosticsEvent; /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ private updateErrorCheck; @@ -6637,7 +6643,7 @@ declare namespace ts { getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; /** The first time this is called, it will return global diagnostics (no location). */ - getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; getConfigFileParsingDiagnostics(): readonly Diagnostic[]; /** @@ -8949,12 +8955,15 @@ declare namespace ts { function textSpanIsEmpty(span: TextSpan): boolean; function textSpanContainsPosition(span: TextSpan, position: number): boolean; function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean; + function textSpanContainsTextRange(span: TextSpan, range: TextRange): boolean; + function textRangeContainsTextSpan(range: TextRange, span: TextSpan): boolean; function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean; function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan | undefined; function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean; function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean; function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean; function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean; + function textRangeIntersectsWithTextSpan(range: TextRange, span: TextSpan): boolean; function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan | undefined; function createTextSpan(start: number, length: number): TextSpan; function createTextSpanFromBounds(start: number, end: number): TextSpan; @@ -10524,7 +10533,7 @@ declare namespace ts { * * @param fileName A path to the file you want semantic diagnostics for */ - getSemanticDiagnostics(fileName: string): Diagnostic[]; + getSemanticDiagnostics(fileName: string, ranges?: TextRange[]): Diagnostic[]; /** * Gets suggestion diagnostics for a specific file. These diagnostics tend to * proactively suggest refactors, as opposed to diagnostics that indicate From 9cd0edcb64d077c36dca52c88bc0ca64ab1282c2 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 4 Mar 2024 13:42:16 -0800 Subject: [PATCH 05/74] small fix, update baseline --- src/server/session.ts | 3 ++ .../cancellationT/Geterr-is-cancellable.js | 40 ++++++++----------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 522447aef9f44..45868fd8983c9 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1299,6 +1299,9 @@ export class Session implements EventSender { ms: number, requireOpen = true, ) { + if (checkList.length === 0) { + return; + } Debug.assert(!this.suppressDiagnosticEvents); // Caller's responsibility const seq = this.changeSeq; diff --git a/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js b/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js index d1b60c61b0d87..f5c057e00e680 100644 --- a/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js +++ b/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js @@ -214,20 +214,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 2, "type": "request" } -TestServerCancellationToken:: Cancellation Request id:: 2 -TestServerCancellationToken:: resetRequest:: 2 is as expected -Info seq [hh:mm:ss:mss] response: - { - "responseRequired": false - } -After request - -Timeout callback:: count: 1 -1: checkOne *new* - -Before running Timeout callback:: count: 1 -1: checkOne - TestServerCancellationToken:: Cancellation Request id:: 2 Info seq [hh:mm:ss:mss] event: { @@ -239,6 +225,14 @@ Info seq [hh:mm:ss:mss] event: } } TestServerCancellationToken:: resetRequest:: 2 is as expected +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before running Timeout callback:: count: 0 + After running Timeout callback:: count: 0 Before request @@ -264,7 +258,7 @@ Info seq [hh:mm:ss:mss] response: After request Timeout callback:: count: 1 -2: checkOne *new* +1: checkOne *new* Before request @@ -292,7 +286,7 @@ After request TestServerCancellationToken:: Setting request to cancel:: 3 Before running Timeout callback:: count: 1 -2: checkOne +1: checkOne TestServerCancellationToken:: Cancellation Request id:: 3 TestServerCancellationToken:: Cancellation is requested @@ -331,10 +325,10 @@ Info seq [hh:mm:ss:mss] response: After request Timeout callback:: count: 1 -3: checkOne *new* +2: checkOne *new* Before running Timeout callback:: count: 1 -3: checkOne +2: checkOne TestServerCancellationToken:: Cancellation Request id:: 5 Info seq [hh:mm:ss:mss] event: @@ -394,10 +388,10 @@ Info seq [hh:mm:ss:mss] response: After request Timeout callback:: count: 1 -4: checkOne *new* +3: checkOne *new* Before running Timeout callback:: count: 1 -4: checkOne +3: checkOne TestServerCancellationToken:: Cancellation Request id:: 6 Info seq [hh:mm:ss:mss] event: @@ -485,10 +479,10 @@ Info seq [hh:mm:ss:mss] response: After request Timeout callback:: count: 1 -5: checkOne *new* +4: checkOne *new* Before running Timeout callback:: count: 1 -5: checkOne +4: checkOne TestServerCancellationToken:: Cancellation Request id:: 7 Info seq [hh:mm:ss:mss] event: @@ -539,7 +533,7 @@ Info seq [hh:mm:ss:mss] response: After request Timeout callback:: count: 1 -6: checkOne *new* +5: checkOne *new* Immedidate callback:: count: 0 4: semanticCheck *deleted* From eeb91c54f9a5f251395243531145750f3c984c6f Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 4 Mar 2024 14:40:43 -0800 Subject: [PATCH 06/74] get project right before checking for errors --- src/server/session.ts | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 45868fd8983c9..0916ce71ad7fc 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -302,7 +302,8 @@ export function formatDiagnosticToProtocol(diag: Diagnostic, includeFileName: bo export interface PendingErrorCheck { fileName: NormalizedPath; - project: Project; + ranges?: TextRange[]; + project?: Project; } function allEditsBeforePos(edits: readonly TextChange[], pos: number): boolean { @@ -1139,7 +1140,7 @@ export class Session implements EventSender { if (!this.suppressDiagnosticEvents && !this.noGetErrOnBackgroundUpdate) { this.projectService.logger.info(`Queueing diagnostics update for ${openFiles}`); // For now only queue error checking for open files. We can change this to include non open files as well - this.errorCheck.startNew(next => this.updateErrorCheck(next, mapDefined(openFiles, fileName => this.toPendingErrorCheck(fileName)), 100, /*requireOpen*/ true)); + this.errorCheck.startNew(next => this.updateErrorCheck(next, mapDefined(openFiles, file => ({ fileName: toNormalizedPath(file) })), 100, /*requireOpen*/ true)); } // Send project changed event @@ -1295,7 +1296,7 @@ export class Session implements EventSender { /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ private updateErrorCheck( next: NextStep, - checkList: readonly (PendingErrorCheck & { ranges?: TextRange[]; })[], + checkList: PendingErrorCheck[], ms: number, requireOpen = true, ) { @@ -1331,8 +1332,10 @@ export class Session implements EventSender { return; } - const item = checkList[index]; - const { fileName, project } = item; + const { fileName, project = this.projectService.tryGetDefaultProjectForFile(fileName), ranges } = checkList[index]; + if (!project) { + return; + } // Ensure the project is up to date before checking if this file is present in the project. updateProjectIfDirty(project); @@ -1351,9 +1354,9 @@ export class Session implements EventSender { return; } - if (item.ranges) { + if (ranges) { return next.immediate("regionSemanticCheck", () => { - this.regionSemanticCheck(fileName, project, item.ranges!); + this.regionSemanticCheck(fileName, project, ranges); filesFullCheck.push({ fileName, project }); goNext(); }); @@ -2526,31 +2529,22 @@ export class Session implements EventSender { } } - private toPendingErrorCheck(uncheckedFileName: string): PendingErrorCheck | undefined { - const fileName = toNormalizedPath(uncheckedFileName); - const project = this.projectService.tryGetDefaultProjectForFile(fileName); - return project && { fileName, project }; - } - private getDiagnostics(next: NextStep, delay: number, fileArgs: (string | protocol.FileRangesRequestArgs)[]): void { if (this.suppressDiagnosticEvents) { return; } if (fileArgs.length > 0) { - const files = mapDefined(fileArgs.filter(isString), fileName => this.toPendingErrorCheck(fileName)); + const files = mapDefined(fileArgs.filter(isString), file => ({ fileName: toNormalizedPath(file) })); const filesWithRange = mapDefined(fileArgs.filter((arg): arg is protocol.FileRangesRequestArgs => !isString(arg)), arg => { - const errorCheck = this.toPendingErrorCheck(arg.file); - if (!errorCheck) { - return undefined; - } - const scriptInfo = this.projectService.getScriptInfo(errorCheck.fileName); + const fileName = toNormalizedPath(arg.file); + const scriptInfo = this.projectService.getScriptInfo(fileName); if (!scriptInfo) { return undefined; } const ranges = arg.ranges.map(range => this.getRange({ file: arg.file, ...range }, scriptInfo)); return { - ...errorCheck, + fileName, ranges, }; }); From 38861fb9ebf2b6b85399a694a416981ce60dba38 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 5 Mar 2024 12:14:04 -0800 Subject: [PATCH 07/74] fix type error and tests --- src/server/session.ts | 6 +-- tests/baselines/reference/api/typescript.d.ts | 5 --- .../cancellationT/Geterr-is-cancellable.js | 40 +++++++++++-------- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 0916ce71ad7fc..bbedb4e01be2c 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -300,7 +300,7 @@ export function formatDiagnosticToProtocol(diag: Diagnostic, includeFileName: bo : common; } -export interface PendingErrorCheck { +interface PendingErrorCheck { fileName: NormalizedPath; ranges?: TextRange[]; project?: Project; @@ -1386,7 +1386,7 @@ export class Session implements EventSender { const { fileName, project } = filesFullCheck[index]; next.immediate("semanticCheck", () => { - this.semanticCheck(fileName, project); + this.semanticCheck(fileName, project!); if (this.changeSeq !== seq) { return; } @@ -1396,7 +1396,7 @@ export class Session implements EventSender { return; } next.immediate("suggestionCheck", () => { - this.suggestionCheck(fileName, project); + this.suggestionCheck(fileName, project!); goNextFull(); }); }); diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index bd85ed3f2f8e1..85580cbebf9a3 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3925,10 +3925,6 @@ declare namespace ts { resetRequest(requestId: number): void; } const nullCancellationToken: ServerCancellationToken; - interface PendingErrorCheck { - fileName: NormalizedPath; - project: Project; - } /** @deprecated use ts.server.protocol.CommandTypes */ type CommandNames = protocol.CommandTypes; /** @deprecated use ts.server.protocol.CommandTypes */ @@ -4076,7 +4072,6 @@ declare namespace ts { private getCompileOnSaveAffectedFileList; private emitFile; private getSignatureHelpItems; - private toPendingErrorCheck; private getDiagnostics; private change; private reload; diff --git a/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js b/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js index f5c057e00e680..d1b60c61b0d87 100644 --- a/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js +++ b/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js @@ -214,6 +214,20 @@ Info seq [hh:mm:ss:mss] request: "seq": 2, "type": "request" } +TestServerCancellationToken:: Cancellation Request id:: 2 +TestServerCancellationToken:: resetRequest:: 2 is as expected +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Timeout callback:: count: 1 +1: checkOne *new* + +Before running Timeout callback:: count: 1 +1: checkOne + TestServerCancellationToken:: Cancellation Request id:: 2 Info seq [hh:mm:ss:mss] event: { @@ -225,14 +239,6 @@ Info seq [hh:mm:ss:mss] event: } } TestServerCancellationToken:: resetRequest:: 2 is as expected -Info seq [hh:mm:ss:mss] response: - { - "responseRequired": false - } -After request - -Before running Timeout callback:: count: 0 - After running Timeout callback:: count: 0 Before request @@ -258,7 +264,7 @@ Info seq [hh:mm:ss:mss] response: After request Timeout callback:: count: 1 -1: checkOne *new* +2: checkOne *new* Before request @@ -286,7 +292,7 @@ After request TestServerCancellationToken:: Setting request to cancel:: 3 Before running Timeout callback:: count: 1 -1: checkOne +2: checkOne TestServerCancellationToken:: Cancellation Request id:: 3 TestServerCancellationToken:: Cancellation is requested @@ -325,10 +331,10 @@ Info seq [hh:mm:ss:mss] response: After request Timeout callback:: count: 1 -2: checkOne *new* +3: checkOne *new* Before running Timeout callback:: count: 1 -2: checkOne +3: checkOne TestServerCancellationToken:: Cancellation Request id:: 5 Info seq [hh:mm:ss:mss] event: @@ -388,10 +394,10 @@ Info seq [hh:mm:ss:mss] response: After request Timeout callback:: count: 1 -3: checkOne *new* +4: checkOne *new* Before running Timeout callback:: count: 1 -3: checkOne +4: checkOne TestServerCancellationToken:: Cancellation Request id:: 6 Info seq [hh:mm:ss:mss] event: @@ -479,10 +485,10 @@ Info seq [hh:mm:ss:mss] response: After request Timeout callback:: count: 1 -4: checkOne *new* +5: checkOne *new* Before running Timeout callback:: count: 1 -4: checkOne +5: checkOne TestServerCancellationToken:: Cancellation Request id:: 7 Info seq [hh:mm:ss:mss] event: @@ -533,7 +539,7 @@ Info seq [hh:mm:ss:mss] response: After request Timeout callback:: count: 1 -5: checkOne *new* +6: checkOne *new* Immedidate callback:: count: 0 4: semanticCheck *deleted* From b46560a736643572aa1eb016ff0a03cfb3785791 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 6 Mar 2024 17:04:56 -0800 Subject: [PATCH 08/74] WIP: return spans in region diagnostics event --- src/server/protocol.ts | 7 +++++-- src/server/session.ts | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index f43d01e62ec40..c621de0de8c12 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -2806,7 +2806,7 @@ export interface FileRange { endOffset: number; } -export interface FileRangesRequestArgs extends FileRequestArgs { +export interface FileRangesRequestArgs extends Pick { ranges: FileRange[]; } @@ -2908,7 +2908,10 @@ export interface DiagnosticEventBody { */ diagnostics: Diagnostic[]; - // >> TODO: maybe we need to send back the ranges for a region semantic diagnostic event + /** + * Spans where the region diagnostic was requested, if this is a region semantic diagnostic event. + */ + spans?: TextSpan[]; } export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag" | "regionSemanticDiag"; diff --git a/src/server/session.ts b/src/server/session.ts index bbedb4e01be2c..2ad4010ed4440 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -23,6 +23,7 @@ import { createSet, createTextSpan, createTextSpanFromBounds, + createTextSpanFromRange, Debug, decodedTextSpanIntersectsWith, deduplicate, @@ -1280,13 +1281,17 @@ export class Session implements EventSender { private regionSemanticCheck(file: NormalizedPath, project: Project, ranges: TextRange[]) { tracing?.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails - this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSemanticDiagnostics(file, ranges), "regionSemanticDiag"); + // >> TODO: get adjusted ranges from the nodes we actually end up checking... + this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSemanticDiagnostics(file, ranges), "regionSemanticDiag", ranges.map(createTextSpanFromRange)); tracing?.pop(); } - private sendDiagnosticsEvent(file: NormalizedPath, project: Project, diagnostics: readonly Diagnostic[], kind: protocol.DiagnosticEventKind): void { + private sendDiagnosticsEvent(file: NormalizedPath, project: Project, diagnostics: readonly Diagnostic[], kind: protocol.DiagnosticEventKind, spans?: TextSpan[]): void { try { - this.event({ file, diagnostics: diagnostics.map(diag => formatDiag(file, project, diag)) }, kind); + const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); + this.event( + { file, diagnostics: diagnostics.map(diag => formatDiag(file, project, diag)), spans: spans?.map(span => toProtocolTextSpan(span, scriptInfo)) }, + kind); } catch (err) { this.logError(err, kind); From 22637a4a148b66216e1f97790a937ffe3c30f0ce Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 8 Mar 2024 12:38:12 -0800 Subject: [PATCH 09/74] add perf for testing --- src/server/protocol.ts | 3 +++ src/server/session.ts | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index c621de0de8c12..0e1be456e04ed 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -2912,6 +2912,9 @@ export interface DiagnosticEventBody { * Spans where the region diagnostic was requested, if this is a region semantic diagnostic event. */ spans?: TextSpan[]; + + // >> TODO: remove this; testing only + perf?: string; } export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag" | "regionSemanticDiag"; diff --git a/src/server/session.ts b/src/server/session.ts index 2ad4010ed4440..45d0dfce9fbdb 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -995,6 +995,9 @@ export class Session implements EventSender { private eventHandler: ProjectServiceEventHandler | undefined; private readonly noGetErrOnBackgroundUpdate?: boolean; + // >> TODO: for testing; remove later. + private checkTime: [number, number] | undefined; + constructor(opts: SessionOptions) { this.host = opts.host; this.cancellationToken = opts.cancellationToken; @@ -1259,6 +1262,7 @@ export class Session implements EventSender { } private semanticCheck(file: NormalizedPath, project: Project) { + this.checkTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "semanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails const diags = isDeclarationFileInJSOnlyNonConfiguredProject(project, file) ? emptyArray @@ -1268,18 +1272,21 @@ export class Session implements EventSender { } private syntacticCheck(file: NormalizedPath, project: Project) { + this.checkTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "syntacticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag"); tracing?.pop(); } private suggestionCheck(file: NormalizedPath, project: Project) { + this.checkTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "suggestionCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag"); tracing?.pop(); } private regionSemanticCheck(file: NormalizedPath, project: Project, ranges: TextRange[]) { + this.checkTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails // >> TODO: get adjusted ranges from the nodes we actually end up checking... this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSemanticDiagnostics(file, ranges), "regionSemanticDiag", ranges.map(createTextSpanFromRange)); @@ -1290,7 +1297,12 @@ export class Session implements EventSender { try { const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); this.event( - { file, diagnostics: diagnostics.map(diag => formatDiag(file, project, diag)), spans: spans?.map(span => toProtocolTextSpan(span, scriptInfo)) }, + { + file, + diagnostics: diagnostics.map(diag => formatDiag(file, project, diag)), + spans: spans?.map(span => toProtocolTextSpan(span, scriptInfo)), + perf: hrTimeToMilliseconds(this.hrtime(this.checkTime)).toFixed(4), + }, kind); } catch (err) { From 6e03d0166a27a4fc28fe3a759b13a9d2261880a3 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 12 Mar 2024 16:21:09 -0700 Subject: [PATCH 10/74] include less nodes in nodes to check --- src/compiler/checker.ts | 10 ++++++++-- src/compiler/utilitiesPublic.ts | 2 +- src/services/refactors/extractSymbol.ts | 14 +------------- src/services/services.ts | 25 ++++++++++++++++++++++++- src/services/utilities.ts | 13 +++++++++++++ 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d41101d03624e..ecaaac60a38ff 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -47108,9 +47108,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length; - checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck); // >> TODO: change this - // >> TODO: where do we clean up the diagnostics? + checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck); const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); + if (nodesToCheck) { + // No need to get global diagnostics; + // reset diagnostic collection. + // >> TODO: do we really need this? + diagnostics = createDiagnosticCollection(); + return semanticDiagnostics; + } const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); if (currentGlobalDiagnostics !== previousGlobalDiagnostics) { // If the arrays are not the same reference, new diagnostics were added. diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 745442bf1b907..7e5c1f5371c7d 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -403,7 +403,7 @@ export function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan /** @internal */ export function normalizeSpans(spans: readonly TextSpan[]): TextSpan[] { - spans = spans.filter(span => span.length <= 0).sort((a, b) => { + spans = spans.filter(span => span.length > 0).sort((a, b) => { return a.start !== b.start ? a.start - b.start : a.length - b.length; }); diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index e55e4e37f7af5..b9406e8f1b594 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -6,7 +6,6 @@ import { assertType, BindingElement, Block, - BlockLike, BreakStatement, CancellationToken, canHaveModifiers, @@ -67,6 +66,7 @@ import { isAssignmentExpression, isBinaryExpression, isBlock, + isBlockLike, isBlockScope, isCaseClause, isClassLike, @@ -2221,18 +2221,6 @@ function isExtractableExpression(node: Node): boolean { return true; } -function isBlockLike(node: Node): node is BlockLike { - switch (node.kind) { - case SyntaxKind.Block: - case SyntaxKind.SourceFile: - case SyntaxKind.ModuleBlock: - case SyntaxKind.CaseClause: - return true; - default: - return false; - } -} - function isInJSXContent(node: Node) { return isStringLiteralJsxAttribute(node) || (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && (isJsxElement(node.parent) || isJsxFragment(node.parent)); diff --git a/src/services/services.ts b/src/services/services.ts index 9675fe8da47e4..bebf6afcfb082 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -144,6 +144,7 @@ import { IntersectionType, isArray, isBindingPattern, + isBlockLike, isComputedPropertyName, isConstTypeReference, IScriptSnapshot, @@ -2055,11 +2056,33 @@ export function createLanguageService( const endToken = findTokenOnLeftOfPosition(file, textSpanEnd(span)) || file; const enclosingNode = findAncestor(endToken, node => textRangeContainsTextSpan(node, span))!; - const nodes = enclosingNode === file ? file.statements.filter(s => textRangeIntersectsWithTextSpan(s, span)) : [enclosingNode]; + const nodes = []; + enclosingNode.forEachChild(includeNodes); + if (file.end === span.start + span.length) { nodes.push(file.endOfFileToken); } return nodes; + + function includeNodes(node: Node): true | undefined { + if (!textRangeIntersectsWithTextSpan(node, span)) { + // TODO: if node is after span, we can quit the rest of the for each child calls + if (node.pos >= span.start + span.length) { + return true; + } + return; + } + if (textSpanContainsTextRange(span, node) || !isBlockLike(node)) { + nodes.push(node); + return; + } + const stmts = node.statements.filter(node => textRangeIntersectsWithTextSpan(node, span)); + if (stmts.length === node.statements.length) { + nodes.push(node); + return; + } + stmts.forEach(includeNodes); + } } function getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[] { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 0b2072f449008..73793f6859de3 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -9,6 +9,7 @@ import { BinaryExpression, binarySearchKey, BindingElement, + BlockLike, BreakOrContinueStatement, CallExpression, canHaveModifiers, @@ -4274,3 +4275,15 @@ export function fileShouldUseJavaScriptRequire(file: SourceFile | string, progra } return preferRequire; } + +export function isBlockLike(node: Node): node is BlockLike { + switch (node.kind) { + case SyntaxKind.Block: + case SyntaxKind.SourceFile: + case SyntaxKind.ModuleBlock: + case SyntaxKind.CaseClause: + return true; + default: + return false; + } +} \ No newline at end of file From 7af55c249de66f0d5967c0b3dd2efdd894113e36 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 14 Mar 2024 20:57:21 -0700 Subject: [PATCH 11/74] add unit test, more fixes --- src/compiler/checker.ts | 3 +- src/compiler/program.ts | 2 - src/harness/client.ts | 4 + src/server/session.ts | 98 +++++++++++-------- src/services/services.ts | 31 +++--- src/services/types.ts | 12 ++- src/services/utilities.ts | 2 +- src/testRunner/tests.ts | 1 + .../unittests/tsserver/regionDiagnostics.ts | 74 ++++++++++++++ 9 files changed, 161 insertions(+), 66 deletions(-) create mode 100644 src/testRunner/unittests/tsserver/regionDiagnostics.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ecaaac60a38ff..66dd69428e49d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -46941,7 +46941,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { tracing?.pop(); } - function checkSourceFile(node: SourceFile, nodesToCheck: Node[] | undefined) { // >> TODO: change here? + function checkSourceFile(node: SourceFile, nodesToCheck: Node[] | undefined) { tracing?.push(tracing.Phase.Check, nodesToCheck ? "checkSourceFileNodes" : "checkSourceFile", { path: node.path }, /*separateBeginAndEnd*/ true); const beforeMark = nodesToCheck ? "beforeCheckNodes" : "beforeCheck"; const afterMark = nodesToCheck ? "afterCheckNodes" : "afterCheck"; @@ -47113,7 +47113,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (nodesToCheck) { // No need to get global diagnostics; // reset diagnostic collection. - // >> TODO: do we really need this? diagnostics = createDiagnosticCollection(); return semanticDiagnostics; } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 3ddc112c86c28..83d5ec54d4de3 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2892,7 +2892,6 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg cancellationToken: CancellationToken | undefined, nodesToCheck: Node[] | undefined, ): readonly Diagnostic[] { - // >> TODO: what the hell is `getProgramDiagnostics` doing??? it does something related to directives/comments... return concatenate( filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options), getProgramDiagnostics(sourceFile), @@ -2904,7 +2903,6 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg cancellationToken: CancellationToken | undefined, nodesToCheck: Node[] | undefined, ): readonly Diagnostic[] { - // >> TODO: we might not want to cache if `nodesToCheck` is provided?? if (nodesToCheck) { return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck); } diff --git a/src/harness/client.ts b/src/harness/client.ts index 8663fa48a9ede..d695a390a0401 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -56,6 +56,7 @@ import { RefactorTriggerReason, ReferencedSymbol, ReferenceEntry, + RegionDiagnosticsResult, RenameInfo, RenameInfoFailure, RenameInfoSuccess, @@ -502,6 +503,9 @@ export class SessionClient implements LanguageService { getSuggestionDiagnostics(file: string): DiagnosticWithLocation[] { return this.getDiagnostics(file, protocol.CommandTypes.SuggestionDiagnosticsSync); } + getRegionSemanticDiagnostics(_file: string, _ranges: TextRange[]): RegionDiagnosticsResult | undefined { + throw new Error("Method not implemented."); + } private getDiagnostics(file: string, command: protocol.CommandTypes): DiagnosticWithLocation[] { const request = this.processRequest(command, { file, includeLinePosition: true }); diff --git a/src/server/session.ts b/src/server/session.ts index 45d0dfce9fbdb..aca8cf6bb0424 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -995,6 +995,9 @@ export class Session implements EventSender { private eventHandler: ProjectServiceEventHandler | undefined; private readonly noGetErrOnBackgroundUpdate?: boolean; + // Maps a file name to duration in milliseconds of semantic checking + private semanticCheckPerformance: Map; + // >> TODO: for testing; remove later. private checkTime: [number, number] | undefined; @@ -1008,6 +1011,7 @@ export class Session implements EventSender { this.canUseEvents = opts.canUseEvents; this.suppressDiagnosticEvents = opts.suppressDiagnosticEvents; this.noGetErrOnBackgroundUpdate = opts.noGetErrOnBackgroundUpdate; + this.semanticCheckPerformance = new Map(); const { throttleWaitMilliseconds } = opts; @@ -1285,25 +1289,42 @@ export class Session implements EventSender { tracing?.pop(); } - private regionSemanticCheck(file: NormalizedPath, project: Project, ranges: TextRange[]) { + private regionSemanticCheck(file: NormalizedPath, project: Project, ranges: TextRange[]): boolean { this.checkTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails - // >> TODO: get adjusted ranges from the nodes we actually end up checking... - this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSemanticDiagnostics(file, ranges), "regionSemanticDiag", ranges.map(createTextSpanFromRange)); + let diagnosticsResult; + if (!this.shouldDoRegionCheck(file) || !(diagnosticsResult = project.getLanguageService().getRegionSemanticDiagnostics(file, ranges))) { + tracing?.pop(); + return false; + } + this.sendDiagnosticsEvent(file, project, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsResult.ranges.map(createTextSpanFromRange)); tracing?.pop(); + return true; + } + + // We should only do the region-based semantic check if we think it would be considerably faster than a whole-file semantic check + protected shouldDoRegionCheck(file: NormalizedPath): boolean { + const perf = this.semanticCheckPerformance.get(file); + // >> TODO: force this to be true when testing + return !!perf && perf > 1000; } private sendDiagnosticsEvent(file: NormalizedPath, project: Project, diagnostics: readonly Diagnostic[], kind: protocol.DiagnosticEventKind, spans?: TextSpan[]): void { try { const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); + const perf = hrTimeToMilliseconds(this.hrtime(this.checkTime)); + if (kind === "semanticDiag") { + this.semanticCheckPerformance?.set(file, perf); + } this.event( { file, diagnostics: diagnostics.map(diag => formatDiag(file, project, diag)), spans: spans?.map(span => toProtocolTextSpan(span, scriptInfo)), - perf: hrTimeToMilliseconds(this.hrtime(this.checkTime)).toFixed(4), + // perf: perf.toFixed(4), }, - kind); + kind, + ); } catch (err) { this.logError(err, kind); @@ -1325,9 +1346,9 @@ export class Session implements EventSender { const seq = this.changeSeq; const followMs = Math.min(ms, 200); - const filesFullCheck: PendingErrorCheck[] = []; + const filesFullCheck: (PendingErrorCheck & { project: Project; })[] = []; let index = 0; - const goNext = () => { + const goNextAllCheck = () => { index++; if (checkList.length > index) { return next.delay("checkOne", followMs, checkOne); @@ -1337,13 +1358,29 @@ export class Session implements EventSender { return next.delay("checkFullOne", followMs, checkFull); } }; - const goNextFull = () => { + const goNextSemanticCheck = () => { index++; if (filesFullCheck.length > index) { return next.delay("checkFullOne", followMs, checkFull); } }; + const doSemanticCheck = (fileName: NormalizedPath, project: Project, goToNext: () => void) => { + this.semanticCheck(fileName, project); + if (this.changeSeq !== seq) { + return; + } + + if (this.getPreferences(fileName).disableSuggestions) { + goToNext(); + return; + } + next.immediate("suggestionCheck", () => { + this.suggestionCheck(fileName, project); + goToNext(); + }); + }; + const checkOne = () => { if (this.changeSeq !== seq) { return; @@ -1367,33 +1404,24 @@ export class Session implements EventSender { // Don't provide semantic diagnostics unless we're in full semantic mode. if (project.projectService.serverMode !== LanguageServiceMode.Semantic) { - goNext(); + goNextAllCheck(); return; } if (ranges) { return next.immediate("regionSemanticCheck", () => { - this.regionSemanticCheck(fileName, project, ranges); - filesFullCheck.push({ fileName, project }); - goNext(); + const didRegionCheck = this.regionSemanticCheck(fileName, project, ranges); + if (didRegionCheck) { + filesFullCheck.push({ fileName, project }); + goNextAllCheck(); + } + else { // If we opted out of region check, do semantic check as normal + doSemanticCheck(fileName, project, goNextAllCheck); + } }); } - next.immediate("semanticCheck", () => { - this.semanticCheck(fileName, project); - if (this.changeSeq !== seq) { - return; - } - - if (this.getPreferences(fileName).disableSuggestions) { - goNext(); - return; - } - next.immediate("suggestionCheck", () => { - this.suggestionCheck(fileName, project); - goNext(); - }); - }); + next.immediate("semanticCheck", () => doSemanticCheck(fileName, project, goNextAllCheck)); }; const checkFull = () => { @@ -1402,21 +1430,7 @@ export class Session implements EventSender { } const { fileName, project } = filesFullCheck[index]; - next.immediate("semanticCheck", () => { - this.semanticCheck(fileName, project!); - if (this.changeSeq !== seq) { - return; - } - - if (this.getPreferences(fileName).disableSuggestions) { - goNextFull(); - return; - } - next.immediate("suggestionCheck", () => { - this.suggestionCheck(fileName, project!); - goNextFull(); - }); - }); + next.immediate("semanticCheck", () => doSemanticCheck(fileName, project, goNextSemanticCheck)); }; if (checkList.length > index && this.changeSeq === seq) { diff --git a/src/services/services.ts b/src/services/services.ts index bebf6afcfb082..221ba34a2ecc2 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -40,6 +40,7 @@ import { CreateProgramOptions, createSourceFile, CreateSourceFileOptions, + createTextRangeFromNode, createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, @@ -255,6 +256,7 @@ import { RefactorTriggerReason, ReferencedSymbol, ReferenceEntry, + RegionDiagnosticsResult, Rename, RenameInfo, RenameInfoOptions, @@ -1989,10 +1991,7 @@ export function createLanguageService( * getSemanticDiagnostics return array of Diagnostics. If '-d' is not enabled, only report semantic errors * If '-d' enabled, report both semantic and emitter errors */ - function getSemanticDiagnostics(fileName: string, ranges?: TextRange[]): Diagnostic[] { - if (ranges) { - return getRegionSemanticDiagnostics(fileName, ranges); - } + function getSemanticDiagnostics(fileName: string): Diagnostic[] { synchronizeHostData(); const targetSourceFile = getValidSourceFile(fileName); @@ -2010,25 +2009,20 @@ export function createLanguageService( return [...semanticDiagnostics, ...declarationDiagnostics]; } - // TODO: - // same as `getSemanticDiagnostics`. Maybe should be a single function that takes an optional ranges arg. We'll see. - function getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): Diagnostic[] { + function getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): RegionDiagnosticsResult | undefined { synchronizeHostData(); const targetSourceFile = getValidSourceFile(fileName); - // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. - // Therefore only get diagnostics for given file. const nodes = getNodesForRanges(targetSourceFile, ranges); + if (!nodes) { + return undefined; + } const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes); - // if (!getEmitDeclarations(program.getCompilerOptions())) { - return semanticDiagnostics.slice(); - // } - - // >> TODO: check if we need to update this too? - // If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface - // const declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken); - // return [...semanticDiagnostics, ...declarationDiagnostics]; + return { + diagnostics: semanticDiagnostics.slice(), + ranges: nodes.map(node => createTextRangeFromNode(node, targetSourceFile)), // >> TODO: return span, and normalize them + } } function getNodesForRanges(file: SourceFile, ranges: TextRange[]): Node[] | undefined { @@ -2063,7 +2057,7 @@ export function createLanguageService( nodes.push(file.endOfFileToken); } return nodes; - + function includeNodes(node: Node): true | undefined { if (!textRangeIntersectsWithTextSpan(node, span)) { // TODO: if node is after span, we can quit the rest of the for each child calls @@ -3188,6 +3182,7 @@ export function createLanguageService( cleanupSemanticCache, getSyntacticDiagnostics, getSemanticDiagnostics, + getRegionSemanticDiagnostics, getSuggestionDiagnostics, getCompilerOptionsDiagnostics, getSyntacticClassifications, diff --git a/src/services/types.ts b/src/services/types.ts index d19ae9fe5590a..a49c396d92c26 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -445,6 +445,11 @@ export const enum SemanticClassificationFormat { TwentyTwenty = "2020", } +export interface RegionDiagnosticsResult { + diagnostics: Diagnostic[]; + ranges: TextRange[]; +} + // // Public services of a language service instance associated // with a language service host instance @@ -487,7 +492,12 @@ export interface LanguageService { * * @param fileName A path to the file you want semantic diagnostics for */ - getSemanticDiagnostics(fileName: string, ranges?: TextRange[]): Diagnostic[]; + getSemanticDiagnostics(fileName: string): Diagnostic[]; + + /** + * >> TODO: description + */ + getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): RegionDiagnosticsResult | undefined; /** * Gets suggestion diagnostics for a specific file. These diagnostics tend to diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 73793f6859de3..f16741670521b 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -4286,4 +4286,4 @@ export function isBlockLike(node: Node): node is BlockLike { default: return false; } -} \ No newline at end of file +} diff --git a/src/testRunner/tests.ts b/src/testRunner/tests.ts index 01d5ddea11d4d..1fd0275a7f811 100644 --- a/src/testRunner/tests.ts +++ b/src/testRunner/tests.ts @@ -191,6 +191,7 @@ import "./unittests/tsserver/projectReferencesSourcemap"; import "./unittests/tsserver/projects"; import "./unittests/tsserver/projectsWithReferences"; import "./unittests/tsserver/refactors"; +import "./unittests/tsserver/regionDiagnostics"; import "./unittests/tsserver/reload"; import "./unittests/tsserver/reloadProjects"; import "./unittests/tsserver/rename"; diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts new file mode 100644 index 0000000000000..68b9ebcf8d104 --- /dev/null +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -0,0 +1,74 @@ +import * as ts from "../../_namespaces/ts"; +import { + baselineTsserverLogs, + TestSession, + TestSessionConstructorOptions, +} from "../helpers/tsserver"; +import { + createServerHost, +} from "../helpers/virtualFileSystemWithWatch"; + +describe("unittests:: tsserver:: regionDiagnostics", () => { + it("diagnostics for select nodes", () => { + const file1 = { + path: "/a/b/app.ts", + content: +`function foo(x: number, y: string): number { + return x + y; +} + + + +foo(10, 50);` + } + const host = createServerHost([file1]); + const session = new RegionTestSession(host); + + session.executeCommandSeq({ + command: ts.server.protocol.CommandTypes.Open, + arguments: { file: file1.path }, + }); + + verifyGetErrRegionRequest({ + session, + files: [{ + file: file1.path, + ranges: [{ startLine: 6, startOffset: 1, endLine: 7, endOffset: 13 }] + }], + }); + + baselineTsserverLogs("regionDiagnostics", "diagnostics for select nodes", session); + }); +}); + +interface VerifyGetErrRegionRequest { + session: TestSession; + files: ts.server.protocol.FileRangesRequestArgs[]; +} + +function verifyGetErrRegionRequest(request: VerifyGetErrRegionRequest): void { + const { session, files } = request; + + session.executeCommandSeq({ + command: ts.server.protocol.CommandTypes.Geterr, + arguments: { + delay: 0, + files + }, + }); + + session.host.runQueuedTimeoutCallbacks(); + for (let i = 0; i < 3; ++i) { + session.host.runQueuedImmediateCallbacks(); + } +} + +class RegionTestSession extends TestSession { + constructor(optsOrHost: TestSessionConstructorOptions) { + super(optsOrHost); + } + + protected override shouldDoRegionCheck(file: ts.server.NormalizedPath): boolean { + return true; + } +} \ No newline at end of file From 1d2b6654dc7a9e1ca49dc8a069e20b6e0d354d8a Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 15 Mar 2024 14:32:39 -0700 Subject: [PATCH 12/74] fix things and add unit test --- src/compiler/checker.ts | 8 +- src/compiler/utilities.ts | 101 ++++++++ src/server/session.ts | 2 +- src/services/services.ts | 17 +- src/services/types.ts | 2 +- .../unittests/tsserver/regionDiagnostics.ts | 26 +- .../diagnostics-for-select-nodes.js | 235 ++++++++++++++++++ 7 files changed, 367 insertions(+), 24 deletions(-) create mode 100644 tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 66dd69428e49d..b7ca8fd38595d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -46579,6 +46579,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, Diagnostics.Unreachable_code_detected); } + // If editing this, keep `isSourceElement` in utilities up to date. switch (kind) { case SyntaxKind.TypeParameter: return checkTypeParameter(node as TypeParameterDeclaration); @@ -47053,15 +47054,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return; } - // >> TODO: skip this? do this? // Grammar checking checkGrammarSourceFile(file); forEach(nodes, checkSourceElement); checkDeferredNodes(file); - - // >> TODO: do `checkPotentialUncheckedRenamedBindingElementsInTypes`? } } @@ -47111,9 +47109,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck); const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); if (nodesToCheck) { - // No need to get global diagnostics; - // reset diagnostic collection. - diagnostics = createDiagnosticCollection(); + // No need to get global diagnostics. return semanticDiagnostics; } const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6b3b2aed34994..9b3221b0b53eb 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -10671,3 +10671,104 @@ export function replaceFirstStar(s: string, replacement: string): string { export function getNameFromImportAttribute(node: ImportAttribute) { return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text); } + +/** @internal */ +export function isSourceElement(node: Node): boolean { + switch (node.kind) { + case SyntaxKind.TypeParameter: + case SyntaxKind.Parameter: + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + case SyntaxKind.ConstructorType: + case SyntaxKind.FunctionType: + case SyntaxKind.CallSignature: + case SyntaxKind.ConstructSignature: + case SyntaxKind.IndexSignature: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.ClassStaticBlockDeclaration: + case SyntaxKind.Constructor: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.TypeReference: + case SyntaxKind.TypePredicate: + case SyntaxKind.TypeQuery: + case SyntaxKind.TypeLiteral: + case SyntaxKind.ArrayType: + case SyntaxKind.TupleType: + case SyntaxKind.UnionType: + case SyntaxKind.IntersectionType: + case SyntaxKind.ParenthesizedType: + case SyntaxKind.OptionalType: + case SyntaxKind.RestType: + case SyntaxKind.ThisType: + case SyntaxKind.TypeOperator: + case SyntaxKind.ConditionalType: + case SyntaxKind.InferType: + case SyntaxKind.TemplateLiteralType: + case SyntaxKind.ImportType: + case SyntaxKind.NamedTupleMember: + case SyntaxKind.JSDocAugmentsTag: + case SyntaxKind.JSDocImplementsTag: + case SyntaxKind.JSDocTypedefTag: + case SyntaxKind.JSDocCallbackTag: + case SyntaxKind.JSDocEnumTag: + case SyntaxKind.JSDocTemplateTag: + case SyntaxKind.JSDocTypeTag: + case SyntaxKind.JSDocLink: + case SyntaxKind.JSDocLinkCode: + case SyntaxKind.JSDocLinkPlain: + case SyntaxKind.JSDocParameterTag: + case SyntaxKind.JSDocPropertyTag: + case SyntaxKind.JSDocFunctionType: + case SyntaxKind.JSDocNonNullableType: + case SyntaxKind.JSDocNullableType: + case SyntaxKind.JSDocAllType: + case SyntaxKind.JSDocUnknownType: + case SyntaxKind.JSDocTypeLiteral: + case SyntaxKind.JSDocVariadicType: + case SyntaxKind.JSDocTypeExpression: + case SyntaxKind.JSDocPublicTag: + case SyntaxKind.JSDocProtectedTag: + case SyntaxKind.JSDocPrivateTag: + case SyntaxKind.JSDocSatisfiesTag: + case SyntaxKind.JSDocThisTag: + case SyntaxKind.IndexedAccessType: + case SyntaxKind.MappedType: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.Block: + case SyntaxKind.ModuleBlock: + case SyntaxKind.VariableStatement: + case SyntaxKind.ExpressionStatement: + case SyntaxKind.IfStatement: + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + case SyntaxKind.ForStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: + case SyntaxKind.ContinueStatement: + case SyntaxKind.BreakStatement: + case SyntaxKind.ReturnStatement: + case SyntaxKind.WithStatement: + case SyntaxKind.SwitchStatement: + case SyntaxKind.LabeledStatement: + case SyntaxKind.ThrowStatement: + case SyntaxKind.TryStatement: + case SyntaxKind.VariableDeclaration: + case SyntaxKind.BindingElement: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ExportDeclaration: + case SyntaxKind.ExportAssignment: + case SyntaxKind.EmptyStatement: + case SyntaxKind.DebuggerStatement: + case SyntaxKind.MissingDeclaration: + return true; + } + return false; +} diff --git a/src/server/session.ts b/src/server/session.ts index aca8cf6bb0424..ad8b0210e0e19 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1297,7 +1297,7 @@ export class Session implements EventSender { tracing?.pop(); return false; } - this.sendDiagnosticsEvent(file, project, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsResult.ranges.map(createTextSpanFromRange)); + this.sendDiagnosticsEvent(file, project, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsResult.spans); tracing?.pop(); return true; } diff --git a/src/services/services.ts b/src/services/services.ts index 221ba34a2ecc2..837abea560d8a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -184,6 +184,7 @@ import { isRightSideOfPropertyAccess, isRightSideOfQualifiedName, isSetAccessor, + isSourceElement, isStringOrNumericLiteralLike, isTagName, isTextWhiteSpaceLike, @@ -2021,8 +2022,8 @@ export function createLanguageService( const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes); return { diagnostics: semanticDiagnostics.slice(), - ranges: nodes.map(node => createTextRangeFromNode(node, targetSourceFile)), // >> TODO: return span, and normalize them - } + spans: normalizeSpans(nodes.map(node => createTextSpanFromNode(node, targetSourceFile))), + }; } function getNodesForRanges(file: SourceFile, ranges: TextRange[]): Node[] | undefined { @@ -2060,23 +2061,29 @@ export function createLanguageService( function includeNodes(node: Node): true | undefined { if (!textRangeIntersectsWithTextSpan(node, span)) { - // TODO: if node is after span, we can quit the rest of the for each child calls if (node.pos >= span.start + span.length) { return true; } return; } if (textSpanContainsTextRange(span, node) || !isBlockLike(node)) { - nodes.push(node); + includeNode(node); return; } const stmts = node.statements.filter(node => textRangeIntersectsWithTextSpan(node, span)); if (stmts.length === node.statements.length) { - nodes.push(node); + includeNode(node); return; } stmts.forEach(includeNodes); } + + function includeNode(node: Node): void { + while (!isSourceElement(node)) { + node = node.parent; + } + nodes.push(node); + } } function getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[] { diff --git a/src/services/types.ts b/src/services/types.ts index a49c396d92c26..caf04be167608 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -447,7 +447,7 @@ export const enum SemanticClassificationFormat { export interface RegionDiagnosticsResult { diagnostics: Diagnostic[]; - ranges: TextRange[]; + spans: TextSpan[]; } // diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index 68b9ebcf8d104..1f2f5944e610a 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -12,15 +12,14 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { it("diagnostics for select nodes", () => { const file1 = { path: "/a/b/app.ts", - content: -`function foo(x: number, y: string): number { + content: `function foo(x: number, y: string): number { return x + y; } -foo(10, 50);` - } +foo(10, 50);`, + }; const host = createServerHost([file1]); const session = new RegionTestSession(host); @@ -33,7 +32,7 @@ foo(10, 50);` session, files: [{ file: file1.path, - ranges: [{ startLine: 6, startOffset: 1, endLine: 7, endOffset: 13 }] + ranges: [{ startLine: 6, startOffset: 1, endLine: 7, endOffset: 13 }], }], }); @@ -53,14 +52,19 @@ function verifyGetErrRegionRequest(request: VerifyGetErrRegionRequest): void { command: ts.server.protocol.CommandTypes.Geterr, arguments: { delay: 0, - files + files, }, }); + // Run syntax diagnostics session.host.runQueuedTimeoutCallbacks(); - for (let i = 0; i < 3; ++i) { - session.host.runQueuedImmediateCallbacks(); - } + // Run region semantic diagnostics + session.host.runQueuedImmediateCallbacks(); + // Run full semantic diagnostics + session.host.runQueuedTimeoutCallbacks(); + session.host.runQueuedImmediateCallbacks(); + // Run suggestion diagnostics + session.host.runQueuedImmediateCallbacks(); } class RegionTestSession extends TestSession { @@ -68,7 +72,7 @@ class RegionTestSession extends TestSession { super(optsOrHost); } - protected override shouldDoRegionCheck(file: ts.server.NormalizedPath): boolean { + protected override shouldDoRegionCheck(_file: ts.server.NormalizedPath): boolean { return true; } -} \ No newline at end of file +} diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js new file mode 100644 index 0000000000000..b7debe8eadf9f --- /dev/null +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js @@ -0,0 +1,235 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +Before request +//// [/a/b/app.ts] +function foo(x: number, y: string): number { + return x + y; +} + + + +foo(10, 50); + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/a/b/app.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /a/b +Info seq [hh:mm:ss:mss] For info: /a/b/app.ts :: No config files found. +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject1* WatchType: Missing file +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 (1) + /a/b/app.ts SVC-1-0 "function foo(x: number, y: string): number {\n return x + y;\n}\n\n\n\nfoo(10, 50);" + + + app.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 (1) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /a/b/app.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/a/lib/lib.d.ts: *new* + {"pollingInterval":500} + +Projects:: +/dev/null/inferredProject1* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/a/b/app.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject1* *default* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "geterr", + "arguments": { + "delay": 0, + "files": [ + { + "file": "/a/b/app.ts", + "ranges": [ + { + "startLine": 6, + "startOffset": 1, + "endLine": 7, + "endOffset": 13 + } + ] + } + ] + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Timeout callback:: count: 1 +1: checkOne *new* + +Before running Timeout callback:: count: 1 +1: checkOne + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [] + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +1: regionSemanticCheck *new* + +Before running Immedidate callback:: count: 1 +1: regionSemanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "regionSemanticDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [ + { + "start": { + "line": 7, + "offset": 9 + }, + "end": { + "line": 7, + "offset": 11 + }, + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "code": 2345, + "category": "error" + } + ], + "spans": [ + { + "start": { + "line": 7, + "offset": 1 + }, + "end": { + "line": 7, + "offset": 13 + } + } + ] + } + } +After running Immedidate callback:: count: 0 + +Timeout callback:: count: 1 +2: checkFullOne *new* + +Before running Timeout callback:: count: 1 +2: checkFullOne + +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +2: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +2: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [ + { + "start": { + "line": 2, + "offset": 5 + }, + "end": { + "line": 2, + "offset": 11 + }, + "text": "Type 'string' is not assignable to type 'number'.", + "code": 2322, + "category": "error" + }, + { + "start": { + "line": 7, + "offset": 9 + }, + "end": { + "line": 7, + "offset": 11 + }, + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "code": 2345, + "category": "error" + } + ] + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +3: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +3: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "requestCompleted", + "body": { + "request_seq": 2 + } + } +After running Immedidate callback:: count: 0 From c25a879809aef083f44b730327407acc5cdb84a5 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 18 Mar 2024 18:16:59 -0700 Subject: [PATCH 13/74] refactors --- src/compiler/program.ts | 2 +- src/compiler/utilities.ts | 2 +- src/server/protocol.ts | 6 ++-- src/server/session.ts | 36 ++++++++++--------- src/services/services.ts | 10 ++++-- src/services/types.ts | 2 +- src/testRunner/unittests/helpers/tsserver.ts | 1 + src/testRunner/unittests/tsserver/session.ts | 3 ++ tests/baselines/reference/api/typescript.d.ts | 11 ++++-- 9 files changed, 47 insertions(+), 26 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index c9dc609866a6e..09b292c1146ab 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2801,7 +2801,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg function getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[] { return getDiagnosticsHelper( sourceFile, - (sourceFile, cancellationToken) => getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), // >> TODO: this is slightly sketchy because relies on this function only being called with the same sourcefile that originated the nodesToCheck + (sourceFile, cancellationToken) => getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), cancellationToken, ); } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ba9377cd63881..a107091f0b806 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -10737,7 +10737,7 @@ export function isSourceElement(node: Node): boolean { case SyntaxKind.MissingDeclaration: return true; } - return false; + return false; } /** @internal */ diff --git a/src/server/protocol.ts b/src/server/protocol.ts index c174d6a5e61f8..990b966f94eb3 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -2517,8 +2517,10 @@ export interface DiagnosticEventBody { */ spans?: TextSpan[]; - // >> TODO: remove this; testing only - perf?: string; + /** + * Time spent computing the diagnostics, in milliseconds. + */ + duration?: number; } export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag" | "regionSemanticDiag"; diff --git a/src/server/session.ts b/src/server/session.ts index f329789715c9e..ad157caf9256a 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -23,7 +23,6 @@ import { createSet, createTextSpan, createTextSpanFromBounds, - createTextSpanFromRange, Debug, decodedTextSpanIntersectsWith, deduplicate, @@ -964,6 +963,7 @@ export interface SessionOptions { serverMode?: LanguageServiceMode; throttleWaitMilliseconds?: number; noGetErrOnBackgroundUpdate?: boolean; + includeDiagnosticsDuration?: boolean; globalPlugins?: readonly string[]; pluginProbeLocations?: readonly string[]; @@ -993,12 +993,12 @@ export class Session implements EventSender { private suppressDiagnosticEvents?: boolean; private eventHandler: ProjectServiceEventHandler | undefined; private readonly noGetErrOnBackgroundUpdate?: boolean; + private includeDiagnosticsDuration: boolean; // Maps a file name to duration in milliseconds of semantic checking private semanticCheckPerformance: Map; - // >> TODO: for testing; remove later. - private checkTime: [number, number] | undefined; + private diagnosticsTime: [number, number] | undefined; constructor(opts: SessionOptions) { this.host = opts.host; @@ -1010,6 +1010,7 @@ export class Session implements EventSender { this.canUseEvents = opts.canUseEvents; this.suppressDiagnosticEvents = opts.suppressDiagnosticEvents; this.noGetErrOnBackgroundUpdate = opts.noGetErrOnBackgroundUpdate; + this.includeDiagnosticsDuration = opts.includeDiagnosticsDuration ?? true; this.semanticCheckPerformance = new Map(); const { throttleWaitMilliseconds } = opts; @@ -1265,7 +1266,7 @@ export class Session implements EventSender { } private semanticCheck(file: NormalizedPath, project: Project) { - this.checkTime = this.hrtime(); + this.diagnosticsTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "semanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails const diags = isDeclarationFileInJSOnlyNonConfiguredProject(project, file) ? emptyArray @@ -1275,21 +1276,21 @@ export class Session implements EventSender { } private syntacticCheck(file: NormalizedPath, project: Project) { - this.checkTime = this.hrtime(); + this.diagnosticsTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "syntacticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag"); tracing?.pop(); } private suggestionCheck(file: NormalizedPath, project: Project) { - this.checkTime = this.hrtime(); + this.diagnosticsTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "suggestionCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag"); tracing?.pop(); } private regionSemanticCheck(file: NormalizedPath, project: Project, ranges: TextRange[]): boolean { - this.checkTime = this.hrtime(); + this.diagnosticsTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails let diagnosticsResult; if (!this.shouldDoRegionCheck(file) || !(diagnosticsResult = project.getLanguageService().getRegionSemanticDiagnostics(file, ranges))) { @@ -1304,24 +1305,27 @@ export class Session implements EventSender { // We should only do the region-based semantic check if we think it would be considerably faster than a whole-file semantic check protected shouldDoRegionCheck(file: NormalizedPath): boolean { const perf = this.semanticCheckPerformance.get(file); - // >> TODO: force this to be true when testing return !!perf && perf > 1000; } private sendDiagnosticsEvent(file: NormalizedPath, project: Project, diagnostics: readonly Diagnostic[], kind: protocol.DiagnosticEventKind, spans?: TextSpan[]): void { try { const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); - const perf = hrTimeToMilliseconds(this.hrtime(this.checkTime)); + const duration = hrTimeToMilliseconds(this.hrtime(this.diagnosticsTime)); if (kind === "semanticDiag") { - this.semanticCheckPerformance?.set(file, perf); + this.semanticCheckPerformance?.set(file, duration); + } + + const body: protocol.DiagnosticEventBody = { + file, + diagnostics: diagnostics.map(diag => formatDiag(file, project, diag)), + spans: spans?.map(span => toProtocolTextSpan(span, scriptInfo)), + }; + if (this.includeDiagnosticsDuration) { + body.duration = duration; } this.event( - { - file, - diagnostics: diagnostics.map(diag => formatDiag(file, project, diag)), - spans: spans?.map(span => toProtocolTextSpan(span, scriptInfo)), - // perf: perf.toFixed(4), - }, + body, kind, ); } diff --git a/src/services/services.ts b/src/services/services.ts index 837abea560d8a..eb16e2a3d7f52 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -40,7 +40,6 @@ import { CreateProgramOptions, createSourceFile, CreateSourceFileOptions, - createTextRangeFromNode, createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, @@ -185,6 +184,7 @@ import { isRightSideOfQualifiedName, isSetAccessor, isSourceElement, + isSourceFile, isStringOrNumericLiteralLike, isTagName, isTextWhiteSpaceLike, @@ -281,6 +281,7 @@ import { SignatureKind, singleElementArray, SmartSelectionRange, + some, SortedArray, SourceFile, SourceFileLike, @@ -2057,6 +2058,11 @@ export function createLanguageService( if (file.end === span.start + span.length) { nodes.push(file.endOfFileToken); } + + if (some(nodes, isSourceFile)) { + return undefined; + } + return nodes; function includeNodes(node: Node): true | undefined { @@ -2079,7 +2085,7 @@ export function createLanguageService( } function includeNode(node: Node): void { - while (!isSourceElement(node)) { + while (node.parent && !isSourceElement(node)) { node = node.parent; } nodes.push(node); diff --git a/src/services/types.ts b/src/services/types.ts index 530b4d9158512..726f98543dd9a 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -495,7 +495,7 @@ export interface LanguageService { getSemanticDiagnostics(fileName: string): Diagnostic[]; /** - * >> TODO: description + * Similar to {@link getSemanticDiagnostics}, but only checks the specified ranges of the file for diagnostics. */ getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): RegionDiagnosticsResult | undefined; diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index d206ac660283f..efaf88f80c105 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -127,6 +127,7 @@ export class TestSession extends ts.server.Session { incrementalVerifier, typesMapLocation: customTypesMap.path, typingsInstaller, + includeDiagnosticsDuration: false, ...opts, }); if (typingsInstaller) typingsInstaller.session = this; diff --git a/src/testRunner/unittests/tsserver/session.ts b/src/testRunner/unittests/tsserver/session.ts index 6fb2fb4f4edbe..9daccdeab3e02 100644 --- a/src/testRunner/unittests/tsserver/session.ts +++ b/src/testRunner/unittests/tsserver/session.ts @@ -75,6 +75,7 @@ describe("unittests:: tsserver:: Session:: General functionality", () => { logger: nullLogger(), canUseEvents: true, incrementalVerifier, + includeDiagnosticsDuration: false, }; return new TestSession(opts); } @@ -408,6 +409,7 @@ describe("unittests:: tsserver:: Session:: exceptions", () => { logger: nullLogger(), canUseEvents: true, incrementalVerifier, + includeDiagnosticsDuration: false, }); this.addProtocolHandler(command, this.exceptionRaisingHandler); } @@ -455,6 +457,7 @@ describe("unittests:: tsserver:: Session:: how Session is extendable via subclas logger: createHasErrorMessageLogger(), canUseEvents: true, incrementalVerifier, + includeDiagnosticsDuration: false, }); this.addProtocolHandler(this.customHandler, () => { return { response: undefined, responseRequired: true }; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 94d9bab7aebb0..af891dec6f9f5 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1913,7 +1913,10 @@ declare namespace ts { * Spans where the region diagnostic was requested, if this is a region semantic diagnostic event. */ spans?: TextSpan[]; - perf?: string; + /** + * Time spent computing the diagnostics, in milliseconds. + */ + duration?: number; } export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag" | "regionSemanticDiag"; /** @@ -3372,6 +3375,7 @@ declare namespace ts { serverMode?: LanguageServiceMode; throttleWaitMilliseconds?: number; noGetErrOnBackgroundUpdate?: boolean; + includeDiagnosticsDuration?: boolean; globalPlugins?: readonly string[]; pluginProbeLocations?: readonly string[]; allowLocalPluginLoads?: boolean; @@ -3394,8 +3398,9 @@ declare namespace ts { private suppressDiagnosticEvents?; private eventHandler; private readonly noGetErrOnBackgroundUpdate?; + private includeDiagnosticsDuration; private semanticCheckPerformance; - private checkTime; + private diagnosticsTime; constructor(opts: SessionOptions); private sendRequestCompletedEvent; private addPerformanceData; @@ -9961,7 +9966,7 @@ declare namespace ts { */ getSemanticDiagnostics(fileName: string): Diagnostic[]; /** - * >> TODO: description + * Similar to {@link getSemanticDiagnostics}, but only checks the specified ranges of the file for diagnostics. */ getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): RegionDiagnosticsResult | undefined; /** From 0a55946b171619ae458d60a71d27d3e6aef58f54 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 19 Mar 2024 11:49:40 -0700 Subject: [PATCH 14/74] refactor type --- src/server/session.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/session.ts b/src/server/session.ts index ad157caf9256a..2de6dc7d27959 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -996,7 +996,7 @@ export class Session implements EventSender { private includeDiagnosticsDuration: boolean; // Maps a file name to duration in milliseconds of semantic checking - private semanticCheckPerformance: Map; + private semanticCheckPerformance: Map; private diagnosticsTime: [number, number] | undefined; From 1b4e458cc025f8388aceb183cedacc14d2f069ce Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 22 Mar 2024 23:53:34 +0000 Subject: [PATCH 15/74] update protocol comment --- src/server/protocol.ts | 1 + tests/baselines/reference/api/typescript.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 990b966f94eb3..9f37111c029ac 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -2363,6 +2363,7 @@ export interface GeterrRequestArgs { /** * List of file names for which to compute compiler errors. * The files will be checked in list order. + * Files with ranges specified will be checked first. */ files: (string | FileRangesRequestArgs)[]; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index af891dec6f9f5..67cd4563d2b26 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1784,6 +1784,7 @@ declare namespace ts { /** * List of file names for which to compute compiler errors. * The files will be checked in list order. + * Files with ranges specified will be checked first. */ files: (string | FileRangesRequestArgs)[]; /** From a936ff06314a387189fa3c349d68abc2a865128c Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 26 Mar 2024 19:36:14 +0000 Subject: [PATCH 16/74] restore checker arrays between region and full check --- src/compiler/checker.ts | 23 +++++++++++++++++++++++ src/compiler/types.ts | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e1824c39f204b..b53403659fa2a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -47247,6 +47247,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { clear(potentialReflectCollisions); clear(potentialUnusedRenamedBindingElementsInTypes); + if (links.flags & NodeCheckFlags.PartiallyTypeChecked) { + potentialThisCollisions = links.potentialThisCollisions!; + potentialNewTargetCollisions = links.potentialNewTargetCollisions!; + potentialWeakMapSetCollisions = links.potentialWeakMapSetCollisions!; + potentialReflectCollisions = links.potentialReflectCollisions!; + potentialUnusedRenamedBindingElementsInTypes = links.potentialUnusedRenamedBindingElementsInTypes!; + } + forEach(node.statements, checkSourceElement); checkSourceElement(node.endOfFileToken); @@ -47308,9 +47316,24 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Grammar checking checkGrammarSourceFile(file); + clear(potentialThisCollisions); + clear(potentialNewTargetCollisions); + clear(potentialWeakMapSetCollisions); + clear(potentialReflectCollisions); + clear(potentialUnusedRenamedBindingElementsInTypes); + forEach(nodes, checkSourceElement); checkDeferredNodes(file); + + (links.potentialThisCollisions || (links.potentialThisCollisions = [])).push(...potentialThisCollisions); + (links.potentialNewTargetCollisions || (links.potentialNewTargetCollisions = [])).push(...potentialNewTargetCollisions); + (links.potentialWeakMapSetCollisions || (links.potentialWeakMapSetCollisions = [])).push(...potentialWeakMapSetCollisions); + (links.potentialReflectCollisions || (links.potentialReflectCollisions = [])).push(...potentialReflectCollisions); + (links.potentialUnusedRenamedBindingElementsInTypes || (links.potentialUnusedRenamedBindingElementsInTypes = [])).push( + ...potentialUnusedRenamedBindingElementsInTypes); + + links.flags |= NodeCheckFlags.PartiallyTypeChecked; } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ea9f0b2bc0f47..dafa0fbac54a8 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5945,6 +5945,7 @@ export const enum NodeCheckFlags { ContainsClassWithPrivateIdentifiers = 1 << 20, // Marked on all block-scoped containers containing a class with private identifiers. ContainsSuperPropertyInStaticInitializer = 1 << 21, // Marked on all block-scoped containers containing a static initializer with 'super.x' or 'super[x]'. InCheckIdentifier = 1 << 22, + PartiallyTypeChecked = 1 << 23, // Source file has been partially type checked } // dprint-ignore @@ -5981,6 +5982,11 @@ export interface NodeLinks { parameterInitializerContainsUndefined?: boolean; // True if this is a parameter declaration whose type annotation contains "undefined". fakeScopeForSignatureDeclaration?: "params" | "typeParams"; // If present, this is a fake scope injected into an enclosing declaration chain. assertionExpressionType?: Type; // Cached type of the expression of a type assertion + potentialThisCollisions?: Node[]; + potentialNewTargetCollisions?: Node[]; + potentialWeakMapSetCollisions?: Node[]; + potentialReflectCollisions?: Node[]; + potentialUnusedRenamedBindingElementsInTypes?: BindingElement[]; } /** @internal */ From 13543e1ced29765c94c12aff2de59b079694ca18 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 26 Mar 2024 20:05:40 +0000 Subject: [PATCH 17/74] fmt --- src/compiler/checker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b53403659fa2a..3f97067ff151b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -47331,7 +47331,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { (links.potentialWeakMapSetCollisions || (links.potentialWeakMapSetCollisions = [])).push(...potentialWeakMapSetCollisions); (links.potentialReflectCollisions || (links.potentialReflectCollisions = [])).push(...potentialReflectCollisions); (links.potentialUnusedRenamedBindingElementsInTypes || (links.potentialUnusedRenamedBindingElementsInTypes = [])).push( - ...potentialUnusedRenamedBindingElementsInTypes); + ...potentialUnusedRenamedBindingElementsInTypes, + ); links.flags |= NodeCheckFlags.PartiallyTypeChecked; } From 7b53e4f081a811e21222737b797b7cbafbf2bf4a Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 28 Mar 2024 19:40:53 +0000 Subject: [PATCH 18/74] only include unused directive errors for checked range --- src/compiler/program.ts | 9 ++++++--- src/compiler/utilitiesPublic.ts | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 09b292c1146ab..a0763f3cb930d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -305,6 +305,7 @@ import { sys, System, targetOptionDeclaration, + textRangeContainsTextRange, toFileNameLowerCase, tokenToString, toPath as ts_toPath, @@ -2921,11 +2922,11 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg checkDiagnostics = filter(checkDiagnostics, d => plainJSErrors.has(d.code)); } // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS - return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); + return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, nodesToCheck, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); }); } - function getMergedBindAndCheckDiagnostics(sourceFile: SourceFile, includeBindAndCheckDiagnostics: boolean, ...allDiagnostics: (readonly Diagnostic[] | undefined)[]) { + function getMergedBindAndCheckDiagnostics(sourceFile: SourceFile, includeBindAndCheckDiagnostics: boolean, nodesToCheck: Node[] | undefined, ...allDiagnostics: (readonly Diagnostic[] | undefined)[]) { const flatDiagnostics = flatten(allDiagnostics); if (!includeBindAndCheckDiagnostics || !sourceFile.commentDirectives?.length) { return flatDiagnostics; @@ -2934,7 +2935,9 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics); for (const errorExpectation of directives.getUnusedExpectations()) { - diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive)); + if (!nodesToCheck || nodesToCheck.some(node => textRangeContainsTextRange(node, errorExpectation.range))) { + diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive)); + } } return diagnostics; diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 7a9bbbd2b0e82..95f74e1766906 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -349,6 +349,10 @@ export function textRangeContainsPositionInclusive(range: TextRange, position: n return position >= range.pos && position <= range.end; } +export function textRangeContainsTextRange(range: TextRange, otherRange: TextRange): boolean { + return otherRange.pos >= range.pos && otherRange.end <= range.end; +} + // Returns true if 'span' contains 'other'. export function textSpanContainsTextSpan(span: TextSpan, other: TextSpan) { return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); From 69aacf42f5f1bb283cfe245b50b67e0d2a5e7eae Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 28 Mar 2024 19:45:55 +0000 Subject: [PATCH 19/74] properly compute checked span --- src/services/services.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/services.ts b/src/services/services.ts index eb16e2a3d7f52..50f072c3eb174 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2023,7 +2023,7 @@ export function createLanguageService( const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes); return { diagnostics: semanticDiagnostics.slice(), - spans: normalizeSpans(nodes.map(node => createTextSpanFromNode(node, targetSourceFile))), + spans: normalizeSpans(nodes.map(node => createTextSpanFromBounds(node.getFullStart(), node.getEnd()))), }; } From 63c543d682b6d2eecc0e3fea099588d3d0273601 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 28 Mar 2024 19:59:13 +0000 Subject: [PATCH 20/74] update comments --- src/compiler/types.ts | 2 +- src/services/services.ts | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index dafa0fbac54a8..a364ce8394e4c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4629,7 +4629,7 @@ export interface Program extends ScriptReferenceHost { getOptionsDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; - /** The first time this is called, it will return global diagnostics (no location). */ + /** The first time this is called without `nodesToCheck`, it will return global diagnostics (no location). */ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; getConfigFileParsingDiagnostics(): readonly Diagnostic[]; diff --git a/src/services/services.ts b/src/services/services.ts index 50f072c3eb174..f4385e4b4b8c1 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2020,10 +2020,11 @@ export function createLanguageService( if (!nodes) { return undefined; } + const checkedSpans = normalizeSpans(nodes.map(node => createTextSpanFromBounds(node.getFullStart(), node.getEnd()))); const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes); return { diagnostics: semanticDiagnostics.slice(), - spans: normalizeSpans(nodes.map(node => createTextSpanFromBounds(node.getFullStart(), node.getEnd()))), + spans: checkedSpans, }; } @@ -2043,6 +2044,11 @@ export function createLanguageService( return nodes; } + /** + * Gets nodes that overlap the given span to be partially checked. + * @returns an array of nodes that overlap the span and are source element nodes (c.f. {@link isSourceElement}), + * or undefined if a partial check would be the same as a whole file check. + */ function getNodesForSpan(file: SourceFile, span: TextSpan): Node[] | undefined { // Span is the whole file if (textSpanContainsTextRange(span, file)) { @@ -2059,12 +2065,21 @@ export function createLanguageService( nodes.push(file.endOfFileToken); } + // Span would include the whole file if (some(nodes, isSourceFile)) { return undefined; } return nodes; + // The algorithm is the following: + // Starting from a node that contains the whole input span, we consider its children. + // If a child node is completely contained in the input span, then it or its source element ancestor should be included. + // If a child node does not overlap the input span, it should not be included. + // The interesting case is for nodes that overlap but are not contained by the span, i.e. nodes in the span boundary. + // For those boundary nodes, if it is a block-like node (i.e. it contains statements), + // we try to filter out the child statements that do not overlap the span. + // For boundary nodes that are not block-like, we simply include them (or their source element ancestor). function includeNodes(node: Node): true | undefined { if (!textRangeIntersectsWithTextSpan(node, span)) { if (node.pos >= span.start + span.length) { From b51921d83dfed0f0cd9a2d0ca32910c32688b408 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 28 Mar 2024 20:43:49 +0000 Subject: [PATCH 21/74] pass around compressed spans so that we do unused directive check more efficiently --- src/compiler/program.ts | 26 +++++++++++++++++--------- src/compiler/types.ts | 2 +- src/compiler/utilitiesPublic.ts | 4 ---- src/services/services.ts | 2 +- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index a0763f3cb930d..5520d453c038e 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -305,7 +305,6 @@ import { sys, System, targetOptionDeclaration, - textRangeContainsTextRange, toFileNameLowerCase, tokenToString, toPath as ts_toPath, @@ -323,6 +322,8 @@ import { WriteFileCallback, WriteFileCallbackData, writeFileEnsuringDirectories, + TextSpan, + textSpanContainsTextRange, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; @@ -2799,10 +2800,10 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken); } - function getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[] { + function getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[], nodesToCheckSpans?: TextSpan[]): readonly Diagnostic[] { return getDiagnosticsHelper( sourceFile, - (sourceFile, cancellationToken) => getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), + (sourceFile, cancellationToken) => getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck, nodesToCheckSpans), cancellationToken, ); } @@ -2814,7 +2815,11 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } function getBindAndCheckDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[] { - return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, /*nodesToCheck*/ undefined); + return getBindAndCheckDiagnosticsForFile( + sourceFile, + cancellationToken, + /*nodesToCheck*/ undefined, + /*nodesToCheckSpans*/ undefined); } function getProgramDiagnostics(sourceFile: SourceFile): readonly Diagnostic[] { @@ -2872,9 +2877,10 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg sourceFile: SourceFile, cancellationToken: CancellationToken | undefined, nodesToCheck: Node[] | undefined, + nodesToCheckSpans: TextSpan[] | undefined, ): readonly Diagnostic[] { return concatenate( - filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options), + filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck, nodesToCheckSpans), options), getProgramDiagnostics(sourceFile), ); } @@ -2883,9 +2889,10 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg sourceFile: SourceFile, cancellationToken: CancellationToken | undefined, nodesToCheck: Node[] | undefined, + nodesToCheckSpans: TextSpan[] | undefined, ): readonly Diagnostic[] { if (nodesToCheck) { - return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck); + return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck, nodesToCheckSpans); } return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache); } @@ -2894,6 +2901,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg sourceFile: SourceFile, cancellationToken: CancellationToken | undefined, nodesToCheck?: Node[], + nodesToCheckSpans?: TextSpan[], ): readonly Diagnostic[] { return runWithCancellationToken(() => { if (skipTypeChecking(sourceFile, options, program)) { @@ -2922,11 +2930,11 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg checkDiagnostics = filter(checkDiagnostics, d => plainJSErrors.has(d.code)); } // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS - return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, nodesToCheck, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); + return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, nodesToCheckSpans, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); }); } - function getMergedBindAndCheckDiagnostics(sourceFile: SourceFile, includeBindAndCheckDiagnostics: boolean, nodesToCheck: Node[] | undefined, ...allDiagnostics: (readonly Diagnostic[] | undefined)[]) { + function getMergedBindAndCheckDiagnostics(sourceFile: SourceFile, includeBindAndCheckDiagnostics: boolean, nodesToCheckSpans: TextSpan[] | undefined, ...allDiagnostics: (readonly Diagnostic[] | undefined)[]) { const flatDiagnostics = flatten(allDiagnostics); if (!includeBindAndCheckDiagnostics || !sourceFile.commentDirectives?.length) { return flatDiagnostics; @@ -2935,7 +2943,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics); for (const errorExpectation of directives.getUnusedExpectations()) { - if (!nodesToCheck || nodesToCheck.some(node => textRangeContainsTextRange(node, errorExpectation.range))) { + if (!nodesToCheckSpans || nodesToCheckSpans.some(span => textSpanContainsTextRange(span, errorExpectation.range))) { diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive)); } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a364ce8394e4c..4550676d136fe 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4630,7 +4630,7 @@ export interface Program extends ScriptReferenceHost { getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; /** The first time this is called without `nodesToCheck`, it will return global diagnostics (no location). */ - getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[], nodesToCheckSpans?: TextSpan[]): readonly Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; getConfigFileParsingDiagnostics(): readonly Diagnostic[]; /** @internal */ getSuggestionDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 95f74e1766906..7a9bbbd2b0e82 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -349,10 +349,6 @@ export function textRangeContainsPositionInclusive(range: TextRange, position: n return position >= range.pos && position <= range.end; } -export function textRangeContainsTextRange(range: TextRange, otherRange: TextRange): boolean { - return otherRange.pos >= range.pos && otherRange.end <= range.end; -} - // Returns true if 'span' contains 'other'. export function textSpanContainsTextSpan(span: TextSpan, other: TextSpan) { return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); diff --git a/src/services/services.ts b/src/services/services.ts index f4385e4b4b8c1..2d6bbb4981018 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2021,7 +2021,7 @@ export function createLanguageService( return undefined; } const checkedSpans = normalizeSpans(nodes.map(node => createTextSpanFromBounds(node.getFullStart(), node.getEnd()))); - const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes); + const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes, checkedSpans); return { diagnostics: semanticDiagnostics.slice(), spans: checkedSpans, From aac18b1befd7bf8099db78c40f2d973f053ffa0b Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Sun, 31 Mar 2024 04:37:58 +0000 Subject: [PATCH 22/74] Revert "pass around compressed spans so that we do unused directive check more efficiently" This reverts commit b51921d83dfed0f0cd9a2d0ca32910c32688b408. --- src/compiler/program.ts | 26 +++++++++----------------- src/compiler/types.ts | 2 +- src/compiler/utilitiesPublic.ts | 4 ++++ src/services/services.ts | 2 +- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 5520d453c038e..a0763f3cb930d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -305,6 +305,7 @@ import { sys, System, targetOptionDeclaration, + textRangeContainsTextRange, toFileNameLowerCase, tokenToString, toPath as ts_toPath, @@ -322,8 +323,6 @@ import { WriteFileCallback, WriteFileCallbackData, writeFileEnsuringDirectories, - TextSpan, - textSpanContainsTextRange, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; @@ -2800,10 +2799,10 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken); } - function getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[], nodesToCheckSpans?: TextSpan[]): readonly Diagnostic[] { + function getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[] { return getDiagnosticsHelper( sourceFile, - (sourceFile, cancellationToken) => getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck, nodesToCheckSpans), + (sourceFile, cancellationToken) => getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), cancellationToken, ); } @@ -2815,11 +2814,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } function getBindAndCheckDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[] { - return getBindAndCheckDiagnosticsForFile( - sourceFile, - cancellationToken, - /*nodesToCheck*/ undefined, - /*nodesToCheckSpans*/ undefined); + return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, /*nodesToCheck*/ undefined); } function getProgramDiagnostics(sourceFile: SourceFile): readonly Diagnostic[] { @@ -2877,10 +2872,9 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg sourceFile: SourceFile, cancellationToken: CancellationToken | undefined, nodesToCheck: Node[] | undefined, - nodesToCheckSpans: TextSpan[] | undefined, ): readonly Diagnostic[] { return concatenate( - filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck, nodesToCheckSpans), options), + filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options), getProgramDiagnostics(sourceFile), ); } @@ -2889,10 +2883,9 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg sourceFile: SourceFile, cancellationToken: CancellationToken | undefined, nodesToCheck: Node[] | undefined, - nodesToCheckSpans: TextSpan[] | undefined, ): readonly Diagnostic[] { if (nodesToCheck) { - return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck, nodesToCheckSpans); + return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck); } return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache); } @@ -2901,7 +2894,6 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg sourceFile: SourceFile, cancellationToken: CancellationToken | undefined, nodesToCheck?: Node[], - nodesToCheckSpans?: TextSpan[], ): readonly Diagnostic[] { return runWithCancellationToken(() => { if (skipTypeChecking(sourceFile, options, program)) { @@ -2930,11 +2922,11 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg checkDiagnostics = filter(checkDiagnostics, d => plainJSErrors.has(d.code)); } // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS - return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, nodesToCheckSpans, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); + return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, nodesToCheck, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); }); } - function getMergedBindAndCheckDiagnostics(sourceFile: SourceFile, includeBindAndCheckDiagnostics: boolean, nodesToCheckSpans: TextSpan[] | undefined, ...allDiagnostics: (readonly Diagnostic[] | undefined)[]) { + function getMergedBindAndCheckDiagnostics(sourceFile: SourceFile, includeBindAndCheckDiagnostics: boolean, nodesToCheck: Node[] | undefined, ...allDiagnostics: (readonly Diagnostic[] | undefined)[]) { const flatDiagnostics = flatten(allDiagnostics); if (!includeBindAndCheckDiagnostics || !sourceFile.commentDirectives?.length) { return flatDiagnostics; @@ -2943,7 +2935,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics); for (const errorExpectation of directives.getUnusedExpectations()) { - if (!nodesToCheckSpans || nodesToCheckSpans.some(span => textSpanContainsTextRange(span, errorExpectation.range))) { + if (!nodesToCheck || nodesToCheck.some(node => textRangeContainsTextRange(node, errorExpectation.range))) { diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive)); } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 4550676d136fe..a364ce8394e4c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4630,7 +4630,7 @@ export interface Program extends ScriptReferenceHost { getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; /** The first time this is called without `nodesToCheck`, it will return global diagnostics (no location). */ - getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[], nodesToCheckSpans?: TextSpan[]): readonly Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; getConfigFileParsingDiagnostics(): readonly Diagnostic[]; /** @internal */ getSuggestionDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 7a9bbbd2b0e82..95f74e1766906 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -349,6 +349,10 @@ export function textRangeContainsPositionInclusive(range: TextRange, position: n return position >= range.pos && position <= range.end; } +export function textRangeContainsTextRange(range: TextRange, otherRange: TextRange): boolean { + return otherRange.pos >= range.pos && otherRange.end <= range.end; +} + // Returns true if 'span' contains 'other'. export function textSpanContainsTextSpan(span: TextSpan, other: TextSpan) { return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); diff --git a/src/services/services.ts b/src/services/services.ts index 2d6bbb4981018..f4385e4b4b8c1 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2021,7 +2021,7 @@ export function createLanguageService( return undefined; } const checkedSpans = normalizeSpans(nodes.map(node => createTextSpanFromBounds(node.getFullStart(), node.getEnd()))); - const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes, checkedSpans); + const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes); return { diagnostics: semanticDiagnostics.slice(), spans: checkedSpans, From 9a1c344ad1349c247a195e7806e35d2617ee90ca Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Sun, 31 Mar 2024 04:47:01 +0000 Subject: [PATCH 23/74] don't error on unused directives --- src/compiler/program.ts | 14 ++++++++------ src/compiler/utilitiesPublic.ts | 4 ---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index a0763f3cb930d..087584e6bb176 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -305,7 +305,6 @@ import { sys, System, targetOptionDeclaration, - textRangeContainsTextRange, toFileNameLowerCase, tokenToString, toPath as ts_toPath, @@ -2922,11 +2921,11 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg checkDiagnostics = filter(checkDiagnostics, d => plainJSErrors.has(d.code)); } // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS - return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, nodesToCheck, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); + return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, !!nodesToCheck, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); }); } - function getMergedBindAndCheckDiagnostics(sourceFile: SourceFile, includeBindAndCheckDiagnostics: boolean, nodesToCheck: Node[] | undefined, ...allDiagnostics: (readonly Diagnostic[] | undefined)[]) { + function getMergedBindAndCheckDiagnostics(sourceFile: SourceFile, includeBindAndCheckDiagnostics: boolean, partialCheck: boolean, ...allDiagnostics: (readonly Diagnostic[] | undefined)[]) { const flatDiagnostics = flatten(allDiagnostics); if (!includeBindAndCheckDiagnostics || !sourceFile.commentDirectives?.length) { return flatDiagnostics; @@ -2934,10 +2933,13 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics); + // When doing a partial check, we can't be sure a directive is unused. + if (partialCheck) { + return diagnostics; + } + for (const errorExpectation of directives.getUnusedExpectations()) { - if (!nodesToCheck || nodesToCheck.some(node => textRangeContainsTextRange(node, errorExpectation.range))) { - diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive)); - } + diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive)); } return diagnostics; diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 95f74e1766906..7a9bbbd2b0e82 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -349,10 +349,6 @@ export function textRangeContainsPositionInclusive(range: TextRange, position: n return position >= range.pos && position <= range.end; } -export function textRangeContainsTextRange(range: TextRange, otherRange: TextRange): boolean { - return otherRange.pos >= range.pos && otherRange.end <= range.end; -} - // Returns true if 'span' contains 'other'. export function textSpanContainsTextSpan(span: TextSpan, other: TextSpan) { return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); From 64d069998d29f429844c1c553e6f4988aa9cde6b Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 1 Apr 2024 23:13:21 +0000 Subject: [PATCH 24/74] tweak node selection --- src/services/services.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/services.ts b/src/services/services.ts index f4385e4b4b8c1..bd64b8bef2c82 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2059,7 +2059,7 @@ export function createLanguageService( const enclosingNode = findAncestor(endToken, node => textRangeContainsTextSpan(node, span))!; const nodes = []; - enclosingNode.forEachChild(includeNodes); + includeNodes(enclosingNode); if (file.end === span.start + span.length) { nodes.push(file.endOfFileToken); From d445be56a26c587bec95d2f7adcc667e5f01fbe5 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 1 Apr 2024 23:14:06 +0000 Subject: [PATCH 25/74] add region semantic test infra; inconsistent diagnostic test --- src/harness/fourslashImpl.ts | 21 +++++++++++++-- src/harness/fourslashInterfaceImpl.ts | 21 ++++++++++++++- tests/cases/fourslash/fourslash.ts | 11 ++++++++ .../objectAssignabilityRegionCheck.ts | 27 +++++++++++++++++++ 4 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 tests/cases/fourslash/objectAssignabilityRegionCheck.ts diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 08698bf8b2721..f83e89a6a923a 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -1801,8 +1801,12 @@ export class TestState { this.testDiagnostics(expected, diagnostics, "error"); } - public getSemanticDiagnostics(expected: readonly FourSlashInterface.Diagnostic[]) { - const diagnostics = this.languageService.getSemanticDiagnostics(this.activeFile.fileName); + public getSemanticDiagnostics(): ts.Diagnostic[] { + return this.languageService.getSemanticDiagnostics(this.activeFile.fileName); + } + + public verifySemanticDiagnostics(expected: readonly FourSlashInterface.Diagnostic[]) { + const diagnostics = this.getSemanticDiagnostics(); this.testDiagnostics(expected, diagnostics, "error"); } @@ -1810,6 +1814,19 @@ export class TestState { this.testDiagnostics(expected, this.languageService.getSuggestionDiagnostics(this.activeFile.fileName), "suggestion"); } + public getRegionSemanticDiagnostics( + ranges: ts.TextRange[], + expected: readonly FourSlashInterface.Diagnostic[] | undefined) { + const diagnosticsResult = this.languageService.getRegionSemanticDiagnostics(this.activeFile.fileName, ranges); + if (diagnosticsResult && expected) { + return this.testDiagnostics(expected, diagnosticsResult.diagnostics, "error"); + } + if (diagnosticsResult !== expected) { + if (expected) this.raiseError("Expected diagnostics to be defined."); + else assert.deepEqual(diagnosticsResult, expected, "Expected diagnostics to be undefined."); + } + } + private testDiagnostics(expected: readonly FourSlashInterface.Diagnostic[], diagnostics: readonly ts.Diagnostic[], category: string) { assert.deepEqual( realizeDiagnostics(diagnostics, "\n"), diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 64577f69ced7c..3d03db16d5dd8 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -48,6 +48,21 @@ export class Test { public setTypesRegistry(map: ts.MapLike): void { this.state.setTypesRegistry(map); } + + public getSemanticDiagnostics(): Diagnostic[] { + return this.state.getSemanticDiagnostics().map(tsDiag => + ({ + message: ts.flattenDiagnosticMessageText(tsDiag.messageText, "\n"), + range: tsDiag.start ? { + fileName: this.state.activeFile.fileName, + pos: tsDiag.start, + end: tsDiag.start + tsDiag.length!, + } : undefined, + code: tsDiag.code, + reportsUnnecessary: tsDiag.reportsUnnecessary ? true : undefined, + reportsDeprecated: !!tsDiag.reportsDeprecated ? true : undefined, + })); + } } export class Config { @@ -586,7 +601,11 @@ export class Verify extends VerifyNegatable { } public getSemanticDiagnostics(expected: readonly Diagnostic[]) { - this.state.getSemanticDiagnostics(expected); + this.state.verifySemanticDiagnostics(expected); + } + + public getRegionSemanticDiagnostics(ranges: ts.TextRange[], expected: readonly Diagnostic[]) { + this.state.getRegionSemanticDiagnostics(ranges, expected); } public getSuggestionDiagnostics(expected: readonly Diagnostic[]) { diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index ff8fad9abff01..5723ccc3503cf 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -132,6 +132,11 @@ declare module ts { } function flatMap(array: ReadonlyArray, mapfn: (x: T, i: number) => U | ReadonlyArray | undefined): U[]; + + interface TextRange { + pos: number; + end: number; + } } declare namespace FourSlashInterface { @@ -212,6 +217,10 @@ declare namespace FourSlashInterface { start: number; end: number; } + interface TextRange { + pos: number; + end: number; + } class test_ { markers(): Marker[]; markerNames(): string[]; @@ -224,6 +233,7 @@ declare namespace FourSlashInterface { markerByName(s: string): Marker; symbolsInScope(range: Range): any[]; setTypesRegistry(map: { [key: string]: void }): void; + getSemanticDiagnostics(): Diagnostic[]; } class config { configurePlugin(pluginName: string, configuration: any): void; @@ -417,6 +427,7 @@ declare namespace FourSlashInterface { baselineInlayHints(span?: { start: number; length: number; }, preferences?: InlayHintsOptions): void; getSyntacticDiagnostics(expected: ReadonlyArray): void; getSemanticDiagnostics(expected: ReadonlyArray): void; + getRegionSemanticDiagnostics(ranges: ts.TextRange[], expected: ReadonlyArray | undefined): void; getSuggestionDiagnostics(expected: ReadonlyArray): void; ProjectInfo(expected: string[]): void; getEditsForFileRename(options: { diff --git a/tests/cases/fourslash/objectAssignabilityRegionCheck.ts b/tests/cases/fourslash/objectAssignabilityRegionCheck.ts new file mode 100644 index 0000000000000..41b0e5e0e4b3b --- /dev/null +++ b/tests/cases/fourslash/objectAssignabilityRegionCheck.ts @@ -0,0 +1,27 @@ +/// + +// @strict: true +// @Filename: index.ts + +//// interface Foo { +//// a: number; +//// } +//// interface Bar { +//// b: string; +//// } +//// declare let b: Bar; +//// [|function f(): Foo { +//// [|return|] b; +//// }|] +//// /*e*/ + +const [r0, r1] = test.ranges(); +// Baseline +const expected = test.getSemanticDiagnostics(); + +// Reset checker +goTo.marker("e"); +edit.insert(" "); + +verify.getRegionSemanticDiagnostics([r0], [expected[0]]); +verify.getSemanticDiagnostics(expected); \ No newline at end of file From ab5a25c9ee9e1f22df291dab9780f0003571bda3 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 1 Apr 2024 23:39:04 +0000 Subject: [PATCH 26/74] update test baseline --- .../regionDiagnostics/diagnostics-for-select-nodes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js index b7debe8eadf9f..86aa8806ef815 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js @@ -141,8 +141,8 @@ Info seq [hh:mm:ss:mss] event: "spans": [ { "start": { - "line": 7, - "offset": 1 + "line": 3, + "offset": 2 }, "end": { "line": 7, From 148f9ad02a4663ea81418f9b5d273a81afc45d0d Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 2 Apr 2024 00:13:58 +0000 Subject: [PATCH 27/74] add inconsistent 2307 test --- .../fourslash/reactNotFoundRegionCheck.ts | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/cases/fourslash/reactNotFoundRegionCheck.ts diff --git a/tests/cases/fourslash/reactNotFoundRegionCheck.ts b/tests/cases/fourslash/reactNotFoundRegionCheck.ts new file mode 100644 index 0000000000000..217bd70518320 --- /dev/null +++ b/tests/cases/fourslash/reactNotFoundRegionCheck.ts @@ -0,0 +1,41 @@ +/// + +// @strict: true +// @jsx: preserve +// @Filename: index.tsx + +//// /** @jsxImportSource @emotion/react */ +//// import { css } from "@emotion/react"; +//// function Component1() { +//// return ( +//// +//// ); +//// } +//// [|function Component2() { +//// return ( +//// +//// +//// +//// ); +//// }|] +//// /*e*/ + +const [r0] = test.ranges(); +// Baseline +const expected = test.getSemanticDiagnostics(); +console.log(JSON.stringify(expected)); + +// Reset checker +goTo.marker("e"); +edit.insert(" "); + +verify.getRegionSemanticDiagnostics([r0], expected); +verify.getSemanticDiagnostics(expected); \ No newline at end of file From 58a4f5f0e5162152037aadf2873e1a585a52c57e Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 2 Apr 2024 18:00:12 +0000 Subject: [PATCH 28/74] 2354 inconsistent position test --- .../fourslash/tslibNotFoundRegionCheck.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/cases/fourslash/tslibNotFoundRegionCheck.ts diff --git a/tests/cases/fourslash/tslibNotFoundRegionCheck.ts b/tests/cases/fourslash/tslibNotFoundRegionCheck.ts new file mode 100644 index 0000000000000..e777129dfa693 --- /dev/null +++ b/tests/cases/fourslash/tslibNotFoundRegionCheck.ts @@ -0,0 +1,22 @@ +/// + +// @strict: true +// @target: ES2016 +// @importHelpers: true +// @Filename: index.ts + +//// export {}; +//// async function foo(): Promise {} +//// [|async function bar(): Promise {}|] +//// /*e*/ + +const [r0] = test.ranges(); +// Baseline +const expected = test.getSemanticDiagnostics(); + +// Reset checker +goTo.marker("e"); +edit.insert(" "); + +verify.getRegionSemanticDiagnostics([r0], expected); +verify.getSemanticDiagnostics(expected); \ No newline at end of file From 1ac37e8c781ce48850326527213692390712d5ba Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 2 Apr 2024 19:46:56 +0000 Subject: [PATCH 29/74] test for extra 2344 --- .../cases/fourslash/constraintRegionCheck.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/cases/fourslash/constraintRegionCheck.ts diff --git a/tests/cases/fourslash/constraintRegionCheck.ts b/tests/cases/fourslash/constraintRegionCheck.ts new file mode 100644 index 0000000000000..f98211cfee9dd --- /dev/null +++ b/tests/cases/fourslash/constraintRegionCheck.ts @@ -0,0 +1,27 @@ +/// + +// @strict: true +// @Filename: index.ts + +//// export {}; +//// interface JsonArray extends Array {} +//// interface JsonObject { +//// [prop: string]: JsonValue; +//// } +//// type JsonValue = boolean | string | number | JsonArray | JsonObject | null; +//// type Cons = T; +//// [|function foo(): Cons { +//// return {} as any; +//// }|] +//// /*e*/ + +const [r0] = test.ranges(); +// Baseline +const expected = test.getSemanticDiagnostics(); + +// Reset checker +goTo.marker("e"); +edit.insert(" "); + +verify.getRegionSemanticDiagnostics([r0], expected); +verify.getSemanticDiagnostics(expected); \ No newline at end of file From 9276bd31a0cb7412e5e9e0b81bc7719f01553947 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 3 Apr 2024 04:32:31 +0000 Subject: [PATCH 30/74] add test for spans checked by region check --- src/harness/fourslashImpl.ts | 24 +++- src/harness/fourslashInterfaceImpl.ts | 7 +- src/services/services.ts | 107 ++++++++++++------ tests/baselines/reference/api/typescript.d.ts | 2 +- tests/cases/fourslash/fourslash.ts | 5 +- tests/cases/fourslash/regionCheckSpan.ts | 25 ++++ 6 files changed, 127 insertions(+), 43 deletions(-) create mode 100644 tests/cases/fourslash/regionCheckSpan.ts diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index f83e89a6a923a..c4b022f4ece0e 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -1816,14 +1816,26 @@ export class TestState { public getRegionSemanticDiagnostics( ranges: ts.TextRange[], - expected: readonly FourSlashInterface.Diagnostic[] | undefined) { + expectedDiagnostics: readonly FourSlashInterface.Diagnostic[] | undefined, + expectedRanges: ts.TextRange[] | undefined) { const diagnosticsResult = this.languageService.getRegionSemanticDiagnostics(this.activeFile.fileName, ranges); - if (diagnosticsResult && expected) { - return this.testDiagnostics(expected, diagnosticsResult.diagnostics, "error"); + if (diagnosticsResult && expectedDiagnostics) { + this.testDiagnostics(expectedDiagnostics, diagnosticsResult.diagnostics, "error"); } - if (diagnosticsResult !== expected) { - if (expected) this.raiseError("Expected diagnostics to be defined."); - else assert.deepEqual(diagnosticsResult, expected, "Expected diagnostics to be undefined."); + else if (diagnosticsResult !== expectedDiagnostics) { + if (expectedDiagnostics) this.raiseError("Expected diagnostics to be defined."); + else assert.deepEqual( + diagnosticsResult!.diagnostics, + expectedDiagnostics, + "Expected diagnostics to be undefined."); + } + + if (expectedRanges && diagnosticsResult) { + const spans = expectedRanges.map(range => ({ start: range.pos, length: range.end - range.pos })); + assert.deepEqual(diagnosticsResult.spans, spans); + } + else if (expectedRanges && !diagnosticsResult) { + this.raiseError("Expected spans to be defined."); } } diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 3d03db16d5dd8..564ac8efc6a31 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -604,8 +604,11 @@ export class Verify extends VerifyNegatable { this.state.verifySemanticDiagnostics(expected); } - public getRegionSemanticDiagnostics(ranges: ts.TextRange[], expected: readonly Diagnostic[]) { - this.state.getRegionSemanticDiagnostics(ranges, expected); + public getRegionSemanticDiagnostics( + ranges: ts.TextRange[], + expectedDiagnostics: readonly Diagnostic[], + expectedRanges: ts.TextRange[] | undefined) { + this.state.getRegionSemanticDiagnostics(ranges, expectedDiagnostics, expectedRanges); } public getSuggestionDiagnostics(expected: readonly Diagnostic[]) { diff --git a/src/services/services.ts b/src/services/services.ts index bd64b8bef2c82..3be71dd09403d 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -329,6 +329,9 @@ import { updateSourceFile, UserPreferences, VariableDeclaration, + ClassLikeDeclaration, + BlockLike, + isClassLike, } from "./_namespaces/ts"; import * as NavigateTo from "./_namespaces/ts.NavigateTo"; import * as NavigationBar from "./_namespaces/ts.NavigationBar"; @@ -2058,8 +2061,8 @@ export function createLanguageService( const endToken = findTokenOnLeftOfPosition(file, textSpanEnd(span)) || file; const enclosingNode = findAncestor(endToken, node => textRangeContainsTextSpan(node, span))!; - const nodes = []; - includeNodes(enclosingNode); + const nodes: Node[] = []; + chooseOverlappingNodes(span, enclosingNode, nodes); if (file.end === span.start + span.length) { nodes.push(file.endOfFileToken); @@ -2070,41 +2073,79 @@ export function createLanguageService( return undefined; } - return nodes; + return nodes; + } - // The algorithm is the following: - // Starting from a node that contains the whole input span, we consider its children. - // If a child node is completely contained in the input span, then it or its source element ancestor should be included. - // If a child node does not overlap the input span, it should not be included. - // The interesting case is for nodes that overlap but are not contained by the span, i.e. nodes in the span boundary. - // For those boundary nodes, if it is a block-like node (i.e. it contains statements), - // we try to filter out the child statements that do not overlap the span. - // For boundary nodes that are not block-like, we simply include them (or their source element ancestor). - function includeNodes(node: Node): true | undefined { - if (!textRangeIntersectsWithTextSpan(node, span)) { - if (node.pos >= span.start + span.length) { - return true; - } - return; - } - if (textSpanContainsTextRange(span, node) || !isBlockLike(node)) { - includeNode(node); - return; - } - const stmts = node.statements.filter(node => textRangeIntersectsWithTextSpan(node, span)); - if (stmts.length === node.statements.length) { - includeNode(node); - return; - } - stmts.forEach(includeNodes); + // The algorithm is the following: + // Starting from a node that contains the whole input span, we consider its children. + // If a child node is completely contained in the input span, then it or its source element ancestor should be included. + // If a child node does not overlap the input span, it should not be included. + // The interesting case is for nodes that overlap but are not contained by the span, i.e. nodes in the span boundary. + // For those boundary nodes, if it is a block-like node (i.e. it contains statements), + // we try to filter out the child statements that do not overlap the span. + // For boundary nodes that are not block-like or class-like, + // we simply include them (or their source element ancestor). + /** @returns whether the argument node was included in the result */ + function chooseOverlappingNodes(span: TextSpan, node: Node, result: Node[]): boolean { + if (!nodeOverlapsWithSpan(node, span)) { + return false; + } + if (textSpanContainsTextRange(span, node)) { + addSourceElement(node, result); + return true; + } + if (isBlockLike(node)) { + return chooseOverlappingBlockLike(span, node, result); } + if (isClassLike(node)) { + return chooseOverlappingClassLike(span, node, result); + } + addSourceElement(node, result); + return true; + } - function includeNode(node: Node): void { - while (node.parent && !isSourceElement(node)) { - node = node.parent; - } - nodes.push(node); + /** Similar to {@link textRangeIntersectsWithTextSpan}, but treats ends as actually exclusive. */ + function nodeOverlapsWithSpan(node: Node, span: TextSpan): boolean { + const spanEnd = span.start + span.length; + return node.pos < spanEnd && node.end > span.start; + } + + function addSourceElement(node: Node, result: Node[]): void { + while (node.parent && !isSourceElement(node)) { + node = node.parent; } + result.push(node); + } + + function chooseOverlappingBlockLike(span: TextSpan, node: BlockLike, result: Node[]): boolean { + const childResult: Node[] = []; + const stmts = node.statements.filter(stmt => chooseOverlappingNodes(span, stmt, childResult)); + if (stmts.length === node.statements.length) { + addSourceElement(node, result); + return true; + } + result.push(...childResult); + return false; + } + + function chooseOverlappingClassLike(span: TextSpan, node: ClassLikeDeclaration, result: Node[]): boolean { + const overlaps = (n: Node) => textRangeIntersectsWithTextSpan(n, span); + if (node.modifiers?.some(overlaps) + || node.name && overlaps(node.name) + || node.typeParameters?.some(overlaps) + || node.heritageClauses?.some(overlaps)) { + addSourceElement(node, result); + return true; + } + const childResult: Node[] = []; + const members = node.members.filter(member => chooseOverlappingNodes(span, member, childResult)); + if (members.length === node.members.length) { + addSourceElement(node, result); + return true; + } + result.push(...childResult); + return false; + } function getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[] { diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index b44adcd4ef9df..a5658981b5617 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -6009,7 +6009,7 @@ declare namespace ts { getOptionsDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; - /** The first time this is called, it will return global diagnostics (no location). */ + /** The first time this is called without `nodesToCheck`, it will return global diagnostics (no location). */ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; getConfigFileParsingDiagnostics(): readonly Diagnostic[]; diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 5723ccc3503cf..7b099ed97c38f 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -427,7 +427,10 @@ declare namespace FourSlashInterface { baselineInlayHints(span?: { start: number; length: number; }, preferences?: InlayHintsOptions): void; getSyntacticDiagnostics(expected: ReadonlyArray): void; getSemanticDiagnostics(expected: ReadonlyArray): void; - getRegionSemanticDiagnostics(ranges: ts.TextRange[], expected: ReadonlyArray | undefined): void; + getRegionSemanticDiagnostics( + ranges: ts.TextRange[], + expectedDiagnostics: ReadonlyArray | undefined, + expectedRanges?: ReadonlyArray): void; getSuggestionDiagnostics(expected: ReadonlyArray): void; ProjectInfo(expected: string[]): void; getEditsForFileRename(options: { diff --git a/tests/cases/fourslash/regionCheckSpan.ts b/tests/cases/fourslash/regionCheckSpan.ts new file mode 100644 index 0000000000000..e9db3763d733a --- /dev/null +++ b/tests/cases/fourslash/regionCheckSpan.ts @@ -0,0 +1,25 @@ +/// + +// @strict: true + +//// [|function foo() { +//// [|return 1 + 3; +//// } +//// +//// function bar(a: number, b: string) { +//// const z = a + b; +//// return z + z; +//// }|]|] +//// +//// class Foo {} +//// +//// class Bar extends Foo { +//// foo!: string;[| +//// bar!: number; +//// zzz!: boolean;|] +//// } + +const [outerFunctions, innerFunctions, classMembers] = test.ranges(); + +verify.getRegionSemanticDiagnostics([innerFunctions], [], [outerFunctions]); +verify.getRegionSemanticDiagnostics([classMembers], [], [classMembers]); \ No newline at end of file From caf6fc49feaeda87b5d9f81bec43b7b973e135d1 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 3 Apr 2024 19:10:25 +0000 Subject: [PATCH 31/74] add test for extra 2416 --- .../fourslash/derivedClassRegionCheck.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/cases/fourslash/derivedClassRegionCheck.ts diff --git a/tests/cases/fourslash/derivedClassRegionCheck.ts b/tests/cases/fourslash/derivedClassRegionCheck.ts new file mode 100644 index 0000000000000..caf8fc1a375f4 --- /dev/null +++ b/tests/cases/fourslash/derivedClassRegionCheck.ts @@ -0,0 +1,36 @@ +/// + +// @strict: true +// @Filename: index.ts + +//// export {}; +//// interface ComplicatedTypeBase { +//// [s: string]: ABase; +//// } +//// interface ComplicatedTypeDerived { +//// [s: string]: ADerived; +//// } +//// interface ABase { +//// a: string; +//// } +//// interface ADerived { +//// b: string; +//// } +//// class Base { +//// foo!: ComplicatedTypeBase; +//// } +//// [|class Derived extends Base { +//// foo!: ComplicatedTypeDerived; +//// }|] +//// /*e*/ + +const [r0] = test.ranges(); +// Baseline +const expected = test.getSemanticDiagnostics(); + +// Reset checker +goTo.marker("e"); +edit.insert(" "); + +verify.getRegionSemanticDiagnostics([r0], expected); +verify.getSemanticDiagnostics(expected); \ No newline at end of file From e102e49cae9f7c94123857b705ba9aa0f7653fa0 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 3 Apr 2024 20:08:14 +0000 Subject: [PATCH 32/74] add test for 2740 extra --- .../structuralAssignabilityRegionCheck.ts | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/cases/fourslash/structuralAssignabilityRegionCheck.ts diff --git a/tests/cases/fourslash/structuralAssignabilityRegionCheck.ts b/tests/cases/fourslash/structuralAssignabilityRegionCheck.ts new file mode 100644 index 0000000000000..7cf54d2ebc483 --- /dev/null +++ b/tests/cases/fourslash/structuralAssignabilityRegionCheck.ts @@ -0,0 +1,41 @@ +/// + +// @strict: true +// @target: ES2020 +// @lib: ES2020 +// @Filename: index.ts +//// export {}; +//// interface ThroughStream { +//// a: string; +//// } +//// interface ReadStream { +//// f: string; +//// g: number; +//// h: boolean; +//// i: BigInt; +//// j: symbol; +//// } +//// function foo(): ReadStream { +//// return undefined as any as ThroughStream; +//// } +//// [|function bar(): ReadStream { +//// [|return|] undefined as any as ThroughStream; +//// }|] +//// /*e*/ + +const [r0, r1] = test.ranges(); +// Baseline +const expected = test.getSemanticDiagnostics(); +console.log(JSON.stringify(expected)); + +// Reset checker +goTo.marker("e"); +edit.insert(" "); + +const region = { + code: 2739, + range: r1, + "message": "Type 'ThroughStream' is missing the following properties from type 'ReadStream': f, g, h, i, j" +}; +verify.getRegionSemanticDiagnostics([r0], [region]); +verify.getSemanticDiagnostics(expected); \ No newline at end of file From 32ec3b12389227b735303b9ea9f1b40b38bce08f Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 4 Apr 2024 00:13:53 +0000 Subject: [PATCH 33/74] add test for react error --- .../reactAssignabilityRegionCheck.ts | 36 +++++++++++++++++++ .../structuralAssignabilityRegionCheck.ts | 1 - 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/reactAssignabilityRegionCheck.ts diff --git a/tests/cases/fourslash/reactAssignabilityRegionCheck.ts b/tests/cases/fourslash/reactAssignabilityRegionCheck.ts new file mode 100644 index 0000000000000..af77d1a5ab5c5 --- /dev/null +++ b/tests/cases/fourslash/reactAssignabilityRegionCheck.ts @@ -0,0 +1,36 @@ +/// + +// @strict: true +// @jsx: react +// @reactNamespace: myReact + +// @Filename: myReact.d.ts +//// export {}; +//// declare global { +//// namespace JSX { +//// interface ElementClass { x: number; } +//// } +//// } + +// @Filename: index.tsx +//// import * as myReact from "./myReact"; +//// export class Foo {} +//// const a = +//// [|const b = <[|Foo|]>|] +//// /*e*/ + +const [r0, r1] = test.ranges(); +// Baseline +goTo.marker("e"); +const expected = test.getSemanticDiagnostics(); + +// Reset checker +edit.insert(" "); + +const region = { + code: 2786, + range: r1, + message: "'Foo' cannot be used as a JSX component.\n Its instance type 'Foo' is not a valid JSX element.\n Property 'x' is missing in type 'Foo' but required in type 'ElementClass'." +}; +verify.getRegionSemanticDiagnostics([r0], [region]); +verify.getSemanticDiagnostics(expected); \ No newline at end of file diff --git a/tests/cases/fourslash/structuralAssignabilityRegionCheck.ts b/tests/cases/fourslash/structuralAssignabilityRegionCheck.ts index 7cf54d2ebc483..78e3707f3dfe5 100644 --- a/tests/cases/fourslash/structuralAssignabilityRegionCheck.ts +++ b/tests/cases/fourslash/structuralAssignabilityRegionCheck.ts @@ -26,7 +26,6 @@ const [r0, r1] = test.ranges(); // Baseline const expected = test.getSemanticDiagnostics(); -console.log(JSON.stringify(expected)); // Reset checker goTo.marker("e"); From 52b9e33fccdde5a3df3e468f45aadecba80cfc80 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 10 Apr 2024 20:09:54 +0000 Subject: [PATCH 34/74] avoid re-checking nodes --- src/compiler/checker.ts | 12 ++++++++++++ src/compiler/types.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 760a451ee54f7..455d020ec5a97 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1505,6 +1505,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { var lastGetCombinedModifierFlagsNode: Declaration | undefined; var lastGetCombinedModifierFlagsResult = ModifierFlags.None; + var inFullCheckAfterPartial = true; + // for public members that accept a Node or one of its subtypes, we must guard against // synthetic nodes created during transformations by calling `getParseTreeNode`. // for most of these, we perform the guard only on `checker` to avoid any possible @@ -46853,6 +46855,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function checkSourceElementWorker(node: Node): void { + if (inFullCheckAfterPartial && getNodeCheckFlags(node) & NodeCheckFlags.PartiallyTypeChecked) { + return; + } + if (canHaveJSDoc(node)) { forEach(node.jsDoc, ({ comment, tags }) => { checkJSDocCommentWorker(comment); @@ -47293,6 +47299,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { clear(potentialUnusedRenamedBindingElementsInTypes); if (links.flags & NodeCheckFlags.PartiallyTypeChecked) { + inFullCheckAfterPartial = true; potentialThisCollisions = links.potentialThisCollisions!; potentialNewTargetCollisions = links.potentialNewTargetCollisions!; potentialWeakMapSetCollisions = links.potentialWeakMapSetCollisions!; @@ -47348,6 +47355,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } links.flags |= NodeCheckFlags.TypeChecked; + inFullCheckAfterPartial = false; } } @@ -47380,6 +47388,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ); links.flags |= NodeCheckFlags.PartiallyTypeChecked; + for (const node of nodes) { + const nodeLinks = getNodeLinks(node); + nodeLinks.flags |= NodeCheckFlags.PartiallyTypeChecked; + } } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0eac8526a6e7e..efd7c0052f194 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5955,7 +5955,7 @@ export const enum NodeCheckFlags { ContainsClassWithPrivateIdentifiers = 1 << 20, // Marked on all block-scoped containers containing a class with private identifiers. ContainsSuperPropertyInStaticInitializer = 1 << 21, // Marked on all block-scoped containers containing a static initializer with 'super.x' or 'super[x]'. InCheckIdentifier = 1 << 22, - PartiallyTypeChecked = 1 << 23, // Source file has been partially type checked + PartiallyTypeChecked = 1 << 23, // Node has been partially type checked } // dprint-ignore From 80698d30ed3f599d6bce3e992ed3c95b862485ea Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 10 Apr 2024 20:10:53 +0000 Subject: [PATCH 35/74] format --- src/harness/fourslashImpl.ts | 12 +++++++----- src/harness/fourslashInterfaceImpl.ts | 26 +++++++++++++------------- src/services/services.ts | 15 ++++++++------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index c4b022f4ece0e..5be88d43d7c5b 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -1817,17 +1817,19 @@ export class TestState { public getRegionSemanticDiagnostics( ranges: ts.TextRange[], expectedDiagnostics: readonly FourSlashInterface.Diagnostic[] | undefined, - expectedRanges: ts.TextRange[] | undefined) { + expectedRanges: ts.TextRange[] | undefined, + ) { const diagnosticsResult = this.languageService.getRegionSemanticDiagnostics(this.activeFile.fileName, ranges); if (diagnosticsResult && expectedDiagnostics) { this.testDiagnostics(expectedDiagnostics, diagnosticsResult.diagnostics, "error"); } else if (diagnosticsResult !== expectedDiagnostics) { if (expectedDiagnostics) this.raiseError("Expected diagnostics to be defined."); - else assert.deepEqual( - diagnosticsResult!.diagnostics, - expectedDiagnostics, - "Expected diagnostics to be undefined."); + else {assert.deepEqual( + diagnosticsResult!.diagnostics, + expectedDiagnostics, + "Expected diagnostics to be undefined.", + );} } if (expectedRanges && diagnosticsResult) { diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 564ac8efc6a31..be1d78be5f7cd 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -50,18 +50,17 @@ export class Test { } public getSemanticDiagnostics(): Diagnostic[] { - return this.state.getSemanticDiagnostics().map(tsDiag => - ({ - message: ts.flattenDiagnosticMessageText(tsDiag.messageText, "\n"), - range: tsDiag.start ? { - fileName: this.state.activeFile.fileName, - pos: tsDiag.start, - end: tsDiag.start + tsDiag.length!, - } : undefined, - code: tsDiag.code, - reportsUnnecessary: tsDiag.reportsUnnecessary ? true : undefined, - reportsDeprecated: !!tsDiag.reportsDeprecated ? true : undefined, - })); + return this.state.getSemanticDiagnostics().map(tsDiag => ({ + message: ts.flattenDiagnosticMessageText(tsDiag.messageText, "\n"), + range: tsDiag.start ? { + fileName: this.state.activeFile.fileName, + pos: tsDiag.start, + end: tsDiag.start + tsDiag.length!, + } : undefined, + code: tsDiag.code, + reportsUnnecessary: tsDiag.reportsUnnecessary ? true : undefined, + reportsDeprecated: !!tsDiag.reportsDeprecated ? true : undefined, + })); } } @@ -607,7 +606,8 @@ export class Verify extends VerifyNegatable { public getRegionSemanticDiagnostics( ranges: ts.TextRange[], expectedDiagnostics: readonly Diagnostic[], - expectedRanges: ts.TextRange[] | undefined) { + expectedRanges: ts.TextRange[] | undefined, + ) { this.state.getRegionSemanticDiagnostics(ranges, expectedDiagnostics, expectedRanges); } diff --git a/src/services/services.ts b/src/services/services.ts index 3be71dd09403d..c36172b2b7db0 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5,6 +5,7 @@ import { AssignmentDeclarationKind, BaseType, BinaryExpression, + BlockLike, BreakpointResolver, CallHierarchy, CallHierarchyIncomingCall, @@ -17,6 +18,7 @@ import { Classifications, ClassifiedSpan, ClassifiedSpan2020, + ClassLikeDeclaration, CodeActionCommand, codefix, CodeFixAction, @@ -145,6 +147,7 @@ import { isArray, isBindingPattern, isBlockLike, + isClassLike, isComputedPropertyName, isConstTypeReference, IScriptSnapshot, @@ -329,9 +332,6 @@ import { updateSourceFile, UserPreferences, VariableDeclaration, - ClassLikeDeclaration, - BlockLike, - isClassLike, } from "./_namespaces/ts"; import * as NavigateTo from "./_namespaces/ts.NavigateTo"; import * as NavigationBar from "./_namespaces/ts.NavigationBar"; @@ -2073,7 +2073,7 @@ export function createLanguageService( return undefined; } - return nodes; + return nodes; } // The algorithm is the following: @@ -2130,10 +2130,12 @@ export function createLanguageService( function chooseOverlappingClassLike(span: TextSpan, node: ClassLikeDeclaration, result: Node[]): boolean { const overlaps = (n: Node) => textRangeIntersectsWithTextSpan(n, span); - if (node.modifiers?.some(overlaps) + if ( + node.modifiers?.some(overlaps) || node.name && overlaps(node.name) || node.typeParameters?.some(overlaps) - || node.heritageClauses?.some(overlaps)) { + || node.heritageClauses?.some(overlaps) + ) { addSourceElement(node, result); return true; } @@ -2145,7 +2147,6 @@ export function createLanguageService( } result.push(...childResult); return false; - } function getSuggestionDiagnostics(fileName: string): DiagnosticWithLocation[] { From ae6a7ec082f5ec53aa6545680c1b5a62e2ac357f Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 26 Apr 2024 21:47:32 +0000 Subject: [PATCH 36/74] remove console.log --- tests/cases/fourslash/reactNotFoundRegionCheck.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cases/fourslash/reactNotFoundRegionCheck.ts b/tests/cases/fourslash/reactNotFoundRegionCheck.ts index 217bd70518320..546d0e305c264 100644 --- a/tests/cases/fourslash/reactNotFoundRegionCheck.ts +++ b/tests/cases/fourslash/reactNotFoundRegionCheck.ts @@ -31,7 +31,6 @@ const [r0] = test.ranges(); // Baseline const expected = test.getSemanticDiagnostics(); -console.log(JSON.stringify(expected)); // Reset checker goTo.marker("e"); From 46813c755d8c5ca638b18a6c270ef04533b4879e Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 29 Apr 2024 19:39:25 +0000 Subject: [PATCH 37/74] update baseline --- .../tsserver/regionDiagnostics/diagnostics-for-select-nodes.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js index 86aa8806ef815..c1145271d37e6 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js @@ -20,8 +20,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 1, "type": "request" } -Info seq [hh:mm:ss:mss] Search path: /a/b -Info seq [hh:mm:ss:mss] For info: /a/b/app.ts :: No config files found. +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app.ts ProjectRootPath: undefined:: Result: undefined Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject1* WatchType: Missing file Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms From dee28856fc05c2130881a538c16a9e3615ea99fe Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 3 May 2024 13:39:37 -0700 Subject: [PATCH 38/74] remove failing tests --- .../reactAssignabilityRegionCheck.ts | 36 ----------------- .../fourslash/reactNotFoundRegionCheck.ts | 40 ------------------- .../structuralAssignabilityRegionCheck.ts | 40 ------------------- .../fourslash/tslibNotFoundRegionCheck.ts | 22 ---------- 4 files changed, 138 deletions(-) delete mode 100644 tests/cases/fourslash/reactAssignabilityRegionCheck.ts delete mode 100644 tests/cases/fourslash/reactNotFoundRegionCheck.ts delete mode 100644 tests/cases/fourslash/structuralAssignabilityRegionCheck.ts delete mode 100644 tests/cases/fourslash/tslibNotFoundRegionCheck.ts diff --git a/tests/cases/fourslash/reactAssignabilityRegionCheck.ts b/tests/cases/fourslash/reactAssignabilityRegionCheck.ts deleted file mode 100644 index af77d1a5ab5c5..0000000000000 --- a/tests/cases/fourslash/reactAssignabilityRegionCheck.ts +++ /dev/null @@ -1,36 +0,0 @@ -/// - -// @strict: true -// @jsx: react -// @reactNamespace: myReact - -// @Filename: myReact.d.ts -//// export {}; -//// declare global { -//// namespace JSX { -//// interface ElementClass { x: number; } -//// } -//// } - -// @Filename: index.tsx -//// import * as myReact from "./myReact"; -//// export class Foo {} -//// const a = -//// [|const b = <[|Foo|]>|] -//// /*e*/ - -const [r0, r1] = test.ranges(); -// Baseline -goTo.marker("e"); -const expected = test.getSemanticDiagnostics(); - -// Reset checker -edit.insert(" "); - -const region = { - code: 2786, - range: r1, - message: "'Foo' cannot be used as a JSX component.\n Its instance type 'Foo' is not a valid JSX element.\n Property 'x' is missing in type 'Foo' but required in type 'ElementClass'." -}; -verify.getRegionSemanticDiagnostics([r0], [region]); -verify.getSemanticDiagnostics(expected); \ No newline at end of file diff --git a/tests/cases/fourslash/reactNotFoundRegionCheck.ts b/tests/cases/fourslash/reactNotFoundRegionCheck.ts deleted file mode 100644 index 546d0e305c264..0000000000000 --- a/tests/cases/fourslash/reactNotFoundRegionCheck.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -// @strict: true -// @jsx: preserve -// @Filename: index.tsx - -//// /** @jsxImportSource @emotion/react */ -//// import { css } from "@emotion/react"; -//// function Component1() { -//// return ( -//// -//// ); -//// } -//// [|function Component2() { -//// return ( -//// -//// -//// -//// ); -//// }|] -//// /*e*/ - -const [r0] = test.ranges(); -// Baseline -const expected = test.getSemanticDiagnostics(); - -// Reset checker -goTo.marker("e"); -edit.insert(" "); - -verify.getRegionSemanticDiagnostics([r0], expected); -verify.getSemanticDiagnostics(expected); \ No newline at end of file diff --git a/tests/cases/fourslash/structuralAssignabilityRegionCheck.ts b/tests/cases/fourslash/structuralAssignabilityRegionCheck.ts deleted file mode 100644 index 78e3707f3dfe5..0000000000000 --- a/tests/cases/fourslash/structuralAssignabilityRegionCheck.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -// @strict: true -// @target: ES2020 -// @lib: ES2020 -// @Filename: index.ts -//// export {}; -//// interface ThroughStream { -//// a: string; -//// } -//// interface ReadStream { -//// f: string; -//// g: number; -//// h: boolean; -//// i: BigInt; -//// j: symbol; -//// } -//// function foo(): ReadStream { -//// return undefined as any as ThroughStream; -//// } -//// [|function bar(): ReadStream { -//// [|return|] undefined as any as ThroughStream; -//// }|] -//// /*e*/ - -const [r0, r1] = test.ranges(); -// Baseline -const expected = test.getSemanticDiagnostics(); - -// Reset checker -goTo.marker("e"); -edit.insert(" "); - -const region = { - code: 2739, - range: r1, - "message": "Type 'ThroughStream' is missing the following properties from type 'ReadStream': f, g, h, i, j" -}; -verify.getRegionSemanticDiagnostics([r0], [region]); -verify.getSemanticDiagnostics(expected); \ No newline at end of file diff --git a/tests/cases/fourslash/tslibNotFoundRegionCheck.ts b/tests/cases/fourslash/tslibNotFoundRegionCheck.ts deleted file mode 100644 index e777129dfa693..0000000000000 --- a/tests/cases/fourslash/tslibNotFoundRegionCheck.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -// @strict: true -// @target: ES2016 -// @importHelpers: true -// @Filename: index.ts - -//// export {}; -//// async function foo(): Promise {} -//// [|async function bar(): Promise {}|] -//// /*e*/ - -const [r0] = test.ranges(); -// Baseline -const expected = test.getSemanticDiagnostics(); - -// Reset checker -goTo.marker("e"); -edit.insert(" "); - -verify.getRegionSemanticDiagnostics([r0], expected); -verify.getSemanticDiagnostics(expected); \ No newline at end of file From 13a7ab713da736d44a31d456fa5fcf6901bb0253 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 3 May 2024 14:08:48 -0700 Subject: [PATCH 39/74] fmt --- src/testRunner/unittests/tsserver/regionDiagnostics.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index 1f2f5944e610a..d0f1b3512734c 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -4,9 +4,7 @@ import { TestSession, TestSessionConstructorOptions, } from "../helpers/tsserver"; -import { - createServerHost, -} from "../helpers/virtualFileSystemWithWatch"; +import { createServerHost } from "../helpers/virtualFileSystemWithWatch"; describe("unittests:: tsserver:: regionDiagnostics", () => { it("diagnostics for select nodes", () => { From 7e8d76345bab3b377151d56c692cdbf0900075e6 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 3 May 2024 14:57:14 -0700 Subject: [PATCH 40/74] fix default for var --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 704d4ac066623..acf5a25a429c5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1542,7 +1542,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { onSuccessfullyResolvedSymbol, }); - var inFullCheckAfterPartial = true; + var inFullCheckAfterPartial = false; var resolveNameForSymbolSuggestion = createNameResolver({ compilerOptions, From b51af9c002b7fc61abfe72c8fda66c5662196a9e Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 21 May 2024 11:33:54 -0700 Subject: [PATCH 41/74] CR: get rid of unnecessary boolean flag for partial check --- src/compiler/checker.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index acf5a25a429c5..b035cf5b1924f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1542,8 +1542,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { onSuccessfullyResolvedSymbol, }); - var inFullCheckAfterPartial = false; - var resolveNameForSymbolSuggestion = createNameResolver({ compilerOptions, requireSymbol, @@ -46742,7 +46740,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function checkSourceElementWorker(node: Node): void { - if (inFullCheckAfterPartial && getNodeCheckFlags(node) & NodeCheckFlags.PartiallyTypeChecked) { + if (getNodeCheckFlags(node) & NodeCheckFlags.PartiallyTypeChecked) { return; } @@ -47186,7 +47184,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { clear(potentialUnusedRenamedBindingElementsInTypes); if (links.flags & NodeCheckFlags.PartiallyTypeChecked) { - inFullCheckAfterPartial = true; potentialThisCollisions = links.potentialThisCollisions!; potentialNewTargetCollisions = links.potentialNewTargetCollisions!; potentialWeakMapSetCollisions = links.potentialWeakMapSetCollisions!; @@ -47242,7 +47239,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } links.flags |= NodeCheckFlags.TypeChecked; - inFullCheckAfterPartial = false; } } From a3cdc74908d69ebc00e7405f1483d88f65e91d4a Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 21 May 2024 12:02:32 -0700 Subject: [PATCH 42/74] CR: get rid of option to exclude duration from diagnostics event, sanitize logs, update unit tests --- src/harness/tsserverLogger.ts | 1 + src/server/session.ts | 7 +- src/testRunner/unittests/helpers/tsserver.ts | 1 - src/testRunner/unittests/tsserver/session.ts | 3 - tests/baselines/reference/api/typescript.d.ts | 2 - .../cancellationT/Geterr-is-cancellable.js | 15 ++- .../cancellationT/is-attached-to-request.js | 9 +- ...er-old-one-without-file-being-in-config.js | 18 ++- ...invoked,-ask-errors-on-it-after-old-one.js | 18 ++- ...re-old-one-without-file-being-in-config.js | 18 ++- ...nvoked,-ask-errors-on-it-before-old-one.js | 18 ++- ...er-old-one-without-file-being-in-config.js | 18 ++- ...invoked,-ask-errors-on-it-after-old-one.js | 18 ++- ...re-old-one-without-file-being-in-config.js | 18 ++- ...nvoked,-ask-errors-on-it-before-old-one.js | 18 ++- ...re-open-detects-correct-default-project.js | 18 ++- ...oundUpdate-and-project-is-at-root-level.js | 3 +- ...Update-and-project-is-not-at-root-level.js | 3 +- ...-to-date-with-the-reference-map-changes.js | 3 +- ...dUpdate-and-should-contains-only-itself.js | 3 +- ...should-detect-changes-in-non-root-files.js | 3 +- ...nd-should-detect-non-existing-code-file.js | 3 +- ...ould-return-cascaded-affected-file-list.js | 3 +- ...kgroundUpdate-and-when---outFile-is-set.js | 3 +- ...ckgroundUpdate-and-when-adding-new-file.js | 3 +- ...pdate-and-when-both-options-are-not-set.js | 3 +- ...et-and-import-match-disk-with-link-open.js | 18 ++- ...rt-match-disk-with-target-and-link-open.js | 18 ++- ...-and-import-match-disk-with-target-open.js | 18 ++- ...ry-symlink-target-and-import-match-disk.js | 18 ++- ...et-and-import-match-disk-with-link-open.js | 18 ++- ...rt-match-disk-with-target-and-link-open.js | 18 ++- ...-and-import-match-disk-with-target-open.js | 18 ++- ...le-symlink-target-and-import-match-disk.js | 18 ++- ...nging-module-name-with-different-casing.js | 18 ++- ...disk-but-import-does-not-with-link-open.js | 18 ++- ...port-does-not-with-target-and-link-open.js | 18 ++- ...sk-but-import-does-not-with-target-open.js | 18 ++- ...target-matches-disk-but-import-does-not.js | 18 ++- ...disk-but-import-does-not-with-link-open.js | 18 ++- ...port-does-not-with-target-and-link-open.js | 18 ++- ...sk-but-import-does-not-with-target-open.js | 18 ++- ...target-matches-disk-but-import-does-not.js | 18 ++- ...d-disk-are-all-different-with-link-open.js | 18 ++- ...all-different-with-target-and-link-open.js | 18 ++- ...disk-are-all-different-with-target-open.js | 18 ++- ...link-target,-and-disk-are-all-different.js | 18 ++- ...d-disk-are-all-different-with-link-open.js | 18 ++- ...all-different-with-target-and-link-open.js | 18 ++- ...disk-are-all-different-with-target-open.js | 18 ++- ...link-target,-and-disk-are-all-different.js | 18 ++- ...ee-but-do-not-match-disk-with-link-open.js | 18 ++- ...ot-match-disk-with-target-and-link-open.js | 18 ++- ...-but-do-not-match-disk-with-target-open.js | 18 ++- ...link-target-agree-but-do-not-match-disk.js | 18 ++- ...ee-but-do-not-match-disk-with-link-open.js | 18 ++- ...ot-match-disk-with-target-and-link-open.js | 18 ++- ...-but-do-not-match-disk-with-target-open.js | 18 ++- ...link-target-agree-but-do-not-match-disk.js | 18 ++- ...-symlink-target-does-not-with-link-open.js | 18 ++- ...rget-does-not-with-target-and-link-open.js | 18 ++- ...ymlink-target-does-not-with-target-open.js | 18 ++- ...k-but-directory-symlink-target-does-not.js | 18 ++- ...-symlink-target-does-not-with-link-open.js | 18 ++- ...rget-does-not-with-target-and-link-open.js | 18 ++- ...ymlink-target-does-not-with-target-open.js | 18 ++- ...s-disk-but-file-symlink-target-does-not.js | 18 ++- ...hen-renaming-file-with-different-casing.js | 27 ++-- .../should-not-error.js | 9 +- .../should-not-error.js | 9 +- .../moduleResolution/alternateResult.js | 117 ++++++++++++------ ...en-package-json-with-type-module-exists.js | 45 ++++--- .../package-json-file-is-edited.js | 45 ++++--- .../using-referenced-project-built.js | 27 ++-- .../using-referenced-project.js | 27 ++-- ...-directives,-they-are-handled-correcrly.js | 27 ++-- ...-diagnostics-are-returned-with-no-error.js | 3 +- ...criptKind-changes-for-the-external-file.js | 9 +- ...-same-ambient-module-and-is-also-module.js | 18 ++- ...project-structure-and-reports-no-errors.js | 18 ++- ...-when-timeout-occurs-after-installation.js | 45 ++++--- ...n-timeout-occurs-inbetween-installation.js | 45 ++++--- ...pened-right-after-closing-the-root-file.js | 36 ++++-- ...hen-json-is-root-file-found-by-tsconfig.js | 9 +- ...json-is-not-root-file-found-by-tsconfig.js | 9 +- ...esnt-exist-on-disk-yet-with-projectRoot.js | 9 +- ...t-exist-on-disk-yet-without-projectRoot.js | 9 +- ...or-returns-includes-global-error-getErr.js | 9 +- ...-includes-global-error-geterrForProject.js | 9 +- ...roject-are-different-from-usage-project.js | 18 ++- ...n-dependency-project-is-not-open-getErr.js | 9 +- ...cy-project-is-not-open-geterrForProject.js | 36 ++++-- ...-when-the-depedency-file-is-open-getErr.js | 18 ++- ...depedency-file-is-open-geterrForProject.js | 27 ++-- ...n-dependency-project-is-not-open-getErr.js | 9 +- ...cy-project-is-not-open-geterrForProject.js | 36 ++++-- ...-when-the-depedency-file-is-open-getErr.js | 18 ++- ...depedency-file-is-open-geterrForProject.js | 27 ++-- ...solution-is-built-with-preserveSymlinks.js | 18 ++- ...-and-has-index.ts-and-solution-is-built.js | 18 ++- ...tion-is-not-built-with-preserveSymlinks.js | 18 ++- ...-has-index.ts-and-solution-is-not-built.js | 18 ++- ...solution-is-built-with-preserveSymlinks.js | 18 ++- ...th-scoped-package-and-solution-is-built.js | 18 ++- ...tion-is-not-built-with-preserveSymlinks.js | 18 ++- ...coped-package-and-solution-is-not-built.js | 18 ++- ...solution-is-built-with-preserveSymlinks.js | 18 ++- ...le-from-subFolder-and-solution-is-built.js | 18 ++- ...tion-is-not-built-with-preserveSymlinks.js | 18 ++- ...rom-subFolder-and-solution-is-not-built.js | 18 ++- ...solution-is-built-with-preserveSymlinks.js | 18 ++- ...th-scoped-package-and-solution-is-built.js | 18 ++- ...tion-is-not-built-with-preserveSymlinks.js | 18 ++- ...coped-package-and-solution-is-not-built.js | 18 ++- ...ject-is-directly-referenced-by-solution.js | 9 +- ...ct-is-indirectly-referenced-by-solution.js | 9 +- ...erenced-project-with-preserveConstEnums.js | 9 +- ...ces-open-file-through-project-reference.js | 9 +- ...ct-is-indirectly-referenced-by-solution.js | 9 +- ...ts-have-allowJs-and-emitDeclarationOnly.js | 9 +- ...directory-watch-invoke-on-file-creation.js | 18 ++- .../diagnostics-for-select-nodes.js | 12 +- .../disable-suggestion-diagnostics.js | 6 +- .../npm-install-@types-works.js | 9 +- .../resolutionCache/suggestion-diagnostics.js | 9 +- ...tion-when-project-compiles-from-sources.js | 18 ++- ...s-in-typings-folder-and-then-recompiles.js | 18 ++- ...mpiles-after-deleting-generated-folders.js | 27 ++-- ...ping-when-project-compiles-from-sources.js | 18 ++- ...s-in-typings-folder-and-then-recompiles.js | 18 ++- ...mpiles-after-deleting-generated-folders.js | 27 ++-- ...-style-sibling-packages-symlinked-Linux.js | 36 ++++-- ...packages-symlinked-package1-built-Linux.js | 27 ++-- ...bling-packages-symlinked-package1-built.js | 27 ++-- ...norepo-style-sibling-packages-symlinked.js | 36 ++++-- ...ere-workspaces-folder-is-hosted-at-root.js | 27 ++-- 136 files changed, 1594 insertions(+), 808 deletions(-) diff --git a/src/harness/tsserverLogger.ts b/src/harness/tsserverLogger.ts index 605d478824d40..b1d4765834ade 100644 --- a/src/harness/tsserverLogger.ts +++ b/src/harness/tsserverLogger.ts @@ -127,6 +127,7 @@ export function sanitizeLog(s: string): string { s = s.replace(/"exportMapKey":\s*"\d+ \d+ /g, match => match.replace(/ \d+ /, ` * `)); s = s.replace(/getIndentationAtPosition: getCurrentSourceFile: \d+(?:\.\d+)?/, `getIndentationAtPosition: getCurrentSourceFile: *`); s = s.replace(/getIndentationAtPosition: computeIndentation\s*: \d+(?:\.\d+)?/, `getIndentationAtPosition: computeIndentation: *`); + s = s.replace(/"duration":\s*\d+.\d+/g, `"duration": *`); s = replaceAll(s, `@ts${ts.versionMajorMinor}`, `@tsFakeMajor.Minor`); s = sanitizeHarnessLSException(s); return s; diff --git a/src/server/session.ts b/src/server/session.ts index ce0c9000642be..c5be9b51b0791 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -962,7 +962,6 @@ export interface SessionOptions { serverMode?: LanguageServiceMode; throttleWaitMilliseconds?: number; noGetErrOnBackgroundUpdate?: boolean; - includeDiagnosticsDuration?: boolean; globalPlugins?: readonly string[]; pluginProbeLocations?: readonly string[]; @@ -992,7 +991,6 @@ export class Session implements EventSender { private suppressDiagnosticEvents?: boolean; private eventHandler: ProjectServiceEventHandler | undefined; private readonly noGetErrOnBackgroundUpdate?: boolean; - private includeDiagnosticsDuration: boolean; // Maps a file name to duration in milliseconds of semantic checking private semanticCheckPerformance: Map; @@ -1009,7 +1007,6 @@ export class Session implements EventSender { this.canUseEvents = opts.canUseEvents; this.suppressDiagnosticEvents = opts.suppressDiagnosticEvents; this.noGetErrOnBackgroundUpdate = opts.noGetErrOnBackgroundUpdate; - this.includeDiagnosticsDuration = opts.includeDiagnosticsDuration ?? true; this.semanticCheckPerformance = new Map(); const { throttleWaitMilliseconds } = opts; @@ -1319,10 +1316,8 @@ export class Session implements EventSender { file, diagnostics: diagnostics.map(diag => formatDiag(file, project, diag)), spans: spans?.map(span => toProtocolTextSpan(span, scriptInfo)), + duration, }; - if (this.includeDiagnosticsDuration) { - body.duration = duration; - } this.event( body, kind, diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index 6b691f950bf22..b1c2192730c25 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -122,7 +122,6 @@ export class TestSession extends ts.server.Session { incrementalVerifier, typesMapLocation: customTypesMap.path, typingsInstaller, - includeDiagnosticsDuration: false, ...opts, }); if (typingsInstaller) typingsInstaller.session = this; diff --git a/src/testRunner/unittests/tsserver/session.ts b/src/testRunner/unittests/tsserver/session.ts index 2d167118d928b..bc1f17167d58a 100644 --- a/src/testRunner/unittests/tsserver/session.ts +++ b/src/testRunner/unittests/tsserver/session.ts @@ -71,7 +71,6 @@ describe("unittests:: tsserver:: Session:: General functionality", () => { logger: nullLogger(), canUseEvents: true, incrementalVerifier, - includeDiagnosticsDuration: false, }; return new TestSession(opts); } @@ -405,7 +404,6 @@ describe("unittests:: tsserver:: Session:: exceptions", () => { logger: nullLogger(), canUseEvents: true, incrementalVerifier, - includeDiagnosticsDuration: false, }); this.addProtocolHandler(command, this.exceptionRaisingHandler); } @@ -453,7 +451,6 @@ describe("unittests:: tsserver:: Session:: how Session is extendable via subclas logger: createHasErrorMessageLogger(), canUseEvents: true, incrementalVerifier, - includeDiagnosticsDuration: false, }); this.addProtocolHandler(this.customHandler, () => { return { response: undefined, responseRequired: true }; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index cafb0091676a6..16b7a682ef796 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3378,7 +3378,6 @@ declare namespace ts { serverMode?: LanguageServiceMode; throttleWaitMilliseconds?: number; noGetErrOnBackgroundUpdate?: boolean; - includeDiagnosticsDuration?: boolean; globalPlugins?: readonly string[]; pluginProbeLocations?: readonly string[]; allowLocalPluginLoads?: boolean; @@ -3401,7 +3400,6 @@ declare namespace ts { private suppressDiagnosticEvents?; private eventHandler; private readonly noGetErrOnBackgroundUpdate?; - private includeDiagnosticsDuration; private semanticCheckPerformance; private diagnosticsTime; constructor(opts: SessionOptions); diff --git a/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js b/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js index e138510231d80..bbf5d0b758ce7 100644 --- a/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js +++ b/tests/baselines/reference/tsserver/cancellationT/Geterr-is-cancellable.js @@ -343,7 +343,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } TestServerCancellationToken:: resetRequest:: 5 is as expected @@ -406,7 +407,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } TestServerCancellationToken:: resetRequest:: 6 is as expected @@ -426,7 +428,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/a/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } TestServerCancellationToken:: resetRequest:: 6 is as expected @@ -446,7 +449,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/a/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -497,7 +501,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } TestServerCancellationToken:: resetRequest:: 7 is as expected diff --git a/tests/baselines/reference/tsserver/cancellationT/is-attached-to-request.js b/tests/baselines/reference/tsserver/cancellationT/is-attached-to-request.js index 344b7cc161bdc..a95f6452cd8fd 100644 --- a/tests/baselines/reference/tsserver/cancellationT/is-attached-to-request.js +++ b/tests/baselines/reference/tsserver/cancellationT/is-attached-to-request.js @@ -143,7 +143,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a/b/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } TestServerCancellationToken:: resetRequest:: 2 is as expected @@ -163,7 +164,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/a/b/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } TestServerCancellationToken:: resetRequest:: 2 is as expected @@ -183,7 +185,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/a/b/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js index a509776efc2bd..51e0cd5a9c965 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js @@ -391,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -409,7 +410,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -427,7 +429,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -445,7 +448,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -463,7 +467,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -481,7 +486,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one.js index 71de22c650cab..974617467a474 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one.js @@ -362,7 +362,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -380,7 +381,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -398,7 +400,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -421,7 +424,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -439,7 +443,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -457,7 +462,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js index 5ffe6c9ed1aaf..1712db1edf892 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js @@ -391,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -409,7 +410,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -427,7 +429,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -445,7 +448,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -463,7 +467,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -481,7 +486,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one.js index a6e0e49d10178..f2efca684a5b8 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one.js @@ -362,7 +362,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -380,7 +381,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -398,7 +400,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -421,7 +424,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -439,7 +443,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -457,7 +462,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js index 0110bee3238db..bc75c28a5303f 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js @@ -391,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -409,7 +410,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -427,7 +429,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -445,7 +448,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -463,7 +467,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -481,7 +486,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one.js index 8783f7c811225..def2a899b37ef 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one.js @@ -433,7 +433,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -524,7 +525,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -542,7 +544,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -565,7 +568,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -583,7 +587,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -601,7 +606,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js index 8face23407466..c34c49e7d16b4 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js @@ -391,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -409,7 +410,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -427,7 +429,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -445,7 +448,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -463,7 +467,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -481,7 +486,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one.js index 4986c64985022..8b1edb950697a 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one.js @@ -407,7 +407,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -425,7 +426,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -443,7 +445,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/sub/fooBar.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -492,7 +495,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -583,7 +587,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -601,7 +606,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/foo.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/configuredProjects/when-multiple-projects-are-open-detects-correct-default-project.js b/tests/baselines/reference/tsserver/configuredProjects/when-multiple-projects-are-open-detects-correct-default-project.js index 7775295d4e40f..bca048caf2065 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/when-multiple-projects-are-open-detects-correct-default-project.js +++ b/tests/baselines/reference/tsserver/configuredProjects/when-multiple-projects-are-open-detects-correct-default-project.js @@ -521,7 +521,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/bar/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -539,7 +540,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/bar/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -557,7 +559,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/bar/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -575,7 +578,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/foo/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -593,7 +597,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/foo/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -611,7 +616,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/foo/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js index fa8db928e7160..ad992b12ee8ff 100644 --- a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js +++ b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js @@ -312,7 +312,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a/b/project/file1.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js index aafc5d680abf3..1db3842d308cb 100644 --- a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js +++ b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js @@ -422,7 +422,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/rootfolder/otherfolder/a/b/project/file1.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 1 diff --git a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-be-up-to-date-with-the-reference-map-changes.js b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-be-up-to-date-with-the-reference-map-changes.js index b49242dc91ecb..626c6fe273fc9 100644 --- a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-be-up-to-date-with-the-reference-map-changes.js +++ b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-be-up-to-date-with-the-reference-map-changes.js @@ -561,7 +561,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/project/file1Consumer1.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] Running: /users/username/projects/project/tsconfig.json diff --git a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-contains-only-itself.js b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-contains-only-itself.js index a520a78763043..ff84ac177d563 100644 --- a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-contains-only-itself.js +++ b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-contains-only-itself.js @@ -545,7 +545,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/project/file1Consumer1.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] Running: /users/username/projects/project/tsconfig.json diff --git a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-detect-changes-in-non-root-files.js b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-detect-changes-in-non-root-files.js index 2c0ea4367a67c..ac798a011d464 100644 --- a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-detect-changes-in-non-root-files.js +++ b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-detect-changes-in-non-root-files.js @@ -472,7 +472,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/project/file1Consumer1.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] Running: /users/username/projects/project/tsconfig.json diff --git a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-detect-non-existing-code-file.js b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-detect-non-existing-code-file.js index 40ee429064830..bcfa2ce0b1a23 100644 --- a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-detect-non-existing-code-file.js +++ b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-detect-non-existing-code-file.js @@ -465,7 +465,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/project/referenceFile1.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] Running: /users/username/projects/project/tsconfig.json diff --git a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-return-cascaded-affected-file-list.js b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-return-cascaded-affected-file-list.js index bd954003e2a97..462550735ed94 100644 --- a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-return-cascaded-affected-file-list.js +++ b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-should-return-cascaded-affected-file-list.js @@ -596,7 +596,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/project/file1Consumer1.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] Running: /users/username/projects/project/tsconfig.json diff --git a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when---outFile-is-set.js b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when---outFile-is-set.js index 6642bd00c7f0d..a9558ac25ab86 100644 --- a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when---outFile-is-set.js +++ b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when---outFile-is-set.js @@ -361,7 +361,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/project/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] Running: /users/username/projects/project/tsconfig.json diff --git a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when-adding-new-file.js b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when-adding-new-file.js index f82f10361be1e..06b1b450e0e61 100644 --- a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when-adding-new-file.js +++ b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when-adding-new-file.js @@ -351,7 +351,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/project/file1.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] Running: /users/username/projects/project/tsconfig.json diff --git a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when-both-options-are-not-set.js b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when-both-options-are-not-set.js index 4fe7c7d1db37b..7ecc94d34c492 100644 --- a/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when-both-options-are-not-set.js +++ b/tests/baselines/reference/tsserver/events/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-when-both-options-are-not-set.js @@ -356,7 +356,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/project/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] Running: /users/username/projects/project/tsconfig.json diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-link-open.js index f02621fb46df0..29702e90c4c68 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-link-open.js @@ -339,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -357,7 +358,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -375,7 +377,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -476,7 +479,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -519,7 +523,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -537,7 +542,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-target-and-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-target-and-link-open.js index 614813e13c217..acbb2a1df1f2b 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-target-and-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-target-and-link-open.js @@ -414,7 +414,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -432,7 +433,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -450,7 +452,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -553,7 +556,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -577,7 +581,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -595,7 +600,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-target-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-target-open.js index 7b95985c997b7..08a0229b8f982 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-target-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk-with-target-open.js @@ -339,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -357,7 +358,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -375,7 +377,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -478,7 +481,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -502,7 +506,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -520,7 +525,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js index 8fa26297475a6..f569af0b53976 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js @@ -264,7 +264,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -282,7 +283,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -300,7 +302,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -406,7 +409,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -450,7 +454,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -468,7 +473,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-link-open.js index 4315044b04701..42468be8d9024 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-link-open.js @@ -330,7 +330,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -348,7 +349,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -366,7 +368,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -467,7 +470,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -510,7 +514,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -528,7 +533,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-target-and-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-target-and-link-open.js index a30794a8015f0..b9cd87fdf445e 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-target-and-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-target-and-link-open.js @@ -403,7 +403,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -421,7 +422,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -439,7 +441,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -542,7 +545,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -566,7 +570,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -584,7 +589,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-target-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-target-open.js index 510dca74a95dd..e22a20e5bb3a2 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-target-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk-with-target-open.js @@ -330,7 +330,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -348,7 +349,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -366,7 +368,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -469,7 +472,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -493,7 +497,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -511,7 +516,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js index 291956b4ed840..bf3e9d319beaf 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js @@ -257,7 +257,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -275,7 +276,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -293,7 +295,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -399,7 +402,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -443,7 +447,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -461,7 +466,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js index b510856cf2b1b..0d6717ace185f 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js @@ -239,7 +239,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/another.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -257,7 +258,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/another.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -275,7 +277,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/another.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -386,7 +389,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/another.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -424,7 +428,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -442,7 +447,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/another.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-link-open.js index ca7783922ee51..84fd1a9abfae2 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-link-open.js @@ -339,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -357,7 +358,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -375,7 +377,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -476,7 +479,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -519,7 +523,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -537,7 +542,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-target-and-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-target-and-link-open.js index a6a060514a357..090b0d2d23ba9 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-target-and-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-target-and-link-open.js @@ -414,7 +414,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -432,7 +433,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -450,7 +452,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -553,7 +556,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -577,7 +581,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -595,7 +600,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-target-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-target-open.js index 2994d77d6f3c3..60047de6a0032 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-target-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not-with-target-open.js @@ -339,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -357,7 +358,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -375,7 +377,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -478,7 +481,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -502,7 +506,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -520,7 +525,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js index 5c95acde6b4f0..e5335da3734e9 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js @@ -264,7 +264,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -282,7 +283,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -300,7 +302,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -406,7 +409,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -450,7 +454,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -468,7 +473,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-link-open.js index 320797449793f..78255e686ebff 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-link-open.js @@ -330,7 +330,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -348,7 +349,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -366,7 +368,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -467,7 +470,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -510,7 +514,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -528,7 +533,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-target-and-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-target-and-link-open.js index d5f0f262b77be..93524e41eb0de 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-target-and-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-target-and-link-open.js @@ -403,7 +403,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -421,7 +422,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -439,7 +441,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -542,7 +545,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -566,7 +570,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -584,7 +589,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-target-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-target-open.js index 6903a8dd841d8..68e127def4d10 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-target-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not-with-target-open.js @@ -330,7 +330,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -348,7 +349,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -366,7 +368,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -469,7 +472,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -493,7 +497,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -511,7 +516,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js index 44fed6cc3fe13..ef4a683baf3fb 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js @@ -257,7 +257,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -275,7 +276,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -293,7 +295,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -399,7 +402,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -443,7 +447,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -461,7 +466,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-link-open.js index 5694d072aacbc..a3b9c3ddfb346 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-link-open.js @@ -339,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -371,7 +372,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -389,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -490,7 +493,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -547,7 +551,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -565,7 +570,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-target-and-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-target-and-link-open.js index 6a73c5024e81f..e4bb6dddc064b 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-target-and-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-target-and-link-open.js @@ -414,7 +414,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -446,7 +447,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -464,7 +466,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -567,7 +570,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -605,7 +609,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -623,7 +628,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-target-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-target-open.js index f6165d68d177f..0e0daed59b52c 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-target-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different-with-target-open.js @@ -339,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -371,7 +372,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -389,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -492,7 +495,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -530,7 +534,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -548,7 +553,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js index 203c1cb38ad14..58b442834788c 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js @@ -264,7 +264,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -296,7 +297,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -314,7 +316,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -420,7 +423,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -478,7 +482,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -496,7 +501,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-link-open.js index 6b7450498c0b0..85498dd12ed9b 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-link-open.js @@ -330,7 +330,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -362,7 +363,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -380,7 +382,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -481,7 +484,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -538,7 +542,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -556,7 +561,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-target-and-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-target-and-link-open.js index 523c0600bb69e..494be39186c20 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-target-and-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-target-and-link-open.js @@ -403,7 +403,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -435,7 +436,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -453,7 +455,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -556,7 +559,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -594,7 +598,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -612,7 +617,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-target-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-target-open.js index 2b29b89b8d5e5..5b403f0c33db5 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-target-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different-with-target-open.js @@ -330,7 +330,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -362,7 +363,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -380,7 +382,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -483,7 +486,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -521,7 +525,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -539,7 +544,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js index d47c6432da459..ad796231660ae 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js @@ -257,7 +257,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -289,7 +290,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -307,7 +309,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -413,7 +416,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -471,7 +475,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -489,7 +494,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-link-open.js index 21e31aef007d6..a005d64e7bd81 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-link-open.js @@ -339,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -371,7 +372,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -389,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -490,7 +493,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -547,7 +551,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -565,7 +570,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-target-and-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-target-and-link-open.js index 7d6f41543b626..943167b77df16 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-target-and-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-target-and-link-open.js @@ -414,7 +414,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -446,7 +447,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -464,7 +466,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -567,7 +570,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -605,7 +609,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -623,7 +628,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-target-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-target-open.js index 1570809142940..9e60ccd2ec7d0 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-target-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk-with-target-open.js @@ -339,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -371,7 +372,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -389,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -492,7 +495,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -530,7 +534,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -548,7 +553,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js index e1c59ce0b8b70..6b8151d3de3a1 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js @@ -264,7 +264,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -296,7 +297,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -314,7 +316,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -420,7 +423,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -478,7 +482,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -496,7 +501,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-link-open.js index 6bdc812271770..d8b4ffea0c976 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-link-open.js @@ -330,7 +330,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -362,7 +363,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -380,7 +382,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -481,7 +484,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -538,7 +542,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -556,7 +561,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-target-and-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-target-and-link-open.js index 13ac429dfce62..460c815142d19 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-target-and-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-target-and-link-open.js @@ -403,7 +403,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -435,7 +436,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -453,7 +455,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -556,7 +559,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -594,7 +598,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -612,7 +617,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-target-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-target-open.js index 20855c078f06a..05797c39ad246 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-target-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk-with-target-open.js @@ -330,7 +330,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -362,7 +363,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -380,7 +382,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -483,7 +486,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -521,7 +525,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -539,7 +544,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js index 9af0ab524df58..96b0886a7362e 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js @@ -257,7 +257,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -289,7 +290,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -307,7 +309,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -413,7 +416,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -471,7 +475,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -489,7 +494,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-link-open.js index 481f2ec53cb3a..6f5a202756fca 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-link-open.js @@ -339,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -371,7 +372,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -389,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -490,7 +493,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -547,7 +551,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -565,7 +570,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-target-and-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-target-and-link-open.js index c607f48e850bb..5b6ce4a417c13 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-target-and-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-target-and-link-open.js @@ -414,7 +414,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -446,7 +447,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -464,7 +466,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -567,7 +570,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -605,7 +609,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -623,7 +628,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-target-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-target-open.js index fbeaa462f207e..30c4a95eb3463 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-target-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not-with-target-open.js @@ -339,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -371,7 +372,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -389,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -492,7 +495,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -530,7 +534,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -548,7 +553,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js index 7f3c9266f3c6b..98ce6cf1c708a 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js @@ -264,7 +264,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -296,7 +297,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -314,7 +316,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -420,7 +423,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -478,7 +482,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1261, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -496,7 +501,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-link-open.js index aa3d98b0b04b1..4ff3defcdb4bf 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-link-open.js @@ -330,7 +330,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -362,7 +363,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -380,7 +382,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -481,7 +484,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -538,7 +542,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -556,7 +561,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-target-and-link-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-target-and-link-open.js index 98df23f7b28ca..20f2453730915 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-target-and-link-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-target-and-link-open.js @@ -403,7 +403,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -435,7 +436,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -453,7 +455,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -556,7 +559,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -594,7 +598,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -612,7 +617,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-target-open.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-target-open.js index ca09578324369..8e4980d98c675 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-target-open.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not-with-target-open.js @@ -330,7 +330,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -362,7 +363,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -380,7 +382,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -483,7 +486,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -521,7 +525,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -539,7 +544,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js index 91222a2ed57d3..df049515529c5 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js @@ -257,7 +257,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -289,7 +290,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -307,7 +309,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -413,7 +416,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -471,7 +475,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1149, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -489,7 +494,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/works-when-renaming-file-with-different-casing.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/works-when-renaming-file-with-different-casing.js index 441716a379987..85f27208b2baf 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/works-when-renaming-file-with-different-casing.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/works-when-renaming-file-with-different-casing.js @@ -239,7 +239,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/Logger.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -257,7 +258,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/Logger.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -275,7 +277,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/Logger.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -614,7 +617,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/logger.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -638,7 +642,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/logger.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -656,7 +661,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/logger.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -674,7 +680,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/another.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -692,7 +699,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/another.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -710,7 +718,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/another.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/inconsistentErrorInEditor/should-not-error.js b/tests/baselines/reference/tsserver/inconsistentErrorInEditor/should-not-error.js index ddd91459c9496..a3bcc88a84990 100644 --- a/tests/baselines/reference/tsserver/inconsistentErrorInEditor/should-not-error.js +++ b/tests/baselines/reference/tsserver/inconsistentErrorInEditor/should-not-error.js @@ -152,7 +152,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "^/untitled/ts-nul-authority/Untitled-1", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -170,7 +171,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "^/untitled/ts-nul-authority/Untitled-1", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -203,7 +205,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/inconsistentErrorInEditor2/should-not-error.js b/tests/baselines/reference/tsserver/inconsistentErrorInEditor2/should-not-error.js index 0964a87f7a5db..3b91beaf1a113 100644 --- a/tests/baselines/reference/tsserver/inconsistentErrorInEditor2/should-not-error.js +++ b/tests/baselines/reference/tsserver/inconsistentErrorInEditor2/should-not-error.js @@ -137,7 +137,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "^/untitled/ts-nul-authority/Untitled-1", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -155,7 +156,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "^/untitled/ts-nul-authority/Untitled-1", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -173,7 +175,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "^/untitled/ts-nul-authority/Untitled-1", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/moduleResolution/alternateResult.js b/tests/baselines/reference/tsserver/moduleResolution/alternateResult.js index 61fd420bfb5dd..fee551f851d87 100644 --- a/tests/baselines/reference/tsserver/moduleResolution/alternateResult.js +++ b/tests/baselines/reference/tsserver/moduleResolution/alternateResult.js @@ -581,7 +581,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -626,7 +627,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -701,7 +703,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -918,7 +921,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -969,7 +973,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1044,7 +1049,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1241,7 +1247,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1292,7 +1299,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1367,7 +1375,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1574,7 +1583,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1625,7 +1635,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1700,7 +1711,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1886,7 +1898,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1937,7 +1950,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -2012,7 +2026,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -2201,7 +2216,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -2261,7 +2277,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -2336,7 +2353,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -2524,7 +2542,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -2604,7 +2623,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -2679,7 +2699,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -2913,7 +2934,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -3007,7 +3029,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -3082,7 +3105,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -3288,7 +3312,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -3364,7 +3389,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -3439,7 +3465,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -3682,7 +3709,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -3733,7 +3761,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -3808,7 +3837,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -4033,7 +4063,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -4084,7 +4115,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -4159,7 +4191,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -4394,7 +4427,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -4445,7 +4479,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -4520,7 +4555,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -4733,7 +4769,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/index.mts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -4784,7 +4821,8 @@ Info seq [hh:mm:ss:mss] event: "code": 7016, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -4859,7 +4897,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js b/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js index f94bb6b8dcc64..6aed9381084f9 100644 --- a/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js +++ b/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js @@ -377,7 +377,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -409,7 +410,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1479, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -427,7 +429,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -576,7 +579,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -594,7 +598,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -612,7 +617,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -791,7 +797,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -823,7 +830,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1479, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -841,7 +849,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1010,7 +1019,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1042,7 +1052,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1479, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1060,7 +1071,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1230,7 +1242,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1262,7 +1275,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1479, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1280,7 +1294,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited.js b/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited.js index 2f8e09fc3f60e..09886675ace05 100644 --- a/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited.js +++ b/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited.js @@ -377,7 +377,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -395,7 +396,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -413,7 +415,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -561,7 +564,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -593,7 +597,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1479, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -611,7 +616,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -784,7 +790,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -816,7 +823,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1479, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -834,7 +842,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1010,7 +1019,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1028,7 +1038,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1046,7 +1057,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1222,7 +1234,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1254,7 +1267,8 @@ Info seq [hh:mm:ss:mss] event: "code": 1479, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1272,7 +1286,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/fileA.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/moduleResolution/using-referenced-project-built.js b/tests/baselines/reference/tsserver/moduleResolution/using-referenced-project-built.js index bcc33a8b5f859..f362e9377be18 100644 --- a/tests/baselines/reference/tsserver/moduleResolution/using-referenced-project-built.js +++ b/tests/baselines/reference/tsserver/moduleResolution/using-referenced-project-built.js @@ -750,7 +750,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -768,7 +769,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -786,7 +788,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -972,7 +975,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1090,7 +1094,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1108,7 +1113,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1302,7 +1308,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1402,7 +1409,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1420,7 +1428,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/moduleResolution/using-referenced-project.js b/tests/baselines/reference/tsserver/moduleResolution/using-referenced-project.js index 95ab6a3ca9803..5702fd3d87c2e 100644 --- a/tests/baselines/reference/tsserver/moduleResolution/using-referenced-project.js +++ b/tests/baselines/reference/tsserver/moduleResolution/using-referenced-project.js @@ -532,7 +532,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -550,7 +551,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -568,7 +570,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -754,7 +757,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -872,7 +876,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -890,7 +895,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1084,7 +1090,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1184,7 +1191,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1202,7 +1210,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/home/src/projects/project/packages/package-b/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/openfile/when-file-makes-edits-to-add/remove-comment-directives,-they-are-handled-correcrly.js b/tests/baselines/reference/tsserver/openfile/when-file-makes-edits-to-add/remove-comment-directives,-they-are-handled-correcrly.js index e4a85b3605fa0..81ee0b5139983 100644 --- a/tests/baselines/reference/tsserver/openfile/when-file-makes-edits-to-add/remove-comment-directives,-they-are-handled-correcrly.js +++ b/tests/baselines/reference/tsserver/openfile/when-file-makes-edits-to-add/remove-comment-directives,-they-are-handled-correcrly.js @@ -136,7 +136,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/file.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -154,7 +155,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/file.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -172,7 +174,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/file.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -278,7 +281,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/file.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -316,7 +320,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2322, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -334,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/file.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -440,7 +446,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/file.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -464,7 +471,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/file.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -482,7 +490,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/file.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/partialSemanticServer/syntactic-diagnostics-are-returned-with-no-error.js b/tests/baselines/reference/tsserver/partialSemanticServer/syntactic-diagnostics-are-returned-with-no-error.js index 090c74e4620ff..b03a2d26e045b 100644 --- a/tests/baselines/reference/tsserver/partialSemanticServer/syntactic-diagnostics-are-returned-with-no-error.js +++ b/tests/baselines/reference/tsserver/partialSemanticServer/syntactic-diagnostics-are-returned-with-no-error.js @@ -188,7 +188,8 @@ Info seq [hh:mm:ss:mss] event: } ] } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/plugins/when-scriptKind-changes-for-the-external-file.js b/tests/baselines/reference/tsserver/plugins/when-scriptKind-changes-for-the-external-file.js index bafb624f640f6..7f4d71bbe25e3 100644 --- a/tests/baselines/reference/tsserver/plugins/when-scriptKind-changes-for-the-external-file.js +++ b/tests/baselines/reference/tsserver/plugins/when-scriptKind-changes-for-the-external-file.js @@ -318,7 +318,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/b.vue", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -342,7 +343,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/b.vue", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -375,7 +377,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js b/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js index 4b60c8bd07bd4..340f47ec23ef7 100644 --- a/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js +++ b/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js @@ -266,7 +266,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/src/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -284,7 +285,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/myproject/src/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -331,7 +333,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -434,7 +437,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/src/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -458,7 +462,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/myproject/src/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -505,7 +510,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/folder-rename-updates-project-structure-and-reports-no-errors.js b/tests/baselines/reference/tsserver/projectErrors/folder-rename-updates-project-structure-and-reports-no-errors.js index 0735f49cea05c..d57a2b9b830d1 100644 --- a/tests/baselines/reference/tsserver/projectErrors/folder-rename-updates-project-structure-and-reports-no-errors.js +++ b/tests/baselines/reference/tsserver/projectErrors/folder-rename-updates-project-structure-and-reports-no-errors.js @@ -275,7 +275,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a/b/projects/myproject/bar/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -293,7 +294,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/a/b/projects/myproject/bar/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -311,7 +313,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/a/b/projects/myproject/bar/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -500,7 +503,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a/b/projects/myproject/bar/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -518,7 +522,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/a/b/projects/myproject/bar/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -536,7 +541,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/a/b/projects/myproject/bar/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-after-installation.js b/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-after-installation.js index 9b34c951b72b8..0b2c6464c7b45 100644 --- a/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-after-installation.js +++ b/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-after-installation.js @@ -232,7 +232,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -264,7 +265,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -282,7 +284,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -420,7 +423,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -464,7 +468,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -482,7 +487,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -575,7 +581,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -607,7 +614,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -625,7 +633,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -680,7 +689,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -712,7 +722,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -730,7 +741,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -981,7 +993,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -999,7 +1012,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1017,7 +1031,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-inbetween-installation.js b/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-inbetween-installation.js index 49e7740c2fb85..d2e6e0d589c12 100644 --- a/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-inbetween-installation.js +++ b/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-inbetween-installation.js @@ -232,7 +232,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -264,7 +265,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -282,7 +284,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -470,7 +473,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -502,7 +506,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -520,7 +525,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -616,7 +622,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -648,7 +655,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -666,7 +674,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -724,7 +733,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -756,7 +766,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -774,7 +785,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1023,7 +1035,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1041,7 +1054,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1059,7 +1073,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/reports-errors-correctly-when-file-referenced-by-inferred-project-root,-is-opened-right-after-closing-the-root-file.js b/tests/baselines/reference/tsserver/projectErrors/reports-errors-correctly-when-file-referenced-by-inferred-project-root,-is-opened-right-after-closing-the-root-file.js index d7bcc39e10973..0f1d4750815b0 100644 --- a/tests/baselines/reference/tsserver/projectErrors/reports-errors-correctly-when-file-referenced-by-inferred-project-root,-is-opened-right-after-closing-the-root-file.js +++ b/tests/baselines/reference/tsserver/projectErrors/reports-errors-correctly-when-file-referenced-by-inferred-project-root,-is-opened-right-after-closing-the-root-file.js @@ -545,7 +545,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/test/backend/index.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -563,7 +564,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/test/backend/index.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -581,7 +583,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/test/backend/index.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -599,7 +602,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/client/app.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -617,7 +621,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/client/app.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -635,7 +640,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/client/app.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1155,7 +1161,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/server/utilities.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1173,7 +1180,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/server/utilities.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1191,7 +1199,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/server/utilities.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -1209,7 +1218,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/client/app.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1227,7 +1237,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/client/app.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1245,7 +1256,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/client/app.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/should-not-report-incorrect-error-when-json-is-root-file-found-by-tsconfig.js b/tests/baselines/reference/tsserver/projectErrors/should-not-report-incorrect-error-when-json-is-root-file-found-by-tsconfig.js index d01d0b0a605c8..3f2bb0a3087d6 100644 --- a/tests/baselines/reference/tsserver/projectErrors/should-not-report-incorrect-error-when-json-is-root-file-found-by-tsconfig.js +++ b/tests/baselines/reference/tsserver/projectErrors/should-not-report-incorrect-error-when-json-is-root-file-found-by-tsconfig.js @@ -258,7 +258,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -276,7 +277,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -294,7 +296,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/should-report-error-when-json-is-not-root-file-found-by-tsconfig.js b/tests/baselines/reference/tsserver/projectErrors/should-report-error-when-json-is-not-root-file-found-by-tsconfig.js index 5835200e327d4..89704303ce2ce 100644 --- a/tests/baselines/reference/tsserver/projectErrors/should-report-error-when-json-is-not-root-file-found-by-tsconfig.js +++ b/tests/baselines/reference/tsserver/projectErrors/should-report-error-when-json-is-not-root-file-found-by-tsconfig.js @@ -255,7 +255,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -287,7 +288,8 @@ Info seq [hh:mm:ss:mss] event: "code": 6307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -305,7 +307,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-with-projectRoot.js b/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-with-projectRoot.js index 70fb4577399b7..71d425a28a791 100644 --- a/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-with-projectRoot.js +++ b/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-with-projectRoot.js @@ -130,7 +130,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "untitled:Untitled-1", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -175,7 +176,8 @@ Info seq [hh:mm:ss:mss] event: "code": 6053, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -193,7 +195,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "untitled:Untitled-1", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-without-projectRoot.js b/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-without-projectRoot.js index 4fb5bdb324f22..172b525f24076 100644 --- a/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-without-projectRoot.js +++ b/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-without-projectRoot.js @@ -121,7 +121,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "untitled:Untitled-1", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -166,7 +167,8 @@ Info seq [hh:mm:ss:mss] event: "code": 6053, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -184,7 +186,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "untitled:Untitled-1", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-getErr.js b/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-getErr.js index 6e8fd62d0f3ee..4d19ce9227196 100644 --- a/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-getErr.js +++ b/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-getErr.js @@ -211,7 +211,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/ui.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -243,7 +244,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2697, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -261,7 +263,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/ui.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-geterrForProject.js b/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-geterrForProject.js index 1ba9a5dd1abd0..2bdc092776f5f 100644 --- a/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-geterrForProject.js +++ b/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-geterrForProject.js @@ -209,7 +209,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/ui.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -241,7 +242,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2697, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -259,7 +261,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/ui.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/when-options-for-dependency-project-are-different-from-usage-project.js b/tests/baselines/reference/tsserver/projectReferenceErrors/when-options-for-dependency-project-are-different-from-usage-project.js index 9ebcabbce9303..6e2fc08984cc7 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/when-options-for-dependency-project-are-different-from-usage-project.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/when-options-for-dependency-project-are-different-from-usage-project.js @@ -303,7 +303,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/b/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -353,7 +354,8 @@ Info seq [hh:mm:ss:mss] event: } ] } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -371,7 +373,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/home/src/projects/project/b/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -389,7 +392,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/a/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -407,7 +411,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/a/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -425,7 +430,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/home/src/projects/project/a/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-getErr.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-getErr.js index a87faf5e570d7..81b3bae65b04f 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-getErr.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-getErr.js @@ -300,7 +300,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -332,7 +333,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2305, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -350,7 +352,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-geterrForProject.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-geterrForProject.js index 7272d87a916b4..d9f26a5767d17 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-geterrForProject.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-geterrForProject.js @@ -298,7 +298,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -330,7 +331,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2305, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -348,7 +350,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -366,7 +369,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -384,7 +388,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -402,7 +407,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -447,7 +453,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -465,7 +472,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -483,7 +491,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -501,7 +510,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -533,7 +543,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2305, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -551,7 +562,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-getErr.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-getErr.js index 8a48b813051dc..75bd24f2a1f29 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-getErr.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-getErr.js @@ -495,7 +495,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -527,7 +528,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2305, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -545,7 +547,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -563,7 +566,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -595,7 +599,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2322, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -613,7 +618,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-geterrForProject.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-geterrForProject.js index 5b846245463da..aea8894a1e9a6 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-geterrForProject.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-geterrForProject.js @@ -492,7 +492,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -524,7 +525,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2305, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -542,7 +544,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -560,7 +563,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -578,7 +582,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -596,7 +601,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -641,7 +647,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -673,7 +680,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2322, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -691,7 +699,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-getErr.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-getErr.js index 16947440d553d..e745ea937748c 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-getErr.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-getErr.js @@ -282,7 +282,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -314,7 +315,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2304, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -332,7 +334,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-geterrForProject.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-geterrForProject.js index 34f5278ca23b6..2f43fdbad4615 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-geterrForProject.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-geterrForProject.js @@ -280,7 +280,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -312,7 +313,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2304, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -330,7 +332,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -348,7 +351,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -366,7 +370,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -384,7 +389,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -429,7 +435,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -447,7 +454,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -465,7 +473,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -483,7 +492,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -515,7 +525,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2304, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -533,7 +544,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-getErr.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-getErr.js index 47ad1ac9a31e7..c53848bd01f9e 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-getErr.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-getErr.js @@ -464,7 +464,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -496,7 +497,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2304, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -514,7 +516,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -532,7 +535,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -564,7 +568,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2322, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -582,7 +587,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-geterrForProject.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-geterrForProject.js index 1eef495b8678a..19c960ee85c80 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-geterrForProject.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-geterrForProject.js @@ -461,7 +461,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -493,7 +494,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2304, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -511,7 +513,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/usage/usage.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -529,7 +532,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -547,7 +551,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -565,7 +570,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -610,7 +616,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -642,7 +649,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2322, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -660,7 +668,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/dependency/fns.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built-with-preserveSymlinks.js index 679215a2a35b9..ad887823e608e 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built-with-preserveSymlinks.js @@ -552,7 +552,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -570,7 +571,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -588,7 +590,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -704,7 +707,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -728,7 +732,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -746,7 +751,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built.js index 03f0624ad8eb2..749d3565316a7 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built.js @@ -547,7 +547,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -565,7 +566,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -583,7 +585,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -699,7 +702,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -723,7 +727,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -741,7 +746,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built-with-preserveSymlinks.js index cf308fad2496e..ef41262b7fd2d 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built-with-preserveSymlinks.js @@ -358,7 +358,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -376,7 +377,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -394,7 +396,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -510,7 +513,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -534,7 +538,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -552,7 +557,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built.js index 59e6c1d6c689f..8c61ea4584015 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built.js @@ -353,7 +353,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -371,7 +372,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -389,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -505,7 +508,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -529,7 +533,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -547,7 +552,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js index 9641cc9135256..a01d329b230f6 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js @@ -552,7 +552,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -570,7 +571,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -588,7 +590,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -704,7 +707,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -728,7 +732,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -746,7 +751,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built.js index ae640951057af..43b81b3f83d78 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built.js @@ -547,7 +547,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -565,7 +566,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -583,7 +585,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -699,7 +702,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -723,7 +727,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -741,7 +746,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js index 1de95f3800f1f..f605bc175506c 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js @@ -358,7 +358,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -376,7 +377,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -394,7 +396,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -510,7 +513,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -534,7 +538,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -552,7 +557,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built.js index 659779488fda1..7e061e656840e 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built.js @@ -353,7 +353,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -371,7 +372,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -389,7 +391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -505,7 +508,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -529,7 +533,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -547,7 +552,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built-with-preserveSymlinks.js index b3c959342ff56..fdab0f8f7dd74 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built-with-preserveSymlinks.js @@ -548,7 +548,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -566,7 +567,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -584,7 +586,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -700,7 +703,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -724,7 +728,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -742,7 +747,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built.js index 8ee914806e83f..71a1250d496bc 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built.js @@ -543,7 +543,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -561,7 +562,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -579,7 +581,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -695,7 +698,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -719,7 +723,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -737,7 +742,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built-with-preserveSymlinks.js index 2d26bf3fd19ab..dd37c0bb5adae 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built-with-preserveSymlinks.js @@ -354,7 +354,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -372,7 +373,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -390,7 +392,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -506,7 +509,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -530,7 +534,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -548,7 +553,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built.js index ee7a638528446..fae81da8f268f 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built.js @@ -349,7 +349,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -367,7 +368,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -385,7 +387,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -501,7 +504,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -525,7 +529,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -543,7 +548,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js index aa7141dc9fb24..38c925b4eb286 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js @@ -548,7 +548,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -566,7 +567,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -584,7 +586,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -700,7 +703,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -724,7 +728,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -742,7 +747,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built.js index 489ab9aed81c8..14ce366c5b483 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built.js @@ -543,7 +543,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -561,7 +562,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -579,7 +581,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -695,7 +698,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -719,7 +723,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -737,7 +742,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js index 32dade80ed317..c47c38982c380 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js @@ -354,7 +354,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -372,7 +373,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -390,7 +392,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -506,7 +509,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -530,7 +534,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -548,7 +553,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built.js index b1d62156a5eed..1ff59f4384224 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built.js @@ -349,7 +349,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -367,7 +368,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -385,7 +387,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -501,7 +504,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -525,7 +529,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -543,7 +548,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/A/src/test.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/project-is-directly-referenced-by-solution.js b/tests/baselines/reference/tsserver/projectReferences/project-is-directly-referenced-by-solution.js index fe46d14cb15e7..42e548fa71050 100644 --- a/tests/baselines/reference/tsserver/projectReferences/project-is-directly-referenced-by-solution.js +++ b/tests/baselines/reference/tsserver/projectReferences/project-is-directly-referenced-by-solution.js @@ -407,7 +407,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -425,7 +426,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -443,7 +445,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/project-is-indirectly-referenced-by-solution.js b/tests/baselines/reference/tsserver/projectReferences/project-is-indirectly-referenced-by-solution.js index 6d5deb4df7cc2..8c338327beacc 100644 --- a/tests/baselines/reference/tsserver/projectReferences/project-is-indirectly-referenced-by-solution.js +++ b/tests/baselines/reference/tsserver/projectReferences/project-is-indirectly-referenced-by-solution.js @@ -498,7 +498,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -516,7 +517,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -534,7 +536,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/referencing-const-enum-from-referenced-project-with-preserveConstEnums.js b/tests/baselines/reference/tsserver/projectReferences/referencing-const-enum-from-referenced-project-with-preserveConstEnums.js index 60ff517739c01..10bd790d36a37 100644 --- a/tests/baselines/reference/tsserver/projectReferences/referencing-const-enum-from-referenced-project-with-preserveConstEnums.js +++ b/tests/baselines/reference/tsserver/projectReferences/referencing-const-enum-from-referenced-project-with-preserveConstEnums.js @@ -300,7 +300,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/project/src/project/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -318,7 +319,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/project/src/project/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -336,7 +338,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/project/src/project/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-found-is-not-solution-but-references-open-file-through-project-reference.js b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-found-is-not-solution-but-references-open-file-through-project-reference.js index 5510cc362c5de..e4628ed9e0e99 100644 --- a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-found-is-not-solution-but-references-open-file-through-project-reference.js +++ b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-found-is-not-solution-but-references-open-file-through-project-reference.js @@ -456,7 +456,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -474,7 +475,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -492,7 +494,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-is-indirectly-referenced-by-solution.js b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-is-indirectly-referenced-by-solution.js index afb61f8b9796a..988e2e569295d 100644 --- a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-is-indirectly-referenced-by-solution.js +++ b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-is-indirectly-referenced-by-solution.js @@ -559,7 +559,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -577,7 +578,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -595,7 +597,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/when-the-referenced-projects-have-allowJs-and-emitDeclarationOnly.js b/tests/baselines/reference/tsserver/projectReferences/when-the-referenced-projects-have-allowJs-and-emitDeclarationOnly.js index 10ef3bf02adb9..7cdc5147a5a1c 100644 --- a/tests/baselines/reference/tsserver/projectReferences/when-the-referenced-projects-have-allowJs-and-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsserver/projectReferences/when-the-referenced-projects-have-allowJs-and-emitDeclarationOnly.js @@ -354,7 +354,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/user/username/projects/myproject/packages/consumer/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -386,7 +387,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2554, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -404,7 +406,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/user/username/projects/myproject/packages/consumer/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js b/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js index f3f8bf70e1a87..66c072bb99fdb 100644 --- a/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js +++ b/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js @@ -818,7 +818,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/project/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -895,7 +896,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/project/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -913,7 +915,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/project/b.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 0 @@ -936,7 +939,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/project/sub/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 2 @@ -954,7 +958,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/project/sub/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -972,7 +977,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/project/sub/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js index c1145271d37e6..fea26b08422db 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js @@ -104,7 +104,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a/b/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -148,7 +149,8 @@ Info seq [hh:mm:ss:mss] event: "offset": 13 } } - ] + ], + "duration": * } } After running Immedidate callback:: count: 0 @@ -201,7 +203,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2345, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -219,7 +222,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/a/b/app.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/resolutionCache/disable-suggestion-diagnostics.js b/tests/baselines/reference/tsserver/resolutionCache/disable-suggestion-diagnostics.js index e3921fce99c6b..9c97b4c9dd491 100644 --- a/tests/baselines/reference/tsserver/resolutionCache/disable-suggestion-diagnostics.js +++ b/tests/baselines/reference/tsserver/resolutionCache/disable-suggestion-diagnostics.js @@ -257,7 +257,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -275,7 +276,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/a.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/resolutionCache/npm-install-@types-works.js b/tests/baselines/reference/tsserver/resolutionCache/npm-install-@types-works.js index af8115afd925e..64d3327c079e7 100644 --- a/tests/baselines/reference/tsserver/resolutionCache/npm-install-@types-works.js +++ b/tests/baselines/reference/tsserver/resolutionCache/npm-install-@types-works.js @@ -141,7 +141,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a/b/projects/temp/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -173,7 +174,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -191,7 +193,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/a/b/projects/temp/a.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/resolutionCache/suggestion-diagnostics.js b/tests/baselines/reference/tsserver/resolutionCache/suggestion-diagnostics.js index 5f27d805a0eef..8a2af58e8f9df 100644 --- a/tests/baselines/reference/tsserver/resolutionCache/suggestion-diagnostics.js +++ b/tests/baselines/reference/tsserver/resolutionCache/suggestion-diagnostics.js @@ -217,7 +217,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/a.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -235,7 +236,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/a.js", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -268,7 +270,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-compiles-from-sources.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-compiles-from-sources.js index 6e9cada601563..da7a51b7f2a9b 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-compiles-from-sources.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-compiles-from-sources.js @@ -279,7 +279,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -311,7 +312,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -329,7 +331,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -604,7 +607,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -622,7 +626,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -640,7 +645,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js index 6553199a4fbc4..da641c30a6eab 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js @@ -287,7 +287,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -319,7 +320,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -337,7 +339,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -563,7 +566,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -581,7 +585,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -599,7 +604,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-recompiles-after-deleting-generated-folders.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-recompiles-after-deleting-generated-folders.js index f8d8ae040c15d..1677dff3b9e88 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-recompiles-after-deleting-generated-folders.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-recompiles-after-deleting-generated-folders.js @@ -286,7 +286,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -304,7 +305,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -322,7 +324,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -530,7 +533,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -562,7 +566,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -580,7 +585,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -823,7 +829,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -841,7 +848,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -859,7 +867,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-compiles-from-sources.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-compiles-from-sources.js index d502b2ad326d8..282552eb1ba4b 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-compiles-from-sources.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-compiles-from-sources.js @@ -311,7 +311,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -343,7 +344,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -361,7 +363,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -665,7 +668,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -683,7 +687,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -701,7 +706,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js index 7c2c2f898b2a1..c105b8c8a8d6a 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js @@ -316,7 +316,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -348,7 +349,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -366,7 +368,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -611,7 +614,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -629,7 +633,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -647,7 +652,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-recompiles-after-deleting-generated-folders.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-recompiles-after-deleting-generated-folders.js index 96975039f60b6..830581bacda79 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-recompiles-after-deleting-generated-folders.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-recompiles-after-deleting-generated-folders.js @@ -305,7 +305,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -323,7 +324,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -341,7 +343,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -559,7 +562,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -591,7 +595,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -609,7 +614,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -871,7 +877,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -889,7 +896,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -907,7 +915,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/users/username/projects/myproject/javascript/packages/recognizers-date-time/src/datetime/baseDate.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-Linux.js b/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-Linux.js index aa70b773a0970..e335660987b1f 100644 --- a/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-Linux.js +++ b/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-Linux.js @@ -411,7 +411,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -443,7 +444,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -490,7 +492,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -783,7 +786,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -801,7 +805,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -848,7 +853,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1320,7 +1326,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1352,7 +1359,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1399,7 +1407,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1759,7 +1768,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1777,7 +1787,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1824,7 +1835,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-package1-built-Linux.js b/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-package1-built-Linux.js index a9f20884ab1af..2d1f5ad7b43b5 100644 --- a/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-package1-built-Linux.js +++ b/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-package1-built-Linux.js @@ -387,7 +387,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -405,7 +406,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -452,7 +454,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -927,7 +930,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -959,7 +963,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1006,7 +1011,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1366,7 +1372,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1384,7 +1391,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1431,7 +1439,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-package1-built.js b/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-package1-built.js index 307b63d2e24dc..366426726599a 100644 --- a/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-package1-built.js +++ b/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked-package1-built.js @@ -383,7 +383,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -401,7 +402,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -448,7 +450,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -731,7 +734,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -763,7 +767,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -810,7 +815,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1073,7 +1079,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1091,7 +1098,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1138,7 +1146,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked.js b/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked.js index 82e374ceb4e7f..2a75b43c16b69 100644 --- a/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked.js +++ b/tests/baselines/reference/tsserver/symLinks/monorepo-style-sibling-packages-symlinked.js @@ -409,7 +409,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -441,7 +442,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -488,7 +490,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -734,7 +737,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -752,7 +756,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -799,7 +804,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1082,7 +1088,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1114,7 +1121,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1161,7 +1169,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1424,7 +1433,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1442,7 +1452,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/home/src/projects/project/packages/package2/src/index.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1489,7 +1500,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watching-npm-install-in-codespaces-where-workspaces-folder-is-hosted-at-root.js b/tests/baselines/reference/tsserver/watchEnvironment/watching-npm-install-in-codespaces-where-workspaces-folder-is-hosted-at-root.js index 244fdb7d417b9..302f6aa58af9f 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watching-npm-install-in-codespaces-where-workspaces-folder-is-hosted-at-root.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watching-npm-install-in-codespaces-where-workspaces-folder-is-hosted-at-root.js @@ -247,7 +247,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/workspaces/somerepo/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -265,7 +266,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/workspaces/somerepo/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -283,7 +285,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/workspaces/somerepo/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -450,7 +453,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/workspaces/somerepo/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 3 @@ -524,7 +528,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -542,7 +547,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/workspaces/somerepo/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -733,7 +739,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/workspaces/somerepo/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 3 @@ -808,7 +815,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/workspaces/somerepo/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -826,7 +834,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/workspaces/somerepo/src/main.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: From 4d3f0689c2690dbdf2e75036a7e56fbb4de9cbb0 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 21 May 2024 12:34:10 -0700 Subject: [PATCH 43/74] CR: make `shouldDoRegionCheck` internal and override it in `TestSession` --- src/server/session.ts | 1 + src/testRunner/unittests/helpers/tsserver.ts | 4 ++++ .../unittests/tsserver/regionDiagnostics.ts | 15 ++------------- tests/baselines/reference/api/typescript.d.ts | 1 - 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index c5be9b51b0791..12ddc3793f026 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1299,6 +1299,7 @@ export class Session implements EventSender { } // We should only do the region-based semantic check if we think it would be considerably faster than a whole-file semantic check + /** @internal */ protected shouldDoRegionCheck(file: NormalizedPath): boolean { const perf = this.semanticCheckPerformance.get(file); return !!perf && perf > 1000; diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index b1c2192730c25..d33e737f958c2 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -165,6 +165,10 @@ export class TestSession extends ts.server.Session { request.type = "request"; return this.executeCommand(request); } + + protected override shouldDoRegionCheck(_file: ts.server.NormalizedPath): boolean { + return true; + } } export function createSessionWithCustomEventHandler( diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index d0f1b3512734c..d88fe4e2e28cd 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -2,7 +2,6 @@ import * as ts from "../../_namespaces/ts"; import { baselineTsserverLogs, TestSession, - TestSessionConstructorOptions, } from "../helpers/tsserver"; import { createServerHost } from "../helpers/virtualFileSystemWithWatch"; @@ -19,7 +18,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { foo(10, 50);`, }; const host = createServerHost([file1]); - const session = new RegionTestSession(host); + const session = new TestSession(host); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Open, @@ -63,14 +62,4 @@ function verifyGetErrRegionRequest(request: VerifyGetErrRegionRequest): void { session.host.runQueuedImmediateCallbacks(); // Run suggestion diagnostics session.host.runQueuedImmediateCallbacks(); -} - -class RegionTestSession extends TestSession { - constructor(optsOrHost: TestSessionConstructorOptions) { - super(optsOrHost); - } - - protected override shouldDoRegionCheck(_file: ts.server.NormalizedPath): boolean { - return true; - } -} +} \ No newline at end of file diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 16b7a682ef796..65d0f5b89474a 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3417,7 +3417,6 @@ declare namespace ts { private syntacticCheck; private suggestionCheck; private regionSemanticCheck; - protected shouldDoRegionCheck(file: NormalizedPath): boolean; private sendDiagnosticsEvent; /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ private updateErrorCheck; From 11b7966af5f932f2245d08f9d8a6b9114163ec11 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 21 May 2024 14:26:46 -0700 Subject: [PATCH 44/74] CR: clean up session's semantic check perf data when file is closed --- src/server/session.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/server/session.ts b/src/server/session.ts index 12ddc3793f026..5cdec448bef04 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1305,6 +1305,13 @@ export class Session implements EventSender { return !!perf && perf > 1000; } + /** @internal */ + private cleanUpSemanticCheckPerformance(closedFiles: string[] | undefined): void { + if (closedFiles) { + closedFiles.forEach(file => this.semanticCheckPerformance.delete(toNormalizedPath(file))); + } + } + private sendDiagnosticsEvent(file: NormalizedPath, project: Project, diagnostics: readonly Diagnostic[], kind: protocol.DiagnosticEventKind, spans?: TextSpan[]): void { try { const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); @@ -3331,6 +3338,7 @@ export class Session implements EventSender { })), request.arguments.closedFiles, ); + this.cleanUpSemanticCheckPerformance(request.arguments.closedFiles); return this.requiredResponse(/*response*/ true); }, [protocol.CommandTypes.ApplyChangedToOpenFiles]: (request: protocol.ApplyChangedToOpenFilesRequest) => { @@ -3344,6 +3352,7 @@ export class Session implements EventSender { })), request.arguments.closedFiles, ); + this.cleanUpSemanticCheckPerformance(request.arguments.closedFiles); // TODO: report errors return this.requiredResponse(/*response*/ true); }, From f02cef41e6c06040f0591f7835e9ac2093360bbc Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 21 May 2024 15:44:19 -0700 Subject: [PATCH 45/74] CR: make unit test helper `verifyGetErrRequest` support region-based diagnostics --- src/testRunner/unittests/helpers/tsserver.ts | 17 +++++++++-- .../unittests/tsserver/regionDiagnostics.ts | 30 ++----------------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index d33e737f958c2..5cb5097b7827e 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -4,6 +4,7 @@ import { createLoggerWithInMemoryLogs, LoggerWithInMemoryLogs, } from "../../../harness/tsserverLogger"; +import { FileRangesRequestArgs } from "../../../server/protocol"; import { patchHostForBuildInfoReadWrite } from "../../_namespaces/fakes"; import * as Harness from "../../_namespaces/Harness"; import * as ts from "../../_namespaces/ts"; @@ -370,14 +371,22 @@ export interface VerifyGetErrRequestBase { existingTimeouts?: boolean; } export interface VerifyGetErrRequest extends VerifyGetErrRequestBase { - files: readonly (string | File)[]; + files: readonly (string | File | FileRangesRequestArgs)[]; skip?: CheckAllErrors["skip"]; } export function verifyGetErrRequest(request: VerifyGetErrRequest) { const { session, files } = request; session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Geterr, - arguments: { delay: 0, files: files.map(filePath) }, + arguments: { + delay: 0, + files: files.map(file => { + if (typeof file !== "string" && !(file as FileRangesRequestArgs).ranges) { + return filePath(file as File); + } + return file as string | FileRangesRequestArgs; + }), + }, }); checkAllErrors(request); } @@ -393,6 +402,10 @@ export interface CheckAllErrors extends VerifyGetErrRequestBase { function checkAllErrors({ session, existingTimeouts, files, skip }: CheckAllErrors) { for (let i = 0; i < files.length; i++) { session.host.runQueuedTimeoutCallbacks(existingTimeouts ? session.host.getNextTimeoutId() - 1 : undefined); + if (files[i].ranges) { + session.host.runQueuedImmediateCallbacks(); + session.host.runQueuedTimeoutCallbacks(); + } if (!skip?.[i]?.semantic) session.host.runQueuedImmediateCallbacks(); if (!skip?.[i]?.suggestion) session.host.runQueuedImmediateCallbacks(); } diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index d88fe4e2e28cd..b2d223409462e 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -2,6 +2,7 @@ import * as ts from "../../_namespaces/ts"; import { baselineTsserverLogs, TestSession, + verifyGetErrRequest, } from "../helpers/tsserver"; import { createServerHost } from "../helpers/virtualFileSystemWithWatch"; @@ -25,7 +26,7 @@ foo(10, 50);`, arguments: { file: file1.path }, }); - verifyGetErrRegionRequest({ + verifyGetErrRequest({ session, files: [{ file: file1.path, @@ -36,30 +37,3 @@ foo(10, 50);`, baselineTsserverLogs("regionDiagnostics", "diagnostics for select nodes", session); }); }); - -interface VerifyGetErrRegionRequest { - session: TestSession; - files: ts.server.protocol.FileRangesRequestArgs[]; -} - -function verifyGetErrRegionRequest(request: VerifyGetErrRegionRequest): void { - const { session, files } = request; - - session.executeCommandSeq({ - command: ts.server.protocol.CommandTypes.Geterr, - arguments: { - delay: 0, - files, - }, - }); - - // Run syntax diagnostics - session.host.runQueuedTimeoutCallbacks(); - // Run region semantic diagnostics - session.host.runQueuedImmediateCallbacks(); - // Run full semantic diagnostics - session.host.runQueuedTimeoutCallbacks(); - session.host.runQueuedImmediateCallbacks(); - // Run suggestion diagnostics - session.host.runQueuedImmediateCallbacks(); -} \ No newline at end of file From e62ec2eb38810887183c990a251d47d7517effc8 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 21 May 2024 16:04:57 -0700 Subject: [PATCH 46/74] CR: mark region diagnostics methods as internal --- src/compiler/types.ts | 5 ++++- src/services/types.ts | 1 + tests/baselines/reference/api/typescript.d.ts | 8 ++------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 777ea71aae853..a194cdb130698 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4712,8 +4712,11 @@ export interface Program extends ScriptReferenceHost { getOptionsDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; - /** The first time this is called without `nodesToCheck`, it will return global diagnostics (no location). */ + /** The first time this is called, it will return global diagnostics (no location). */ + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; + /** @internal */ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[]; + getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; getConfigFileParsingDiagnostics(): readonly Diagnostic[]; /** @internal */ getSuggestionDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; diff --git a/src/services/types.ts b/src/services/types.ts index 69cca67d7433d..f049ea6e4dc81 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -496,6 +496,7 @@ export interface LanguageService { /** * Similar to {@link getSemanticDiagnostics}, but only checks the specified ranges of the file for diagnostics. + * @internal */ getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): RegionDiagnosticsResult | undefined; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 65d0f5b89474a..5ec52ed86d7c3 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -5945,8 +5945,8 @@ declare namespace ts { getOptionsDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; - /** The first time this is called without `nodesToCheck`, it will return global diagnostics (no location). */ - getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[]; + /** The first time this is called, it will return global diagnostics (no location). */ + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; getConfigFileParsingDiagnostics(): readonly Diagnostic[]; /** @@ -9986,10 +9986,6 @@ declare namespace ts { * @param fileName A path to the file you want semantic diagnostics for */ getSemanticDiagnostics(fileName: string): Diagnostic[]; - /** - * Similar to {@link getSemanticDiagnostics}, but only checks the specified ranges of the file for diagnostics. - */ - getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): RegionDiagnosticsResult | undefined; /** * Gets suggestion diagnostics for a specific file. These diagnostics tend to * proactively suggest refactors, as opposed to diagnostics that indicate From 90ef0052336a6ea4566f273fdf3222043f121637 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 22 May 2024 12:42:06 -0700 Subject: [PATCH 47/74] CR: add test for multiple files; fix testing helper to support region diagnostics --- src/testRunner/unittests/helpers/tsserver.ts | 31 +- .../unittests/tsserver/regionDiagnostics.ts | 89 ++- ...nodes-and-whole-file-for-multiple-files.js | 615 ++++++++++++++++++ ...stics-for-select-nodes-in-a-single-file.js | 238 +++++++ 4 files changed, 967 insertions(+), 6 deletions(-) create mode 100644 tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js create mode 100644 tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index 5cb5097b7827e..19267032b0047 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -394,20 +394,43 @@ export function verifyGetErrRequest(request: VerifyGetErrRequest) { interface SkipErrors { semantic?: true; suggestion?: true; + regionSemantic?: false; } export interface CheckAllErrors extends VerifyGetErrRequestBase { files: readonly any[]; skip?: readonly (SkipErrors | undefined)[]; } function checkAllErrors({ session, existingTimeouts, files, skip }: CheckAllErrors) { - for (let i = 0; i < files.length; i++) { + // Files with region will be checked first. + const fileSkips = files + .map((_file, i) => skip?.[i]) + .sort((a, b) => { + if (a?.regionSemantic === false && b?.regionSemantic === undefined) return -1; + if (b?.regionSemantic === false && a?.regionSemantic === undefined) return 1; + return 0; + }); + for (const fileSkip of fileSkips) { + // Run syntax check for next file session.host.runQueuedTimeoutCallbacks(existingTimeouts ? session.host.getNextTimeoutId() - 1 : undefined); - if (files[i].ranges) { + if (fileSkip?.regionSemantic === false) { + // Run only region semantic check at first session.host.runQueuedImmediateCallbacks(); + continue; + } + // Run semantic check + if (!fileSkip?.semantic) session.host.runQueuedImmediateCallbacks(); + // Run suggestion check + if (!fileSkip?.suggestion) session.host.runQueuedImmediateCallbacks(); + } + for (const fileSkip of fileSkips) { + if (fileSkip?.regionSemantic === false) { session.host.runQueuedTimeoutCallbacks(); + // Run semantic check + if (!fileSkip?.semantic) session.host.runQueuedImmediateCallbacks(); + // Run suggestion check + if (!fileSkip?.suggestion) session.host.runQueuedImmediateCallbacks(); } - if (!skip?.[i]?.semantic) session.host.runQueuedImmediateCallbacks(); - if (!skip?.[i]?.suggestion) session.host.runQueuedImmediateCallbacks(); + else break; } } diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index b2d223409462e..440f78953f306 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -7,7 +7,7 @@ import { import { createServerHost } from "../helpers/virtualFileSystemWithWatch"; describe("unittests:: tsserver:: regionDiagnostics", () => { - it("diagnostics for select nodes", () => { + it("diagnostics for select nodes in a single file", () => { const file1 = { path: "/a/b/app.ts", content: `function foo(x: number, y: string): number { @@ -32,8 +32,93 @@ foo(10, 50);`, file: file1.path, ranges: [{ startLine: 6, startOffset: 1, endLine: 7, endOffset: 13 }], }], + skip: [ + { regionSemantic: false }, + ], }); - baselineTsserverLogs("regionDiagnostics", "diagnostics for select nodes", session); + baselineTsserverLogs("regionDiagnostics", "diagnostics for select nodes in a single file", session); + }); + + it("diagnostics for select nodes and whole file for multiple files", () => { + const file1 = { + path: "/a/b/app.ts", + content: ` +function add(x: number, y: string): number { + return x + y; +} + +add(10, 50); +`, + }; + const file2 = { + path: "/a/b/app2.ts", + content: ` +function booleanNoop(b: boolean): void { + b; + return; +} + +booleanNoop("not a boolean"); +`, + }; + const file3 = { + path: "/a/b/app3.ts", + content: ` +function stringId(x: string): string { + return x; +} + +stringId("ok"); + +stringId(1000); +`, + }; + + const file4 = { + path: "/a/b/app4.ts", + content: ` +function numberId(x: number): number { + return x; +} + +numberId(1000); +`, + }; + + const files = [file1, file2, file3, file4]; + const host = createServerHost(files); + const session = new TestSession(host); + + session.executeCommandSeq({ + command: ts.server.protocol.CommandTypes.UpdateOpen, + arguments: { + openFiles: files.map(f => ({ file: f.path, fileContent: f.content })), + }, + }); + + verifyGetErrRequest({ + session, + files: [ + { + file: file1.path, + ranges: [{ startLine: 6, startOffset: 1, endLine: 6, endOffset: 13 }], // `add(10, 50);` + }, + file2.path, + { + file: file3.path, + ranges: [{ startLine: 6, startOffset: 1, endLine: 6, endOffset: 16 }], // `stringId("ok");` + }, + file4.path, + ], + skip: [ + { regionSemantic: false }, + undefined, + { regionSemantic: false }, + undefined, + ], + }); + + baselineTsserverLogs("regionDiagnostics", "diagnostics for select nodes and whole file for multiple files", session); }); }); diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js new file mode 100644 index 0000000000000..16fbe1f39db70 --- /dev/null +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js @@ -0,0 +1,615 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +Before request +//// [/a/b/app.ts] + +function add(x: number, y: string): number { + return x + y; +} + +add(10, 50); + + +//// [/a/b/app2.ts] + +function booleanNoop(b: boolean): void { + b; + return; +} + +booleanNoop("not a boolean"); + + +//// [/a/b/app3.ts] + +function stringId(x: string): string { + return x; +} + +stringId("ok"); + +stringId(1000); + + +//// [/a/b/app4.ts] + +function numberId(x: number): number { + return x; +} + +numberId(1000); + + + +Info seq [hh:mm:ss:mss] request: + { + "command": "updateOpen", + "arguments": { + "openFiles": [ + { + "file": "/a/b/app.ts", + "fileContent": "\nfunction add(x: number, y: string): number {\n return x + y;\n}\n\nadd(10, 50);\n" + }, + { + "file": "/a/b/app2.ts", + "fileContent": "\nfunction booleanNoop(b: boolean): void {\n b;\n return;\n}\n\nbooleanNoop(\"not a boolean\");\n" + }, + { + "file": "/a/b/app3.ts", + "fileContent": "\nfunction stringId(x: string): string {\n return x;\n}\n\nstringId(\"ok\");\n\nstringId(1000);\n" + }, + { + "file": "/a/b/app4.ts", + "fileContent": "\nfunction numberId(x: number): number {\n return x;\n}\n\nnumberId(1000);\n" + } + ] + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app.ts ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject1* WatchType: Missing file +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 (1) + /a/b/app.ts SVC-1-0 "\nfunction add(x: number, y: string): number {\n return x + y;\n}\n\nadd(10, 50);\n" + + + app.ts + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app2.ts ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject2* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject2* WatchType: Missing file +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject2* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject2*' (Inferred) +Info seq [hh:mm:ss:mss] Files (1) + /a/b/app2.ts SVC-1-0 "\nfunction booleanNoop(b: boolean): void {\n b;\n return;\n}\n\nbooleanNoop(\"not a boolean\");\n" + + + app2.ts + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app3.ts ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject3* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject3* WatchType: Missing file +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject3* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject3*' (Inferred) +Info seq [hh:mm:ss:mss] Files (1) + /a/b/app3.ts SVC-1-0 "\nfunction stringId(x: string): string {\n return x;\n}\n\nstringId(\"ok\");\n\nstringId(1000);\n" + + + app3.ts + Root file specified for compilation + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app4.ts ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject4* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject4* WatchType: Missing file +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject4* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject4*' (Inferred) +Info seq [hh:mm:ss:mss] Files (1) + /a/b/app4.ts SVC-1-0 "\nfunction numberId(x: number): number {\n return x;\n}\n\nnumberId(1000);\n" + + + app4.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 (1) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject2*' (Inferred) +Info seq [hh:mm:ss:mss] Files (1) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject3*' (Inferred) +Info seq [hh:mm:ss:mss] Files (1) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject4*' (Inferred) +Info seq [hh:mm:ss:mss] Files (1) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /a/b/app.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileName: /a/b/app2.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject2* +Info seq [hh:mm:ss:mss] FileName: /a/b/app3.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject3* +Info seq [hh:mm:ss:mss] FileName: /a/b/app4.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject4* +Info seq [hh:mm:ss:mss] response: + { + "response": true, + "responseRequired": true + } +After request + +PolledWatches:: +/a/lib/lib.d.ts: *new* + {"pollingInterval":500} + +Projects:: +/dev/null/inferredProject1* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 +/dev/null/inferredProject2* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 +/dev/null/inferredProject3* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 +/dev/null/inferredProject4* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/a/b/app.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject1* *default* +/a/b/app2.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject2* *default* +/a/b/app3.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject3* *default* +/a/b/app4.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject4* *default* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "geterr", + "arguments": { + "delay": 0, + "files": [ + { + "file": "/a/b/app.ts", + "ranges": [ + { + "startLine": 6, + "startOffset": 1, + "endLine": 6, + "endOffset": 13 + } + ] + }, + "/a/b/app2.ts", + { + "file": "/a/b/app3.ts", + "ranges": [ + { + "startLine": 6, + "startOffset": 1, + "endLine": 6, + "endOffset": 16 + } + ] + }, + "/a/b/app4.ts" + ] + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Timeout callback:: count: 1 +1: checkOne *new* + +Before running Timeout callback:: count: 1 +1: checkOne + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +1: regionSemanticCheck *new* + +Before running Immedidate callback:: count: 1 +1: regionSemanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "regionSemanticDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [ + { + "start": { + "line": 6, + "offset": 9 + }, + "end": { + "line": 6, + "offset": 11 + }, + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "code": 2345, + "category": "error" + } + ], + "spans": [ + { + "start": { + "line": 4, + "offset": 2 + }, + "end": { + "line": 6, + "offset": 13 + } + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 0 + +Timeout callback:: count: 1 +2: checkOne *new* + +Before running Timeout callback:: count: 1 +2: checkOne + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/a/b/app3.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +2: regionSemanticCheck *new* + +Before running Immedidate callback:: count: 1 +2: regionSemanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "regionSemanticDiag", + "body": { + "file": "/a/b/app3.ts", + "diagnostics": [], + "spans": [ + { + "start": { + "line": 4, + "offset": 2 + }, + "end": { + "line": 6, + "offset": 16 + } + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 0 + +Timeout callback:: count: 1 +3: checkOne *new* + +Before running Timeout callback:: count: 1 +3: checkOne + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/a/b/app2.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +3: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +3: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/a/b/app2.ts", + "diagnostics": [ + { + "start": { + "line": 7, + "offset": 13 + }, + "end": { + "line": 7, + "offset": 28 + }, + "text": "Argument of type 'string' is not assignable to parameter of type 'boolean'.", + "code": 2345, + "category": "error" + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +4: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +4: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/a/b/app2.ts", + "diagnostics": [], + "duration": * + } + } +After running Immedidate callback:: count: 0 + +Timeout callback:: count: 1 +4: checkOne *new* + +Before running Timeout callback:: count: 1 +4: checkOne + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/a/b/app4.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +5: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +5: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/a/b/app4.ts", + "diagnostics": [], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +6: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +6: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/a/b/app4.ts", + "diagnostics": [], + "duration": * + } + } +After running Immedidate callback:: count: 0 + +Timeout callback:: count: 1 +5: checkFullOne *new* + +Before running Timeout callback:: count: 1 +5: checkFullOne + +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +7: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +7: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [ + { + "start": { + "line": 3, + "offset": 5 + }, + "end": { + "line": 3, + "offset": 11 + }, + "text": "Type 'string' is not assignable to type 'number'.", + "code": 2322, + "category": "error" + }, + { + "start": { + "line": 6, + "offset": 9 + }, + "end": { + "line": 6, + "offset": 11 + }, + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "code": 2345, + "category": "error" + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +8: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +8: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [], + "duration": * + } + } +After running Immedidate callback:: count: 0 + +Timeout callback:: count: 1 +6: checkFullOne *new* + +Before running Timeout callback:: count: 1 +6: checkFullOne + +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +9: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +9: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/a/b/app3.ts", + "diagnostics": [ + { + "start": { + "line": 8, + "offset": 10 + }, + "end": { + "line": 8, + "offset": 14 + }, + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "code": 2345, + "category": "error" + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +10: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +10: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/a/b/app3.ts", + "diagnostics": [], + "duration": * + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "requestCompleted", + "body": { + "request_seq": 2 + } + } +After running Immedidate callback:: count: 0 diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js new file mode 100644 index 0000000000000..fea26b08422db --- /dev/null +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js @@ -0,0 +1,238 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +Before request +//// [/a/b/app.ts] +function foo(x: number, y: string): number { + return x + y; +} + + + +foo(10, 50); + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/a/b/app.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app.ts ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject1* WatchType: Missing file +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 (1) + /a/b/app.ts SVC-1-0 "function foo(x: number, y: string): number {\n return x + y;\n}\n\n\n\nfoo(10, 50);" + + + app.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 (1) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /a/b/app.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/a/lib/lib.d.ts: *new* + {"pollingInterval":500} + +Projects:: +/dev/null/inferredProject1* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/a/b/app.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject1* *default* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "geterr", + "arguments": { + "delay": 0, + "files": [ + { + "file": "/a/b/app.ts", + "ranges": [ + { + "startLine": 6, + "startOffset": 1, + "endLine": 7, + "endOffset": 13 + } + ] + } + ] + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Timeout callback:: count: 1 +1: checkOne *new* + +Before running Timeout callback:: count: 1 +1: checkOne + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +1: regionSemanticCheck *new* + +Before running Immedidate callback:: count: 1 +1: regionSemanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "regionSemanticDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [ + { + "start": { + "line": 7, + "offset": 9 + }, + "end": { + "line": 7, + "offset": 11 + }, + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "code": 2345, + "category": "error" + } + ], + "spans": [ + { + "start": { + "line": 3, + "offset": 2 + }, + "end": { + "line": 7, + "offset": 13 + } + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 0 + +Timeout callback:: count: 1 +2: checkFullOne *new* + +Before running Timeout callback:: count: 1 +2: checkFullOne + +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +2: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +2: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [ + { + "start": { + "line": 2, + "offset": 5 + }, + "end": { + "line": 2, + "offset": 11 + }, + "text": "Type 'string' is not assignable to type 'number'.", + "code": 2322, + "category": "error" + }, + { + "start": { + "line": 7, + "offset": 9 + }, + "end": { + "line": 7, + "offset": 11 + }, + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "code": 2345, + "category": "error" + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +3: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +3: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [], + "duration": * + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "requestCompleted", + "body": { + "request_seq": 2 + } + } +After running Immedidate callback:: count: 0 From eaa9b53dde5b9461faf47362ed0d8ad2d149107a Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 22 May 2024 12:52:49 -0700 Subject: [PATCH 48/74] fix overload lint error --- src/compiler/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a194cdb130698..6b2256affea8f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4715,7 +4715,7 @@ export interface Program extends ScriptReferenceHost { /** The first time this is called, it will return global diagnostics (no location). */ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; /** @internal */ - getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken, nodesToCheck?: Node[]): readonly Diagnostic[]; + getSemanticDiagnostics(sourceFile: SourceFile | undefined, cancellationToken: CancellationToken | undefined, nodesToCheck: Node[]): readonly Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; getConfigFileParsingDiagnostics(): readonly Diagnostic[]; From 3e49b6bf2760ae996a0eaf9ec2b8cb930434e6a9 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 22 May 2024 14:03:31 -0700 Subject: [PATCH 49/74] CR: add unit tests with suggestions --- .../unittests/tsserver/regionDiagnostics.ts | 91 ++++ .../region-does-not-have-suggestion.js | 415 ++++++++++++++++++ .../region-has-suggestion.js | 415 ++++++++++++++++++ 3 files changed, 921 insertions(+) create mode 100644 tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js create mode 100644 tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index 440f78953f306..9079c9f42f4fe 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -121,4 +121,95 @@ numberId(1000); baselineTsserverLogs("regionDiagnostics", "diagnostics for select nodes and whole file for multiple files", session); }); + + describe("diagnostics for select nodes when files have suggestion diagnostics", () => { + const config = { + path: "/tsconfig.json", + content: ` +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + } +} +`, + }; + const indexFile = { + path: "/index.ts", + content: ` +import add = require("./other.js"); + +add(3, "a"); + +add(1, 2); +`, + }; + const otherFile = { + path: "/other.ts", + content: ` +function add(a: number, b: number) { + return a + b +} + +export = add; +`, + }; + + it("region has suggestion diagnostics", () => { + const files = [config, indexFile, otherFile]; + const host = createServerHost(files); + const session = new TestSession(host); + + session.executeCommandSeq({ + command: ts.server.protocol.CommandTypes.UpdateOpen, + arguments: { + openFiles: [{ file: indexFile.path, fileContent: indexFile.content }], + }, + }); + + verifyGetErrRequest({ + session, + files: [ + { + file: indexFile.path, + // `import add = require("./other.js"); add(3, "a");` + ranges: [{ startLine: 2, startOffset: 1, endLine: 4, endOffset: 13 }], + }, + ], + skip: [ + { regionSemantic: false }, + ], + }); + + baselineTsserverLogs("regionDiagnostics", "region has suggestion", session); + }); + + it("region does not have suggestion diagnostics", () => { + const files = [config, indexFile, otherFile]; + const host = createServerHost(files); + const session = new TestSession(host); + + session.executeCommandSeq({ + command: ts.server.protocol.CommandTypes.UpdateOpen, + arguments: { + openFiles: [{ file: indexFile.path, fileContent: indexFile.content }], + }, + }); + + verifyGetErrRequest({ + session, + files: [ + { + file: indexFile.path, + // `add(3, "a"); add(1, 2);` + ranges: [{ startLine: 4, startOffset: 1, endLine: 6, endOffset: 11 }], + }, + ], + skip: [ + { regionSemantic: false }, + ], + }); + + baselineTsserverLogs("regionDiagnostics", "region does not have suggestion", session); + }); + }); }); diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js b/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js new file mode 100644 index 0000000000000..e9858faeb29c2 --- /dev/null +++ b/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js @@ -0,0 +1,415 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +Before request +//// [/tsconfig.json] + +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + } +} + + +//// [/index.ts] + +import add = require("./other.js"); + +add(3, "a"); + +add(1, 2); + + +//// [/other.ts] + +function add(a: number, b: number) { + return a + b +} + +export = add; + + + +Info seq [hh:mm:ss:mss] request: + { + "command": "updateOpen", + "arguments": { + "openFiles": [ + { + "file": "/index.ts", + "fileContent": "\nimport add = require(\"./other.js\");\n\nadd(3, \"a\");\n\nadd(1, 2);\n" + } + ] + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /index.ts ProjectRootPath: undefined:: Result: /tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tsconfig.json 2000 undefined Project: /tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/tsconfig.json", + "reason": "Creating possible configured project for /index.ts to open" + } + } +Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { + "rootNames": [ + "/index.ts", + "/other.ts" + ], + "options": { + "allowSyntheticDefaultImports": true, + "configFilePath": "/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /other.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /tsconfig.json WatchType: Missing file +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (2) + /other.ts Text-1 "\nfunction add(a: number, b: number) {\n return a + b\n}\n\nexport = add;\n" + /index.ts SVC-1-0 "\nimport add = require(\"./other.js\");\n\nadd(3, \"a\");\n\nadd(1, 2);\n" + + + other.ts + Imported via "./other.js" from file 'index.ts' + Matched by default include pattern '**/*' + index.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingFinish", + "body": { + "projectName": "/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "telemetry", + "body": { + "telemetryEventName": "projectInfo", + "payload": { + "projectId": "aace87d7c1572ff43c6978074161b586788b4518c7a9d06c79c03e613b6ce5a3", + "fileStats": { + "js": 0, + "jsSize": 0, + "jsx": 0, + "jsxSize": 0, + "ts": 2, + "tsSize": 135, + "tsx": 0, + "tsxSize": 0, + "dts": 0, + "dtsSize": 0, + "deferred": 0, + "deferredSize": 0 + }, + "compilerOptions": { + "allowSyntheticDefaultImports": true + }, + "typeAcquisition": { + "enable": false, + "include": false, + "exclude": false + }, + "extends": false, + "files": false, + "include": false, + "exclude": false, + "compileOnSave": false, + "configFileName": "tsconfig.json", + "projectType": "configured", + "languageServiceEnabled": true, + "version": "FakeVersion" + } + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "configFileDiag", + "body": { + "triggerFile": "/index.ts", + "configFile": "/tsconfig.json", + "diagnostics": [ + { + "text": "File '/a/lib/lib.d.ts' not found.\n The file is in the program because:\n Default library for target 'es5'", + "code": 6053, + "category": "error" + }, + { + "text": "Cannot find global type 'Array'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'Boolean'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'Function'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'IArguments'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'Number'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'Object'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'RegExp'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'String'.", + "code": 2318, + "category": "error" + } + ] + } + } +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /index.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "response": true, + "responseRequired": true + } +After request + +PolledWatches:: +/a/lib/lib.d.ts: *new* + {"pollingInterval":500} + +FsWatches:: +/other.ts: *new* + {} +/tsconfig.json: *new* + {} + +FsWatchesRecursive:: +/: *new* + {} + +Projects:: +/tsconfig.json (Configured) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/index.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /tsconfig.json *default* +/other.ts *new* + version: Text-1 + containingProjects: 1 + /tsconfig.json + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "geterr", + "arguments": { + "delay": 0, + "files": [ + { + "file": "/index.ts", + "ranges": [ + { + "startLine": 4, + "startOffset": 1, + "endLine": 6, + "endOffset": 11 + } + ] + } + ] + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Timeout callback:: count: 1 +1: checkOne *new* + +Before running Timeout callback:: count: 1 +1: checkOne + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/index.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +1: regionSemanticCheck *new* + +Before running Immedidate callback:: count: 1 +1: regionSemanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "regionSemanticDiag", + "body": { + "file": "/index.ts", + "diagnostics": [ + { + "start": { + "line": 4, + "offset": 8 + }, + "end": { + "line": 4, + "offset": 11 + }, + "text": "Argument of type 'string' is not assignable to parameter of type 'number'.", + "code": 2345, + "category": "error" + } + ], + "spans": [ + { + "start": { + "line": 2, + "offset": 36 + }, + "end": { + "line": 6, + "offset": 11 + } + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 0 + +Timeout callback:: count: 1 +2: checkFullOne *new* + +Before running Timeout callback:: count: 1 +2: checkFullOne + +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +2: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +2: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/index.ts", + "diagnostics": [ + { + "start": { + "line": 4, + "offset": 8 + }, + "end": { + "line": 4, + "offset": 11 + }, + "text": "Argument of type 'string' is not assignable to parameter of type 'number'.", + "code": 2345, + "category": "error" + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +3: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +3: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/index.ts", + "diagnostics": [ + { + "start": { + "line": 2, + "offset": 8 + }, + "end": { + "line": 2, + "offset": 11 + }, + "text": "Import may be converted to a default import.", + "code": 80003, + "category": "suggestion" + } + ], + "duration": * + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "requestCompleted", + "body": { + "request_seq": 2 + } + } +After running Immedidate callback:: count: 0 diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js b/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js new file mode 100644 index 0000000000000..babe865ab778a --- /dev/null +++ b/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js @@ -0,0 +1,415 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +Before request +//// [/tsconfig.json] + +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + } +} + + +//// [/index.ts] + +import add = require("./other.js"); + +add(3, "a"); + +add(1, 2); + + +//// [/other.ts] + +function add(a: number, b: number) { + return a + b +} + +export = add; + + + +Info seq [hh:mm:ss:mss] request: + { + "command": "updateOpen", + "arguments": { + "openFiles": [ + { + "file": "/index.ts", + "fileContent": "\nimport add = require(\"./other.js\");\n\nadd(3, \"a\");\n\nadd(1, 2);\n" + } + ] + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /index.ts ProjectRootPath: undefined:: Result: /tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tsconfig.json 2000 undefined Project: /tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/tsconfig.json", + "reason": "Creating possible configured project for /index.ts to open" + } + } +Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { + "rootNames": [ + "/index.ts", + "/other.ts" + ], + "options": { + "allowSyntheticDefaultImports": true, + "configFilePath": "/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /other.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /tsconfig.json WatchType: Missing file +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (2) + /other.ts Text-1 "\nfunction add(a: number, b: number) {\n return a + b\n}\n\nexport = add;\n" + /index.ts SVC-1-0 "\nimport add = require(\"./other.js\");\n\nadd(3, \"a\");\n\nadd(1, 2);\n" + + + other.ts + Imported via "./other.js" from file 'index.ts' + Matched by default include pattern '**/*' + index.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingFinish", + "body": { + "projectName": "/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "telemetry", + "body": { + "telemetryEventName": "projectInfo", + "payload": { + "projectId": "aace87d7c1572ff43c6978074161b586788b4518c7a9d06c79c03e613b6ce5a3", + "fileStats": { + "js": 0, + "jsSize": 0, + "jsx": 0, + "jsxSize": 0, + "ts": 2, + "tsSize": 135, + "tsx": 0, + "tsxSize": 0, + "dts": 0, + "dtsSize": 0, + "deferred": 0, + "deferredSize": 0 + }, + "compilerOptions": { + "allowSyntheticDefaultImports": true + }, + "typeAcquisition": { + "enable": false, + "include": false, + "exclude": false + }, + "extends": false, + "files": false, + "include": false, + "exclude": false, + "compileOnSave": false, + "configFileName": "tsconfig.json", + "projectType": "configured", + "languageServiceEnabled": true, + "version": "FakeVersion" + } + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "configFileDiag", + "body": { + "triggerFile": "/index.ts", + "configFile": "/tsconfig.json", + "diagnostics": [ + { + "text": "File '/a/lib/lib.d.ts' not found.\n The file is in the program because:\n Default library for target 'es5'", + "code": 6053, + "category": "error" + }, + { + "text": "Cannot find global type 'Array'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'Boolean'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'Function'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'IArguments'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'Number'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'Object'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'RegExp'.", + "code": 2318, + "category": "error" + }, + { + "text": "Cannot find global type 'String'.", + "code": 2318, + "category": "error" + } + ] + } + } +Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /index.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "response": true, + "responseRequired": true + } +After request + +PolledWatches:: +/a/lib/lib.d.ts: *new* + {"pollingInterval":500} + +FsWatches:: +/other.ts: *new* + {} +/tsconfig.json: *new* + {} + +FsWatchesRecursive:: +/: *new* + {} + +Projects:: +/tsconfig.json (Configured) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/index.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /tsconfig.json *default* +/other.ts *new* + version: Text-1 + containingProjects: 1 + /tsconfig.json + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "geterr", + "arguments": { + "delay": 0, + "files": [ + { + "file": "/index.ts", + "ranges": [ + { + "startLine": 2, + "startOffset": 1, + "endLine": 4, + "endOffset": 13 + } + ] + } + ] + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Timeout callback:: count: 1 +1: checkOne *new* + +Before running Timeout callback:: count: 1 +1: checkOne + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/index.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +1: regionSemanticCheck *new* + +Before running Immedidate callback:: count: 1 +1: regionSemanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "regionSemanticDiag", + "body": { + "file": "/index.ts", + "diagnostics": [ + { + "start": { + "line": 4, + "offset": 8 + }, + "end": { + "line": 4, + "offset": 11 + }, + "text": "Argument of type 'string' is not assignable to parameter of type 'number'.", + "code": 2345, + "category": "error" + } + ], + "spans": [ + { + "start": { + "line": 1, + "offset": 1 + }, + "end": { + "line": 4, + "offset": 13 + } + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 0 + +Timeout callback:: count: 1 +2: checkFullOne *new* + +Before running Timeout callback:: count: 1 +2: checkFullOne + +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +2: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +2: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/index.ts", + "diagnostics": [ + { + "start": { + "line": 4, + "offset": 8 + }, + "end": { + "line": 4, + "offset": 11 + }, + "text": "Argument of type 'string' is not assignable to parameter of type 'number'.", + "code": 2345, + "category": "error" + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +3: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +3: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/index.ts", + "diagnostics": [ + { + "start": { + "line": 2, + "offset": 8 + }, + "end": { + "line": 2, + "offset": 11 + }, + "text": "Import may be converted to a default import.", + "code": 80003, + "category": "suggestion" + } + ], + "duration": * + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "requestCompleted", + "body": { + "request_seq": 2 + } + } +After running Immedidate callback:: count: 0 From 0ef9bb80229c721ecbfedecffff6f17bcc0a7aa0 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 22 May 2024 16:10:36 -0700 Subject: [PATCH 50/74] change order of checking for files with specified regions --- src/server/session.ts | 42 +--- src/testRunner/unittests/helpers/tsserver.ts | 13 +- ...nodes-and-whole-file-for-multiple-files.js | 226 ++++++++---------- ...stics-for-select-nodes-in-a-single-file.js | 10 +- .../region-does-not-have-suggestion.js | 10 +- .../region-has-suggestion.js | 10 +- 6 files changed, 121 insertions(+), 190 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 5cdec448bef04..7b86d4ed1609e 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1351,38 +1351,27 @@ export class Session implements EventSender { const seq = this.changeSeq; const followMs = Math.min(ms, 200); - const filesFullCheck: (PendingErrorCheck & { project: Project; })[] = []; let index = 0; - const goNextAllCheck = () => { + const goNext = () => { index++; if (checkList.length > index) { return next.delay("checkOne", followMs, checkOne); } - if (filesFullCheck.length) { - index = 0; - return next.delay("checkFullOne", followMs, checkFull); - } - }; - const goNextSemanticCheck = () => { - index++; - if (filesFullCheck.length > index) { - return next.delay("checkFullOne", followMs, checkFull); - } }; - const doSemanticCheck = (fileName: NormalizedPath, project: Project, goToNext: () => void) => { + const doSemanticCheck = (fileName: NormalizedPath, project: Project) => { this.semanticCheck(fileName, project); if (this.changeSeq !== seq) { return; } if (this.getPreferences(fileName).disableSuggestions) { - goToNext(); + goNext(); return; } next.immediate("suggestionCheck", () => { this.suggestionCheck(fileName, project); - goToNext(); + goNext(); }); }; @@ -1409,7 +1398,7 @@ export class Session implements EventSender { // Don't provide semantic diagnostics unless we're in full semantic mode. if (project.projectService.serverMode !== LanguageServiceMode.Semantic) { - goNextAllCheck(); + goNext(); return; } @@ -1417,25 +1406,18 @@ export class Session implements EventSender { return next.immediate("regionSemanticCheck", () => { const didRegionCheck = this.regionSemanticCheck(fileName, project, ranges); if (didRegionCheck) { - filesFullCheck.push({ fileName, project }); - goNextAllCheck(); + if (this.changeSeq !== seq) { + return; + } + next.immediate("semanticCheck", () => doSemanticCheck(fileName, project)); } - else { // If we opted out of region check, do semantic check as normal - doSemanticCheck(fileName, project, goNextAllCheck); + else { + doSemanticCheck(fileName, project); } }); } - next.immediate("semanticCheck", () => doSemanticCheck(fileName, project, goNextAllCheck)); - }; - - const checkFull = () => { - if (this.changeSeq !== seq) { - return; - } - - const { fileName, project } = filesFullCheck[index]; - next.immediate("semanticCheck", () => doSemanticCheck(fileName, project, goNextSemanticCheck)); + next.immediate("semanticCheck", () => doSemanticCheck(fileName, project)); }; if (checkList.length > index && this.changeSeq === seq) { diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index 19267032b0047..e770a0f115f21 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -413,25 +413,14 @@ function checkAllErrors({ session, existingTimeouts, files, skip }: CheckAllErro // Run syntax check for next file session.host.runQueuedTimeoutCallbacks(existingTimeouts ? session.host.getNextTimeoutId() - 1 : undefined); if (fileSkip?.regionSemantic === false) { - // Run only region semantic check at first + // Run region check session.host.runQueuedImmediateCallbacks(); - continue; } // Run semantic check if (!fileSkip?.semantic) session.host.runQueuedImmediateCallbacks(); // Run suggestion check if (!fileSkip?.suggestion) session.host.runQueuedImmediateCallbacks(); } - for (const fileSkip of fileSkips) { - if (fileSkip?.regionSemantic === false) { - session.host.runQueuedTimeoutCallbacks(); - // Run semantic check - if (!fileSkip?.semantic) session.host.runQueuedImmediateCallbacks(); - // Run suggestion check - if (!fileSkip?.suggestion) session.host.runQueuedImmediateCallbacks(); - } - else break; - } } function filePath(file: string | File) { diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js index 16fbe1f39db70..2c728210f746c 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js @@ -292,6 +292,71 @@ Info seq [hh:mm:ss:mss] event: "duration": * } } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +2: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +2: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [ + { + "start": { + "line": 3, + "offset": 5 + }, + "end": { + "line": 3, + "offset": 11 + }, + "text": "Type 'string' is not assignable to type 'number'.", + "code": 2322, + "category": "error" + }, + { + "start": { + "line": 6, + "offset": 9 + }, + "end": { + "line": 6, + "offset": 11 + }, + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "code": 2345, + "category": "error" + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +3: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +3: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [], + "duration": * + } + } After running Immedidate callback:: count: 0 Timeout callback:: count: 1 @@ -314,10 +379,10 @@ Info seq [hh:mm:ss:mss] event: After running Timeout callback:: count: 0 Immedidate callback:: count: 1 -2: regionSemanticCheck *new* +4: regionSemanticCheck *new* Before running Immedidate callback:: count: 1 -2: regionSemanticCheck +4: regionSemanticCheck Info seq [hh:mm:ss:mss] event: { @@ -342,32 +407,13 @@ Info seq [hh:mm:ss:mss] event: "duration": * } } -After running Immedidate callback:: count: 0 - -Timeout callback:: count: 1 -3: checkOne *new* - -Before running Timeout callback:: count: 1 -3: checkOne - -Info seq [hh:mm:ss:mss] event: - { - "seq": 0, - "type": "event", - "event": "syntaxDiag", - "body": { - "file": "/a/b/app2.ts", - "diagnostics": [], - "duration": * - } - } -After running Timeout callback:: count: 0 +After running Immedidate callback:: count: 1 Immedidate callback:: count: 1 -3: semanticCheck *new* +5: semanticCheck *new* Before running Immedidate callback:: count: 1 -3: semanticCheck +5: semanticCheck Info seq [hh:mm:ss:mss] event: { @@ -375,18 +421,18 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "semanticDiag", "body": { - "file": "/a/b/app2.ts", + "file": "/a/b/app3.ts", "diagnostics": [ { "start": { - "line": 7, - "offset": 13 + "line": 8, + "offset": 10 }, "end": { - "line": 7, - "offset": 28 + "line": 8, + "offset": 14 }, - "text": "Argument of type 'string' is not assignable to parameter of type 'boolean'.", + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", "code": 2345, "category": "error" } @@ -397,10 +443,10 @@ Info seq [hh:mm:ss:mss] event: After running Immedidate callback:: count: 1 Immedidate callback:: count: 1 -4: suggestionCheck *new* +6: suggestionCheck *new* Before running Immedidate callback:: count: 1 -4: suggestionCheck +6: suggestionCheck Info seq [hh:mm:ss:mss] event: { @@ -408,7 +454,7 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "suggestionDiag", "body": { - "file": "/a/b/app2.ts", + "file": "/a/b/app3.ts", "diagnostics": [], "duration": * } @@ -416,10 +462,10 @@ Info seq [hh:mm:ss:mss] event: After running Immedidate callback:: count: 0 Timeout callback:: count: 1 -4: checkOne *new* +3: checkOne *new* Before running Timeout callback:: count: 1 -4: checkOne +3: checkOne Info seq [hh:mm:ss:mss] event: { @@ -427,57 +473,11 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "syntaxDiag", "body": { - "file": "/a/b/app4.ts", - "diagnostics": [], - "duration": * - } - } -After running Timeout callback:: count: 0 - -Immedidate callback:: count: 1 -5: semanticCheck *new* - -Before running Immedidate callback:: count: 1 -5: semanticCheck - -Info seq [hh:mm:ss:mss] event: - { - "seq": 0, - "type": "event", - "event": "semanticDiag", - "body": { - "file": "/a/b/app4.ts", - "diagnostics": [], - "duration": * - } - } -After running Immedidate callback:: count: 1 - -Immedidate callback:: count: 1 -6: suggestionCheck *new* - -Before running Immedidate callback:: count: 1 -6: suggestionCheck - -Info seq [hh:mm:ss:mss] event: - { - "seq": 0, - "type": "event", - "event": "suggestionDiag", - "body": { - "file": "/a/b/app4.ts", + "file": "/a/b/app2.ts", "diagnostics": [], "duration": * } } -After running Immedidate callback:: count: 0 - -Timeout callback:: count: 1 -5: checkFullOne *new* - -Before running Timeout callback:: count: 1 -5: checkFullOne - After running Timeout callback:: count: 0 Immedidate callback:: count: 1 @@ -492,31 +492,18 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "semanticDiag", "body": { - "file": "/a/b/app.ts", + "file": "/a/b/app2.ts", "diagnostics": [ { "start": { - "line": 3, - "offset": 5 - }, - "end": { - "line": 3, - "offset": 11 - }, - "text": "Type 'string' is not assignable to type 'number'.", - "code": 2322, - "category": "error" - }, - { - "start": { - "line": 6, - "offset": 9 + "line": 7, + "offset": 13 }, "end": { - "line": 6, - "offset": 11 + "line": 7, + "offset": 28 }, - "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "text": "Argument of type 'string' is not assignable to parameter of type 'boolean'.", "code": 2345, "category": "error" } @@ -538,7 +525,7 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "suggestionDiag", "body": { - "file": "/a/b/app.ts", + "file": "/a/b/app2.ts", "diagnostics": [], "duration": * } @@ -546,11 +533,22 @@ Info seq [hh:mm:ss:mss] event: After running Immedidate callback:: count: 0 Timeout callback:: count: 1 -6: checkFullOne *new* +4: checkOne *new* Before running Timeout callback:: count: 1 -6: checkFullOne +4: checkOne +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/a/b/app4.ts", + "diagnostics": [], + "duration": * + } + } After running Timeout callback:: count: 0 Immedidate callback:: count: 1 @@ -565,22 +563,8 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "semanticDiag", "body": { - "file": "/a/b/app3.ts", - "diagnostics": [ - { - "start": { - "line": 8, - "offset": 10 - }, - "end": { - "line": 8, - "offset": 14 - }, - "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", - "code": 2345, - "category": "error" - } - ], + "file": "/a/b/app4.ts", + "diagnostics": [], "duration": * } } @@ -598,7 +582,7 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "suggestionDiag", "body": { - "file": "/a/b/app3.ts", + "file": "/a/b/app4.ts", "diagnostics": [], "duration": * } diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js index fea26b08422db..464726a6aa218 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js @@ -153,15 +153,7 @@ Info seq [hh:mm:ss:mss] event: "duration": * } } -After running Immedidate callback:: count: 0 - -Timeout callback:: count: 1 -2: checkFullOne *new* - -Before running Timeout callback:: count: 1 -2: checkFullOne - -After running Timeout callback:: count: 0 +After running Immedidate callback:: count: 1 Immedidate callback:: count: 1 2: semanticCheck *new* diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js b/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js index e9858faeb29c2..88420b6b729d8 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js @@ -329,15 +329,7 @@ Info seq [hh:mm:ss:mss] event: "duration": * } } -After running Immedidate callback:: count: 0 - -Timeout callback:: count: 1 -2: checkFullOne *new* - -Before running Timeout callback:: count: 1 -2: checkFullOne - -After running Timeout callback:: count: 0 +After running Immedidate callback:: count: 1 Immedidate callback:: count: 1 2: semanticCheck *new* diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js b/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js index babe865ab778a..5b56379e2aa2f 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js @@ -329,15 +329,7 @@ Info seq [hh:mm:ss:mss] event: "duration": * } } -After running Immedidate callback:: count: 0 - -Timeout callback:: count: 1 -2: checkFullOne *new* - -Before running Timeout callback:: count: 1 -2: checkFullOne - -After running Timeout callback:: count: 0 +After running Immedidate callback:: count: 1 Immedidate callback:: count: 1 2: semanticCheck *new* From 8e160cf98b9752cd846c37b4ecd1c82eed39412f Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 22 May 2024 16:11:02 -0700 Subject: [PATCH 51/74] fix log sanitizing regex --- src/harness/tsserverLogger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/harness/tsserverLogger.ts b/src/harness/tsserverLogger.ts index b1d4765834ade..cdf84913a324e 100644 --- a/src/harness/tsserverLogger.ts +++ b/src/harness/tsserverLogger.ts @@ -127,7 +127,7 @@ export function sanitizeLog(s: string): string { s = s.replace(/"exportMapKey":\s*"\d+ \d+ /g, match => match.replace(/ \d+ /, ` * `)); s = s.replace(/getIndentationAtPosition: getCurrentSourceFile: \d+(?:\.\d+)?/, `getIndentationAtPosition: getCurrentSourceFile: *`); s = s.replace(/getIndentationAtPosition: computeIndentation\s*: \d+(?:\.\d+)?/, `getIndentationAtPosition: computeIndentation: *`); - s = s.replace(/"duration":\s*\d+.\d+/g, `"duration": *`); + s = s.replace(/"duration":\s*\d+(?:.\d+)?/g, `"duration": *`); s = replaceAll(s, `@ts${ts.versionMajorMinor}`, `@tsFakeMajor.Minor`); s = sanitizeHarnessLSException(s); return s; From ece3c41ad8d1d35bf8b0b644a7c1c8663a112018 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 22 May 2024 17:12:46 -0700 Subject: [PATCH 52/74] update unit tests logs with duration --- ...m-multiple-places-with-different-casing.js | 27 ++++++++++++------- .../tsserver/pasteEdits/adds-paste-edits.js | 9 ++++--- ...config-tree-found-finds-default-project.js | 9 ++++--- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-is-included-from-multiple-places-with-different-casing.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-is-included-from-multiple-places-with-different-casing.js index 3d07c2303ec9c..28ac4c031e455 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-is-included-from-multiple-places-with-different-casing.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-file-is-included-from-multiple-places-with-different-casing.js @@ -302,7 +302,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/src/struct.d.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -511,7 +512,8 @@ Info seq [hh:mm:ss:mss] event: } ] } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -586,7 +588,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -845,7 +848,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/src/struct.d.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1062,7 +1066,8 @@ Info seq [hh:mm:ss:mss] event: } ] } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1137,7 +1142,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: @@ -1374,7 +1380,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/src/struct.d.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -1480,7 +1487,8 @@ Info seq [hh:mm:ss:mss] event: } ] } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -1527,7 +1535,8 @@ Info seq [hh:mm:ss:mss] event: "category": "suggestion", "reportsUnnecessary": true } - ] + ], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/pasteEdits/adds-paste-edits.js b/tests/baselines/reference/tsserver/pasteEdits/adds-paste-edits.js index 5f0a2b2a5a1be..639358aa7fbf5 100644 --- a/tests/baselines/reference/tsserver/pasteEdits/adds-paste-edits.js +++ b/tests/baselines/reference/tsserver/pasteEdits/adds-paste-edits.js @@ -287,7 +287,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/project/a/target.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -311,7 +312,8 @@ Info seq [hh:mm:ss:mss] event: "event": "semanticDiag", "body": { "file": "/project/a/target.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Immedidate callback:: count: 1 @@ -329,7 +331,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/project/a/target.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: diff --git a/tests/baselines/reference/tsserver/projectReferences/when-file-is-not-part-of-first-config-tree-found-finds-default-project.js b/tests/baselines/reference/tsserver/projectReferences/when-file-is-not-part-of-first-config-tree-found-finds-default-project.js index 08940ee55aac5..dfc6b48a885ab 100644 --- a/tests/baselines/reference/tsserver/projectReferences/when-file-is-not-part-of-first-config-tree-found-finds-default-project.js +++ b/tests/baselines/reference/tsserver/projectReferences/when-file-is-not-part-of-first-config-tree-found-finds-default-project.js @@ -350,7 +350,8 @@ Info seq [hh:mm:ss:mss] event: "event": "syntaxDiag", "body": { "file": "/home/src/projects/project/app/Component-demos.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } After running Timeout callback:: count: 0 @@ -382,7 +383,8 @@ Info seq [hh:mm:ss:mss] event: "code": 2307, "category": "error" } - ] + ], + "duration": * } } After running Immedidate callback:: count: 1 @@ -400,7 +402,8 @@ Info seq [hh:mm:ss:mss] event: "event": "suggestionDiag", "body": { "file": "/home/src/projects/project/app/Component-demos.ts", - "diagnostics": [] + "diagnostics": [], + "duration": * } } Info seq [hh:mm:ss:mss] event: From 0251194f25da1bef4a42c0800fe6ea9d4dd7d435 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 23 May 2024 10:42:30 -0700 Subject: [PATCH 53/74] remove unused baseline --- .../diagnostics-for-select-nodes.js | 238 ------------------ 1 file changed, 238 deletions(-) delete mode 100644 tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js deleted file mode 100644 index fea26b08422db..0000000000000 --- a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes.js +++ /dev/null @@ -1,238 +0,0 @@ -currentDirectory:: / useCaseSensitiveFileNames: false -Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist -Before request -//// [/a/b/app.ts] -function foo(x: number, y: string): number { - return x + y; -} - - - -foo(10, 50); - - -Info seq [hh:mm:ss:mss] request: - { - "command": "open", - "arguments": { - "file": "/a/b/app.ts" - }, - "seq": 1, - "type": "request" - } -Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app.ts ProjectRootPath: undefined:: Result: undefined -Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject1* WatchType: Missing file -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 (1) - /a/b/app.ts SVC-1-0 "function foo(x: number, y: string): number {\n return x + y;\n}\n\n\n\nfoo(10, 50);" - - - app.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 (1) - -Info seq [hh:mm:ss:mss] ----------------------------------------------- -Info seq [hh:mm:ss:mss] Open files: -Info seq [hh:mm:ss:mss] FileName: /a/b/app.ts ProjectRootPath: undefined -Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* -Info seq [hh:mm:ss:mss] response: - { - "responseRequired": false - } -After request - -PolledWatches:: -/a/lib/lib.d.ts: *new* - {"pollingInterval":500} - -Projects:: -/dev/null/inferredProject1* (Inferred) *new* - projectStateVersion: 1 - projectProgramVersion: 1 - -ScriptInfos:: -/a/b/app.ts (Open) *new* - version: SVC-1-0 - containingProjects: 1 - /dev/null/inferredProject1* *default* - -Before request - -Info seq [hh:mm:ss:mss] request: - { - "command": "geterr", - "arguments": { - "delay": 0, - "files": [ - { - "file": "/a/b/app.ts", - "ranges": [ - { - "startLine": 6, - "startOffset": 1, - "endLine": 7, - "endOffset": 13 - } - ] - } - ] - }, - "seq": 2, - "type": "request" - } -Info seq [hh:mm:ss:mss] response: - { - "responseRequired": false - } -After request - -Timeout callback:: count: 1 -1: checkOne *new* - -Before running Timeout callback:: count: 1 -1: checkOne - -Info seq [hh:mm:ss:mss] event: - { - "seq": 0, - "type": "event", - "event": "syntaxDiag", - "body": { - "file": "/a/b/app.ts", - "diagnostics": [], - "duration": * - } - } -After running Timeout callback:: count: 0 - -Immedidate callback:: count: 1 -1: regionSemanticCheck *new* - -Before running Immedidate callback:: count: 1 -1: regionSemanticCheck - -Info seq [hh:mm:ss:mss] event: - { - "seq": 0, - "type": "event", - "event": "regionSemanticDiag", - "body": { - "file": "/a/b/app.ts", - "diagnostics": [ - { - "start": { - "line": 7, - "offset": 9 - }, - "end": { - "line": 7, - "offset": 11 - }, - "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", - "code": 2345, - "category": "error" - } - ], - "spans": [ - { - "start": { - "line": 3, - "offset": 2 - }, - "end": { - "line": 7, - "offset": 13 - } - } - ], - "duration": * - } - } -After running Immedidate callback:: count: 0 - -Timeout callback:: count: 1 -2: checkFullOne *new* - -Before running Timeout callback:: count: 1 -2: checkFullOne - -After running Timeout callback:: count: 0 - -Immedidate callback:: count: 1 -2: semanticCheck *new* - -Before running Immedidate callback:: count: 1 -2: semanticCheck - -Info seq [hh:mm:ss:mss] event: - { - "seq": 0, - "type": "event", - "event": "semanticDiag", - "body": { - "file": "/a/b/app.ts", - "diagnostics": [ - { - "start": { - "line": 2, - "offset": 5 - }, - "end": { - "line": 2, - "offset": 11 - }, - "text": "Type 'string' is not assignable to type 'number'.", - "code": 2322, - "category": "error" - }, - { - "start": { - "line": 7, - "offset": 9 - }, - "end": { - "line": 7, - "offset": 11 - }, - "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", - "code": 2345, - "category": "error" - } - ], - "duration": * - } - } -After running Immedidate callback:: count: 1 - -Immedidate callback:: count: 1 -3: suggestionCheck *new* - -Before running Immedidate callback:: count: 1 -3: suggestionCheck - -Info seq [hh:mm:ss:mss] event: - { - "seq": 0, - "type": "event", - "event": "suggestionDiag", - "body": { - "file": "/a/b/app.ts", - "diagnostics": [], - "duration": * - } - } -Info seq [hh:mm:ss:mss] event: - { - "seq": 0, - "type": "event", - "event": "requestCompleted", - "body": { - "request_seq": 2 - } - } -After running Immedidate callback:: count: 0 From 7076d14355a9bbeb083c4dcedf52acbe0904a555 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 23 May 2024 21:19:15 +0000 Subject: [PATCH 54/74] optimization: don't do region node selection if we will skip checking the file --- src/compiler/program.ts | 22 ++++++++++++---------- src/compiler/utilities.ts | 15 +++++++++++++++ src/server/session.ts | 2 +- src/services/services.ts | 17 ++++++++++++++--- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index d48122e25e578..821c1fe55af06 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -291,6 +291,7 @@ import { ScriptTarget, setParent, setParentRecursive, + shouldIncludeBindAndCheckDiagnostics, skipTrivia, skipTypeChecking, some, @@ -3033,16 +3034,10 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg Debug.assert(!!sourceFile.bindDiagnostics); const isJs = sourceFile.scriptKind === ScriptKind.JS || sourceFile.scriptKind === ScriptKind.JSX; - const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options); const isPlainJs = isPlainJsFile(sourceFile, options.checkJs); - const isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false; - - // By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External - // - plain JS: .js files with no // ts-check and checkJs: undefined - // - check JS: .js files with either // ts-check or checkJs: true - // - external: files that are added by plugins - const includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === ScriptKind.TS || sourceFile.scriptKind === ScriptKind.TSX - || sourceFile.scriptKind === ScriptKind.External || isPlainJs || isCheckJs || sourceFile.scriptKind === ScriptKind.Deferred); + const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options); + + const includeBindAndCheckDiagnostics = shouldIncludeBindAndCheckDiagnostics(sourceFile, options); let bindDiagnostics: readonly Diagnostic[] = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; let checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken, nodesToCheck) : emptyArray; if (isPlainJs) { @@ -3050,7 +3045,14 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg checkDiagnostics = filter(checkDiagnostics, d => plainJSErrors.has(d.code)); } // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS - return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, !!nodesToCheck, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined); + return getMergedBindAndCheckDiagnostics( + sourceFile, + includeBindAndCheckDiagnostics && !isPlainJs, + !!nodesToCheck, + bindDiagnostics, + checkDiagnostics, + isCheckJs ? sourceFile.jsDocDiagnostics : undefined, + ); }); } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a394978f941c9..ef646c782364a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -10085,6 +10085,21 @@ export function skipTypeChecking(sourceFile: SourceFile, options: CompilerOption host.isSourceOfProjectReferenceRedirect(sourceFile.fileName); } +/** @internal */ +export function shouldIncludeBindAndCheckDiagnostics(sourceFile: SourceFile, options: CompilerOptions): boolean { + const isJs = sourceFile.scriptKind === ScriptKind.JS || sourceFile.scriptKind === ScriptKind.JSX; + const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options); + const isPlainJs = isPlainJsFile(sourceFile, options.checkJs); + const isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false; + + // By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External + // - plain JS: .js files with no // ts-check and checkJs: undefined + // - check JS: .js files with either // ts-check or checkJs: true + // - external: files that are added by plugins + return !isTsNoCheck && (sourceFile.scriptKind === ScriptKind.TS || sourceFile.scriptKind === ScriptKind.TSX + || sourceFile.scriptKind === ScriptKind.External || isPlainJs || isCheckJs || sourceFile.scriptKind === ScriptKind.Deferred); +} + /** @internal */ export function isJsonEqual(a: unknown, b: unknown): boolean { // eslint-disable-next-line no-restricted-syntax diff --git a/src/server/session.ts b/src/server/session.ts index f4c6a8379e0d4..e848c473c19ec 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1319,7 +1319,7 @@ export class Session implements EventSender { const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); const duration = hrTimeToMilliseconds(this.hrtime(this.diagnosticsTime)); if (kind === "semanticDiag") { - this.semanticCheckPerformance?.set(file, duration); + this.semanticCheckPerformance.set(file, duration); } const body: protocol.DiagnosticEventBody = { diff --git a/src/services/services.ts b/src/services/services.ts index ad8918a536559..b364734ab25ac 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -283,6 +283,7 @@ import { SemanticClassificationFormat, setNodeChildren, setObjectAllocator, + shouldIncludeBindAndCheckDiagnostics, Signature, SignatureDeclaration, SignatureFlags, @@ -291,6 +292,7 @@ import { SignatureHelpItemsOptions, SignatureKind, singleElementArray, + skipTypeChecking, SmartSelectionRange, some, SortedArray, @@ -2059,14 +2061,23 @@ export function createLanguageService( function getRegionSemanticDiagnostics(fileName: string, ranges: TextRange[]): RegionDiagnosticsResult | undefined { synchronizeHostData(); - const targetSourceFile = getValidSourceFile(fileName); + const sourceFile = getValidSourceFile(fileName); + + const options = program.getCompilerOptions(); + // This is an optimization to avoid computing the nodes in the range if we will not type check this file. + if ( + skipTypeChecking(sourceFile, options, program) || + !shouldIncludeBindAndCheckDiagnostics(sourceFile, options) + ) { + return undefined; + } - const nodes = getNodesForRanges(targetSourceFile, ranges); + const nodes = getNodesForRanges(sourceFile, ranges); if (!nodes) { return undefined; } const checkedSpans = normalizeSpans(nodes.map(node => createTextSpanFromBounds(node.getFullStart(), node.getEnd()))); - const semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile, cancellationToken, nodes); + const semanticDiagnostics = program.getSemanticDiagnostics(sourceFile, cancellationToken, nodes); return { diagnostics: semanticDiagnostics.slice(), spans: checkedSpans, From 48f87a870e0aa6fec3f94d31d1477c6414cee570 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 23 May 2024 21:30:15 +0000 Subject: [PATCH 55/74] don't record semantic diagnostic time if could have done region check --- src/server/session.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/session.ts b/src/server/session.ts index e848c473c19ec..7e6612f44e850 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1318,7 +1318,7 @@ export class Session implements EventSender { try { const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); const duration = hrTimeToMilliseconds(this.hrtime(this.diagnosticsTime)); - if (kind === "semanticDiag") { + if (kind === "semanticDiag" && !this.shouldDoRegionCheck(file)) { this.semanticCheckPerformance.set(file, duration); } From 81dc3706c3e926e9f877ed9f7f4ba1bfcab8e98b Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 23 May 2024 22:50:18 +0000 Subject: [PATCH 56/74] improve optimization --- src/services/services.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index b364734ab25ac..40178176ac7d6 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2064,10 +2064,12 @@ export function createLanguageService( const sourceFile = getValidSourceFile(fileName); const options = program.getCompilerOptions(); - // This is an optimization to avoid computing the nodes in the range if we will not type check this file. + // This is an optimization to avoid computing the nodes in the range if either + // we will skip semantic diagnostics for this file or if we already semantic diagnostics for it. if ( skipTypeChecking(sourceFile, options, program) || - !shouldIncludeBindAndCheckDiagnostics(sourceFile, options) + !shouldIncludeBindAndCheckDiagnostics(sourceFile, options) || + program.getCachedSemanticDiagnostics(sourceFile) ) { return undefined; } From 5e6ce98787c2bf629b1165ba21f83d7639ae5f9b Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 24 May 2024 18:10:12 +0000 Subject: [PATCH 57/74] add line count and use it for deciding on region check --- src/server/scriptInfo.ts | 4 ++++ src/server/session.ts | 8 ++++++-- tests/baselines/reference/api/typescript.d.ts | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index eaeec70784193..f713901e2acba 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -734,6 +734,10 @@ export class ScriptInfo { this.sourceMapFilePath = undefined; } } + + getLineCount(): number { + return this.textStorage.getLineInfo().getLineCount(); + } } function failIfInvalidPosition(position: number) { diff --git a/src/server/session.ts b/src/server/session.ts index 7e6612f44e850..2c1c9c0c26111 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -994,7 +994,10 @@ export class Session implements EventSender { private eventHandler: ProjectServiceEventHandler | undefined; private readonly noGetErrOnBackgroundUpdate?: boolean; - // Maps a file name to duration in milliseconds of semantic checking + /** + * Maps a file path to duration in milliseconds of full semantic checking. + * Used for deciding whether to do a region semantic check. + */ private semanticCheckPerformance: Map; private diagnosticsTime: [number, number] | undefined; @@ -1303,8 +1306,9 @@ export class Session implements EventSender { // We should only do the region-based semantic check if we think it would be considerably faster than a whole-file semantic check /** @internal */ protected shouldDoRegionCheck(file: NormalizedPath): boolean { + const lineCount = this.projectService.getScriptInfoForNormalizedPath(file)?.getLineCount(); const perf = this.semanticCheckPerformance.get(file); - return !!perf && perf > 1000; + return !!(lineCount && lineCount > 500 && (!perf || perf > 200)); } /** @internal */ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index a6e1e1640310a..0020bb76078b3 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2720,6 +2720,7 @@ declare namespace ts { lineOffsetToPosition(line: number, offset: number): number; positionToLineOffset(position: number): protocol.Location; isJavaScript(): boolean; + getLineCount(): number; } interface InstallPackageOptionsWithProject extends InstallPackageOptions { projectName: string; @@ -3428,6 +3429,10 @@ declare namespace ts { private suppressDiagnosticEvents?; private eventHandler; private readonly noGetErrOnBackgroundUpdate?; + /** + * Maps a file path to duration in milliseconds of full semantic checking. + * Used for deciding whether to do a region semantic check. + */ private semanticCheckPerformance; private diagnosticsTime; constructor(opts: SessionOptions); From 3254be9912f3c17548f862f30756166ee01e23ba Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 30 May 2024 14:35:49 -0700 Subject: [PATCH 58/74] TEMPORARY FOR TESTING VSCODE --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b8a62afdcb987..773dc0bba01fc 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "5.5.0", + "version": "5.6.0", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ From ef6e4d534ae3c3977a8c291d1ef53a3e4c8a0b19 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 30 May 2024 16:36:34 -0700 Subject: [PATCH 59/74] get rid of performance checking in heuristic for now --- src/server/session.ts | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 2c1c9c0c26111..4d145ae214434 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -994,12 +994,6 @@ export class Session implements EventSender { private eventHandler: ProjectServiceEventHandler | undefined; private readonly noGetErrOnBackgroundUpdate?: boolean; - /** - * Maps a file path to duration in milliseconds of full semantic checking. - * Used for deciding whether to do a region semantic check. - */ - private semanticCheckPerformance: Map; - private diagnosticsTime: [number, number] | undefined; constructor(opts: SessionOptions) { @@ -1012,7 +1006,6 @@ export class Session implements EventSender { this.canUseEvents = opts.canUseEvents; this.suppressDiagnosticEvents = opts.suppressDiagnosticEvents; this.noGetErrOnBackgroundUpdate = opts.noGetErrOnBackgroundUpdate; - this.semanticCheckPerformance = new Map(); const { throttleWaitMilliseconds } = opts; @@ -1307,24 +1300,13 @@ export class Session implements EventSender { /** @internal */ protected shouldDoRegionCheck(file: NormalizedPath): boolean { const lineCount = this.projectService.getScriptInfoForNormalizedPath(file)?.getLineCount(); - const perf = this.semanticCheckPerformance.get(file); - return !!(lineCount && lineCount > 500 && (!perf || perf > 200)); - } - - /** @internal */ - private cleanUpSemanticCheckPerformance(closedFiles: string[] | undefined): void { - if (closedFiles) { - closedFiles.forEach(file => this.semanticCheckPerformance.delete(toNormalizedPath(file))); - } + return !!(lineCount && lineCount > 500); } private sendDiagnosticsEvent(file: NormalizedPath, project: Project, diagnostics: readonly Diagnostic[], kind: protocol.DiagnosticEventKind, spans?: TextSpan[]): void { try { const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); const duration = hrTimeToMilliseconds(this.hrtime(this.diagnosticsTime)); - if (kind === "semanticDiag" && !this.shouldDoRegionCheck(file)) { - this.semanticCheckPerformance.set(file, duration); - } const body: protocol.DiagnosticEventBody = { file, @@ -3348,7 +3330,6 @@ export class Session implements EventSender { })), request.arguments.closedFiles, ); - this.cleanUpSemanticCheckPerformance(request.arguments.closedFiles); return this.requiredResponse(/*response*/ true); }, [protocol.CommandTypes.ApplyChangedToOpenFiles]: (request: protocol.ApplyChangedToOpenFilesRequest) => { @@ -3362,7 +3343,6 @@ export class Session implements EventSender { })), request.arguments.closedFiles, ); - this.cleanUpSemanticCheckPerformance(request.arguments.closedFiles); // TODO: report errors return this.requiredResponse(/*response*/ true); }, From c07b226fde90697327a99baee2d71d94761c09e2 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 30 May 2024 20:16:24 +0000 Subject: [PATCH 60/74] CR: mark internal --- src/compiler/utilitiesPublic.ts | 3 +++ src/services/types.ts | 1 + tests/baselines/reference/api/typescript.d.ts | 7 ------- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 25cf0b68a7fa9..600ac689a1472 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -357,10 +357,12 @@ export function textSpanContainsTextSpan(span: TextSpan, other: TextSpan) { return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); } +/** @internal */ export function textSpanContainsTextRange(span: TextSpan, range: TextRange) { return range.pos >= span.start && range.end <= textSpanEnd(span); } +/** @internal */ export function textRangeContainsTextSpan(range: TextRange, span: TextSpan) { return span.start >= range.pos && textSpanEnd(span) <= range.end; } @@ -392,6 +394,7 @@ export function textSpanIntersectsWithPosition(span: TextSpan, position: number) return position <= textSpanEnd(span) && position >= span.start; } +/** @internal */ export function textRangeIntersectsWithTextSpan(range: TextRange, span: TextSpan): boolean { return textSpanIntersectsWith(span, range.pos, range.end - range.pos); } diff --git a/src/services/types.ts b/src/services/types.ts index c0d78e1116e99..e9675adac99db 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -445,6 +445,7 @@ export const enum SemanticClassificationFormat { TwentyTwenty = "2020", } +/** @internal */ export interface RegionDiagnosticsResult { diagnostics: Diagnostic[]; spans: TextSpan[]; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 0020bb76078b3..702bf398477d6 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -8451,15 +8451,12 @@ declare namespace ts { function textSpanIsEmpty(span: TextSpan): boolean; function textSpanContainsPosition(span: TextSpan, position: number): boolean; function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean; - function textSpanContainsTextRange(span: TextSpan, range: TextRange): boolean; - function textRangeContainsTextSpan(range: TextRange, span: TextSpan): boolean; function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean; function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan | undefined; function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean; function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean; function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean; function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean; - function textRangeIntersectsWithTextSpan(range: TextRange, span: TextSpan): boolean; function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan | undefined; function createTextSpan(start: number, length: number): TextSpan; function createTextSpanFromBounds(start: number, end: number): TextSpan; @@ -9980,10 +9977,6 @@ declare namespace ts { Original = "original", TwentyTwenty = "2020", } - interface RegionDiagnosticsResult { - diagnostics: Diagnostic[]; - spans: TextSpan[]; - } interface LanguageService { /** This is used as a part of restarting the language service. */ cleanupSemanticCache(): void; From 1f262cd939db60f25c3012bf379d7e58263a7a14 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 30 May 2024 20:22:19 +0000 Subject: [PATCH 61/74] CR: refactor session.ts --- src/server/scriptInfo.ts | 4 ---- src/server/session.ts | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index f713901e2acba..eaeec70784193 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -734,10 +734,6 @@ export class ScriptInfo { this.sourceMapFilePath = undefined; } } - - getLineCount(): number { - return this.textStorage.getLineInfo().getLineCount(); - } } function failIfInvalidPosition(position: number) { diff --git a/src/server/session.ts b/src/server/session.ts index 4d145ae214434..6a7d3c994bd54 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -2604,6 +2604,7 @@ export class Session implements EventSender { } const file = normalizePath(fileName); this.projectService.closeClientFile(file); + this.cleanUpSemanticCheckPerformance([fileName]); } private mapLocationNavigationBarItems(items: NavigationBarItem[], scriptInfo: ScriptInfo): protocol.NavigationBarItem[] { From 34bcbb22a055e7e176f7392ba595ed17de2abcb4 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 7 Jun 2024 17:53:23 +0000 Subject: [PATCH 62/74] always do semantic check in next immediate step --- src/server/session.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 6a7d3c994bd54..a76117d95d26e 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1283,17 +1283,17 @@ export class Session implements EventSender { tracing?.pop(); } - private regionSemanticCheck(file: NormalizedPath, project: Project, ranges: TextRange[]): boolean { + private regionSemanticCheck(file: NormalizedPath, project: Project, ranges: TextRange[]): void { this.diagnosticsTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails let diagnosticsResult; if (!this.shouldDoRegionCheck(file) || !(diagnosticsResult = project.getLanguageService().getRegionSemanticDiagnostics(file, ranges))) { tracing?.pop(); - return false; + return; } this.sendDiagnosticsEvent(file, project, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsResult.spans); tracing?.pop(); - return true; + return; } // We should only do the region-based semantic check if we think it would be considerably faster than a whole-file semantic check @@ -1392,16 +1392,11 @@ export class Session implements EventSender { if (ranges) { return next.immediate("regionSemanticCheck", () => { - const didRegionCheck = this.regionSemanticCheck(fileName, project, ranges); - if (didRegionCheck) { - if (this.changeSeq !== seq) { - return; - } - next.immediate("semanticCheck", () => doSemanticCheck(fileName, project)); - } - else { - doSemanticCheck(fileName, project); + this.regionSemanticCheck(fileName, project, ranges); + if (this.changeSeq !== seq) { + return; } + next.immediate("semanticCheck", () => doSemanticCheck(fileName, project)); }); } From 52eadaa94641409e7640232a4694efa7e136d735 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Fri, 7 Jun 2024 18:13:25 +0000 Subject: [PATCH 63/74] fix rebase problem --- src/server/session.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index a76117d95d26e..e35b929013d67 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1299,7 +1299,7 @@ export class Session implements EventSender { // We should only do the region-based semantic check if we think it would be considerably faster than a whole-file semantic check /** @internal */ protected shouldDoRegionCheck(file: NormalizedPath): boolean { - const lineCount = this.projectService.getScriptInfoForNormalizedPath(file)?.getLineCount(); + const lineCount = this.projectService.getScriptInfoForNormalizedPath(file)?.textStorage.getLineInfo().getLineCount(); return !!(lineCount && lineCount > 500); } @@ -2599,7 +2599,6 @@ export class Session implements EventSender { } const file = normalizePath(fileName); this.projectService.closeClientFile(file); - this.cleanUpSemanticCheckPerformance([fileName]); } private mapLocationNavigationBarItems(items: NavigationBarItem[], scriptInfo: ScriptInfo): protocol.NavigationBarItem[] { From 12979b7df70707d4ad2b28716b125118aefac6e4 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 10 Jun 2024 18:52:12 +0000 Subject: [PATCH 64/74] fix baselines --- tests/baselines/reference/api/typescript.d.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 702bf398477d6..3e0d4043d4323 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2720,7 +2720,6 @@ declare namespace ts { lineOffsetToPosition(line: number, offset: number): number; positionToLineOffset(position: number): protocol.Location; isJavaScript(): boolean; - getLineCount(): number; } interface InstallPackageOptionsWithProject extends InstallPackageOptions { projectName: string; @@ -3429,11 +3428,6 @@ declare namespace ts { private suppressDiagnosticEvents?; private eventHandler; private readonly noGetErrOnBackgroundUpdate?; - /** - * Maps a file path to duration in milliseconds of full semantic checking. - * Used for deciding whether to do a region semantic check. - */ - private semanticCheckPerformance; private diagnosticsTime; constructor(opts: SessionOptions); private sendRequestCompletedEvent; From 830c1180dad190bf081de68d37701b120b1be7c6 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 10 Jun 2024 19:54:40 +0000 Subject: [PATCH 65/74] check files in the order of the request --- src/server/protocol.ts | 1 - src/server/session.ts | 12 ++- src/testRunner/unittests/helpers/tsserver.ts | 11 +- tests/baselines/reference/api/typescript.d.ts | 1 - ...nodes-and-whole-file-for-multiple-files.js | 102 +++++++++--------- 5 files changed, 60 insertions(+), 67 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 0bf95d3dd79a0..21f70e728b603 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -2401,7 +2401,6 @@ export interface GeterrRequestArgs { /** * List of file names for which to compute compiler errors. * The files will be checked in list order. - * Files with ranges specified will be checked first. */ files: (string | FileRangesRequestArgs)[]; diff --git a/src/server/session.ts b/src/server/session.ts index e35b929013d67..a0a3bad01df3d 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -2537,20 +2537,22 @@ export class Session implements EventSender { } if (fileArgs.length > 0) { - const files = mapDefined(fileArgs.filter(isString), file => ({ fileName: toNormalizedPath(file) })); - const filesWithRange = mapDefined(fileArgs.filter((arg): arg is protocol.FileRangesRequestArgs => !isString(arg)), arg => { - const fileName = toNormalizedPath(arg.file); + const files = mapDefined(fileArgs, fileArg => { + if (isString(fileArg)) { + return { fileName: toNormalizedPath(fileArg) }; + } + const fileName = toNormalizedPath(fileArg.file); const scriptInfo = this.projectService.getScriptInfo(fileName); if (!scriptInfo) { return undefined; } - const ranges = arg.ranges.map(range => this.getRange({ file: arg.file, ...range }, scriptInfo)); + const ranges = fileArg.ranges.map(range => this.getRange({ file: fileArg.file, ...range }, scriptInfo)); return { fileName, ranges, }; }); - this.updateErrorCheck(next, [...filesWithRange, ...files], delay); + this.updateErrorCheck(next, files, delay); } } diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index d3e479c5b3daf..df6edc915f21a 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -390,15 +390,8 @@ export interface CheckAllErrors extends VerifyGetErrRequestBase { skip?: readonly (SkipErrors | undefined)[]; } function checkAllErrors({ session, existingTimeouts, files, skip }: CheckAllErrors) { - // Files with region will be checked first. - const fileSkips = files - .map((_file, i) => skip?.[i]) - .sort((a, b) => { - if (a?.regionSemantic === false && b?.regionSemantic === undefined) return -1; - if (b?.regionSemantic === false && a?.regionSemantic === undefined) return 1; - return 0; - }); - for (const fileSkip of fileSkips) { + for (let i = 0; i < files.length; i++) { + const fileSkip = skip?.[i]; // Run syntax check for next file session.host.runQueuedTimeoutCallbacks(existingTimeouts ? session.host.getNextTimeoutId() - 1 : undefined); if (fileSkip?.regionSemantic === false) { diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 3e0d4043d4323..4c5373039a02a 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1821,7 +1821,6 @@ declare namespace ts { /** * List of file names for which to compute compiler errors. * The files will be checked in list order. - * Files with ranges specified will be checked first. */ files: (string | FileRangesRequestArgs)[]; /** diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js index 2c728210f746c..640772da992c3 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js @@ -371,7 +371,7 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "syntaxDiag", "body": { - "file": "/a/b/app3.ts", + "file": "/a/b/app2.ts", "diagnostics": [], "duration": * } @@ -379,41 +379,10 @@ Info seq [hh:mm:ss:mss] event: After running Timeout callback:: count: 0 Immedidate callback:: count: 1 -4: regionSemanticCheck *new* +4: semanticCheck *new* Before running Immedidate callback:: count: 1 -4: regionSemanticCheck - -Info seq [hh:mm:ss:mss] event: - { - "seq": 0, - "type": "event", - "event": "regionSemanticDiag", - "body": { - "file": "/a/b/app3.ts", - "diagnostics": [], - "spans": [ - { - "start": { - "line": 4, - "offset": 2 - }, - "end": { - "line": 6, - "offset": 16 - } - } - ], - "duration": * - } - } -After running Immedidate callback:: count: 1 - -Immedidate callback:: count: 1 -5: semanticCheck *new* - -Before running Immedidate callback:: count: 1 -5: semanticCheck +4: semanticCheck Info seq [hh:mm:ss:mss] event: { @@ -421,18 +390,18 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "semanticDiag", "body": { - "file": "/a/b/app3.ts", + "file": "/a/b/app2.ts", "diagnostics": [ { "start": { - "line": 8, - "offset": 10 + "line": 7, + "offset": 13 }, "end": { - "line": 8, - "offset": 14 + "line": 7, + "offset": 28 }, - "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "text": "Argument of type 'string' is not assignable to parameter of type 'boolean'.", "code": 2345, "category": "error" } @@ -443,10 +412,10 @@ Info seq [hh:mm:ss:mss] event: After running Immedidate callback:: count: 1 Immedidate callback:: count: 1 -6: suggestionCheck *new* +5: suggestionCheck *new* Before running Immedidate callback:: count: 1 -6: suggestionCheck +5: suggestionCheck Info seq [hh:mm:ss:mss] event: { @@ -454,7 +423,7 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "suggestionDiag", "body": { - "file": "/a/b/app3.ts", + "file": "/a/b/app2.ts", "diagnostics": [], "duration": * } @@ -473,13 +442,44 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "syntaxDiag", "body": { - "file": "/a/b/app2.ts", + "file": "/a/b/app3.ts", "diagnostics": [], "duration": * } } After running Timeout callback:: count: 0 +Immedidate callback:: count: 1 +6: regionSemanticCheck *new* + +Before running Immedidate callback:: count: 1 +6: regionSemanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "regionSemanticDiag", + "body": { + "file": "/a/b/app3.ts", + "diagnostics": [], + "spans": [ + { + "start": { + "line": 4, + "offset": 2 + }, + "end": { + "line": 6, + "offset": 16 + } + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + Immedidate callback:: count: 1 7: semanticCheck *new* @@ -492,18 +492,18 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "semanticDiag", "body": { - "file": "/a/b/app2.ts", + "file": "/a/b/app3.ts", "diagnostics": [ { "start": { - "line": 7, - "offset": 13 + "line": 8, + "offset": 10 }, "end": { - "line": 7, - "offset": 28 + "line": 8, + "offset": 14 }, - "text": "Argument of type 'string' is not assignable to parameter of type 'boolean'.", + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", "code": 2345, "category": "error" } @@ -525,7 +525,7 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "suggestionDiag", "body": { - "file": "/a/b/app2.ts", + "file": "/a/b/app3.ts", "diagnostics": [], "duration": * } From d3a8f4162eb6c0d2491b4b541e7ad8b34af991d0 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 11 Jun 2024 00:57:55 +0000 Subject: [PATCH 66/74] refactor unit test --- src/testRunner/unittests/helpers/tsserver.ts | 9 + .../unittests/tsserver/regionDiagnostics.ts | 160 ++++----- ...nodes-and-whole-file-for-multiple-files.js | 320 +++++++++++++----- ...stics-for-select-nodes-in-a-single-file.js | 32 +- .../region-does-not-have-suggestion.js | 141 +++----- .../region-has-suggestion.js | 139 +++----- 6 files changed, 450 insertions(+), 351 deletions(-) diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index df6edc915f21a..8769c3b39db59 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -225,6 +225,15 @@ export function textSpanFromSubstring(str: string, substring: string, options?: return ts.createTextSpan(start, substring.length); } +export function protocolTextSpanToFileRange(span: ts.server.protocol.TextSpan): ts.server.protocol.FileRange { + return { + startLine: span.start.line, + startOffset: span.start.offset, + endLine: span.end.line, + endOffset: span.end.offset + }; +} + export function protocolFileLocationFromSubstring(file: File, substring: string, options?: SpanFromSubstringOptions): ts.server.protocol.FileLocationRequestArgs { return { file: file.path, ...protocolLocationFromSubstring(file.content, substring, options) }; } diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index ce54ea668bd41..5a4886146bf2e 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -1,36 +1,39 @@ -import * as ts from "../../_namespaces/ts.js"; +import { dedent } from "../../_namespaces/Utils.js"; +import { jsonToReadableText } from "../helpers.js"; import { baselineTsserverLogs, + openFilesForSession, + protocolTextSpanFromSubstring, + protocolTextSpanToFileRange, TestSession, verifyGetErrRequest, } from "../helpers/tsserver.js"; -import { createServerHost } from "../helpers/virtualFileSystemWithWatch.js"; +import { createServerHost, libFile } from "../helpers/virtualFileSystemWithWatch.js"; describe("unittests:: tsserver:: regionDiagnostics", () => { it("diagnostics for select nodes in a single file", () => { const file1 = { path: "/a/b/app.ts", - content: `function foo(x: number, y: string): number { - return x + y; -} + content: dedent` + function foo(x: number, y: string): number { + return x + y; + } -foo(10, 50);`, + foo(10, 50);`, }; - const host = createServerHost([file1]); + const host = createServerHost([file1, libFile]); const session = new TestSession(host); - session.executeCommandSeq({ - command: ts.server.protocol.CommandTypes.Open, - arguments: { file: file1.path }, - }); + openFilesForSession([file1], session); + verifyGetErrRequest({ session, files: [{ file: file1.path, - ranges: [{ startLine: 6, startOffset: 1, endLine: 7, endOffset: 13 }], + ranges: [protocolTextSpanToFileRange(protocolTextSpanFromSubstring(file1.content, "foo(10, 50);"))], }], skip: [ { regionSemantic: false }, @@ -43,71 +46,62 @@ foo(10, 50);`, it("diagnostics for select nodes and whole file for multiple files", () => { const file1 = { path: "/a/b/app.ts", - content: ` -function add(x: number, y: string): number { - return x + y; -} + content: dedent` + function add(x: number, y: string): number { + return x + y; + } -add(10, 50); -`, + add(10, 50);`, }; const file2 = { path: "/a/b/app2.ts", - content: ` -function booleanNoop(b: boolean): void { - b; - return; -} - -booleanNoop("not a boolean"); -`, + content: dedent` + function booleanNoop(b: boolean): void { + b; + return; + } + + booleanNoop("not a boolean");`, }; const file3 = { path: "/a/b/app3.ts", - content: ` -function stringId(x: string): string { - return x; -} + content: dedent` + function stringId(x: string): string { + return x; + } -stringId("ok"); + stringId("ok"); -stringId(1000); -`, + stringId(1000);`, }; const file4 = { path: "/a/b/app4.ts", - content: ` -function numberId(x: number): number { - return x; -} + content: dedent` + function numberId(x: number): number { + return x; + } -numberId(1000); -`, + numberId(1000);`, }; const files = [file1, file2, file3, file4]; - const host = createServerHost(files); + const host = createServerHost([...files, libFile]); const session = new TestSession(host); - session.executeCommandSeq({ - command: ts.server.protocol.CommandTypes.UpdateOpen, - arguments: { - openFiles: files.map(f => ({ file: f.path, fileContent: f.content })), - }, - }); + openFilesForSession(files, session); verifyGetErrRequest({ session, files: [ { file: file1.path, - ranges: [{ startLine: 6, startOffset: 1, endLine: 6, endOffset: 13 }], // `add(10, 50);` + ranges: [protocolTextSpanToFileRange(protocolTextSpanFromSubstring(file1.content, "add(10, 50);"))], }, file2.path, { file: file3.path, - ranges: [{ startLine: 6, startOffset: 1, endLine: 6, endOffset: 16 }], // `stringId("ok");` + ranges: [protocolTextSpanToFileRange(protocolTextSpanFromSubstring(file3.content, "stringId(\"ok\");"))], }, file4.path, ], @@ -125,54 +119,48 @@ numberId(1000); describe("diagnostics for select nodes when files have suggestion diagnostics", () => { const config = { path: "/tsconfig.json", - content: ` -{ - "compilerOptions": { - "allowSyntheticDefaultImports": true, - } -} -`, + content: jsonToReadableText({ + compilerOptions: { + allowSyntheticDefaultImports: true, + } + }), }; const indexFile = { path: "/index.ts", - content: ` -import add = require("./other.js"); + content: dedent` + import add = require("./other.js"); -add(3, "a"); + add(3, "a"); -add(1, 2); -`, + add(1, 2);`, }; const otherFile = { path: "/other.ts", - content: ` -function add(a: number, b: number) { - return a + b -} + content: dedent` + function add(a: number, b: number) { + return a + b + } -export = add; -`, + export = add;`, }; it("region has suggestion diagnostics", () => { - const files = [config, indexFile, otherFile]; - const host = createServerHost(files); + const host = createServerHost([config, indexFile, otherFile, libFile]); const session = new TestSession(host); - - session.executeCommandSeq({ - command: ts.server.protocol.CommandTypes.UpdateOpen, - arguments: { - openFiles: [{ file: indexFile.path, fileContent: indexFile.content }], - }, - }); + + openFilesForSession([indexFile], session); verifyGetErrRequest({ session, files: [ { file: indexFile.path, - // `import add = require("./other.js"); add(3, "a");` - ranges: [{ startLine: 2, startOffset: 1, endLine: 4, endOffset: 13 }], + ranges: [ + protocolTextSpanToFileRange( + protocolTextSpanFromSubstring( + indexFile.content, + "import add = require(\"./other.js\");\n\nadd(3, \"a\");")) + ], }, ], skip: [ @@ -184,24 +172,22 @@ export = add; }); it("region does not have suggestion diagnostics", () => { - const files = [config, indexFile, otherFile]; - const host = createServerHost(files); + const host = createServerHost([config, indexFile, otherFile, libFile]); const session = new TestSession(host); - session.executeCommandSeq({ - command: ts.server.protocol.CommandTypes.UpdateOpen, - arguments: { - openFiles: [{ file: indexFile.path, fileContent: indexFile.content }], - }, - }); + openFilesForSession([indexFile], session); verifyGetErrRequest({ session, files: [ { file: indexFile.path, - // `add(3, "a"); add(1, 2);` - ranges: [{ startLine: 4, startOffset: 1, endLine: 6, endOffset: 11 }], + ranges: [ + protocolTextSpanToFileRange( + protocolTextSpanFromSubstring( + indexFile.content, + "add(3, \"a\");\n\nadd(1, 2);")) + ], }, ], skip: [ diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js index 640772da992c3..d4eb7e191af18 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-and-whole-file-for-multiple-files.js @@ -2,137 +2,297 @@ currentDirectory:: / useCaseSensitiveFileNames: false Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist Before request //// [/a/b/app.ts] - function add(x: number, y: string): number { return x + y; } -add(10, 50); - +add(10, 50); //// [/a/b/app2.ts] - function booleanNoop(b: boolean): void { b; return; } -booleanNoop("not a boolean"); - +booleanNoop("not a boolean"); //// [/a/b/app3.ts] - function stringId(x: string): string { return x; } stringId("ok"); -stringId(1000); - +stringId(1000); //// [/a/b/app4.ts] - function numberId(x: number): number { return x; } -numberId(1000); - +numberId(1000); + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } Info seq [hh:mm:ss:mss] request: { - "command": "updateOpen", + "command": "open", "arguments": { - "openFiles": [ - { - "file": "/a/b/app.ts", - "fileContent": "\nfunction add(x: number, y: string): number {\n return x + y;\n}\n\nadd(10, 50);\n" - }, - { - "file": "/a/b/app2.ts", - "fileContent": "\nfunction booleanNoop(b: boolean): void {\n b;\n return;\n}\n\nbooleanNoop(\"not a boolean\");\n" - }, - { - "file": "/a/b/app3.ts", - "fileContent": "\nfunction stringId(x: string): string {\n return x;\n}\n\nstringId(\"ok\");\n\nstringId(1000);\n" - }, - { - "file": "/a/b/app4.ts", - "fileContent": "\nfunction numberId(x: number): number {\n return x;\n}\n\nnumberId(1000);\n" - } - ] + "file": "/a/b/app.ts" }, "seq": 1, "type": "request" } Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app.ts ProjectRootPath: undefined:: Result: undefined Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject1* WatchType: Missing file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info 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 (1) - /a/b/app.ts SVC-1-0 "\nfunction add(x: number, y: string): number {\n return x + y;\n}\n\nadd(10, 50);\n" +Info seq [hh:mm:ss:mss] Files (2) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /a/b/app.ts SVC-1-0 "function add(x: number, y: string): number {\n return x + y;\n}\n\nadd(10, 50);" + ../lib/lib.d.ts + Default library for target 'es5' app.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 (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /a/b/app.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +FsWatches:: +/a/lib/lib.d.ts: *new* + {} + +Projects:: +/dev/null/inferredProject1* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/a/b/app.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject1* *default* +/a/lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /dev/null/inferredProject1* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/a/b/app2.ts" + }, + "seq": 2, + "type": "request" + } Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app2.ts ProjectRootPath: undefined:: Result: undefined Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject2* -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject2* WatchType: Missing file Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject2* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject2*' (Inferred) -Info seq [hh:mm:ss:mss] Files (1) - /a/b/app2.ts SVC-1-0 "\nfunction booleanNoop(b: boolean): void {\n b;\n return;\n}\n\nbooleanNoop(\"not a boolean\");\n" +Info seq [hh:mm:ss:mss] Files (2) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /a/b/app2.ts SVC-1-0 "function booleanNoop(b: boolean): void {\n b;\n return;\n}\n\nbooleanNoop(\"not a boolean\");" + ../lib/lib.d.ts + Default library for target 'es5' app2.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 (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject2*' (Inferred) +Info seq [hh:mm:ss:mss] Files (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /a/b/app.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileName: /a/b/app2.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject2* +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Projects:: +/dev/null/inferredProject1* (Inferred) + projectStateVersion: 1 + projectProgramVersion: 1 +/dev/null/inferredProject2* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/a/b/app.ts (Open) + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject1* *default* +/a/b/app2.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject2* *default* +/a/lib/lib.d.ts *changed* + version: Text-1 + containingProjects: 2 *changed* + /dev/null/inferredProject1* + /dev/null/inferredProject2* *new* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/a/b/app3.ts" + }, + "seq": 3, + "type": "request" + } Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app3.ts ProjectRootPath: undefined:: Result: undefined Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject3* -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject3* WatchType: Missing file Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject3* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject3*' (Inferred) -Info seq [hh:mm:ss:mss] Files (1) - /a/b/app3.ts SVC-1-0 "\nfunction stringId(x: string): string {\n return x;\n}\n\nstringId(\"ok\");\n\nstringId(1000);\n" +Info seq [hh:mm:ss:mss] Files (2) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /a/b/app3.ts SVC-1-0 "function stringId(x: string): string {\n return x;\n}\n\nstringId(\"ok\");\n\nstringId(1000);" + ../lib/lib.d.ts + Default library for target 'es5' app3.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 (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject2*' (Inferred) +Info seq [hh:mm:ss:mss] Files (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject3*' (Inferred) +Info seq [hh:mm:ss:mss] Files (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /a/b/app.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileName: /a/b/app2.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject2* +Info seq [hh:mm:ss:mss] FileName: /a/b/app3.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject3* +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Projects:: +/dev/null/inferredProject1* (Inferred) + projectStateVersion: 1 + projectProgramVersion: 1 +/dev/null/inferredProject2* (Inferred) + projectStateVersion: 1 + projectProgramVersion: 1 +/dev/null/inferredProject3* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/a/b/app.ts (Open) + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject1* *default* +/a/b/app2.ts (Open) + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject2* *default* +/a/b/app3.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject3* *default* +/a/lib/lib.d.ts *changed* + version: Text-1 + containingProjects: 3 *changed* + /dev/null/inferredProject1* + /dev/null/inferredProject2* + /dev/null/inferredProject3* *new* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/a/b/app4.ts" + }, + "seq": 4, + "type": "request" + } Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app4.ts ProjectRootPath: undefined:: Result: undefined Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject4* -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject4* WatchType: Missing file Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject4* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject4*' (Inferred) -Info seq [hh:mm:ss:mss] Files (1) - /a/b/app4.ts SVC-1-0 "\nfunction numberId(x: number): number {\n return x;\n}\n\nnumberId(1000);\n" +Info seq [hh:mm:ss:mss] Files (2) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /a/b/app4.ts SVC-1-0 "function numberId(x: number): number {\n return x;\n}\n\nnumberId(1000);" + ../lib/lib.d.ts + Default library for target 'es5' app4.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 (1) +Info seq [hh:mm:ss:mss] Files (2) Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject2*' (Inferred) -Info seq [hh:mm:ss:mss] Files (1) +Info seq [hh:mm:ss:mss] Files (2) Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject3*' (Inferred) -Info seq [hh:mm:ss:mss] Files (1) +Info seq [hh:mm:ss:mss] Files (2) Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject4*' (Inferred) -Info seq [hh:mm:ss:mss] Files (1) +Info seq [hh:mm:ss:mss] Files (2) Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] Open files: @@ -146,23 +306,18 @@ Info seq [hh:mm:ss:mss] FileName: /a/b/app4.ts ProjectRootPath: undefined Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject4* Info seq [hh:mm:ss:mss] response: { - "response": true, - "responseRequired": true + "responseRequired": false } After request -PolledWatches:: -/a/lib/lib.d.ts: *new* - {"pollingInterval":500} - Projects:: -/dev/null/inferredProject1* (Inferred) *new* +/dev/null/inferredProject1* (Inferred) projectStateVersion: 1 projectProgramVersion: 1 -/dev/null/inferredProject2* (Inferred) *new* +/dev/null/inferredProject2* (Inferred) projectStateVersion: 1 projectProgramVersion: 1 -/dev/null/inferredProject3* (Inferred) *new* +/dev/null/inferredProject3* (Inferred) projectStateVersion: 1 projectProgramVersion: 1 /dev/null/inferredProject4* (Inferred) *new* @@ -170,15 +325,15 @@ Projects:: projectProgramVersion: 1 ScriptInfos:: -/a/b/app.ts (Open) *new* +/a/b/app.ts (Open) version: SVC-1-0 containingProjects: 1 /dev/null/inferredProject1* *default* -/a/b/app2.ts (Open) *new* +/a/b/app2.ts (Open) version: SVC-1-0 containingProjects: 1 /dev/null/inferredProject2* *default* -/a/b/app3.ts (Open) *new* +/a/b/app3.ts (Open) version: SVC-1-0 containingProjects: 1 /dev/null/inferredProject3* *default* @@ -186,6 +341,13 @@ ScriptInfos:: version: SVC-1-0 containingProjects: 1 /dev/null/inferredProject4* *default* +/a/lib/lib.d.ts *changed* + version: Text-1 + containingProjects: 4 *changed* + /dev/null/inferredProject1* + /dev/null/inferredProject2* + /dev/null/inferredProject3* + /dev/null/inferredProject4* *new* Before request @@ -199,9 +361,9 @@ Info seq [hh:mm:ss:mss] request: "file": "/a/b/app.ts", "ranges": [ { - "startLine": 6, + "startLine": 5, "startOffset": 1, - "endLine": 6, + "endLine": 5, "endOffset": 13 } ] @@ -211,9 +373,9 @@ Info seq [hh:mm:ss:mss] request: "file": "/a/b/app3.ts", "ranges": [ { - "startLine": 6, + "startLine": 5, "startOffset": 1, - "endLine": 6, + "endLine": 5, "endOffset": 16 } ] @@ -221,7 +383,7 @@ Info seq [hh:mm:ss:mss] request: "/a/b/app4.ts" ] }, - "seq": 2, + "seq": 5, "type": "request" } Info seq [hh:mm:ss:mss] response: @@ -265,11 +427,11 @@ Info seq [hh:mm:ss:mss] event: "diagnostics": [ { "start": { - "line": 6, + "line": 5, "offset": 9 }, "end": { - "line": 6, + "line": 5, "offset": 11 }, "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", @@ -280,11 +442,11 @@ Info seq [hh:mm:ss:mss] event: "spans": [ { "start": { - "line": 4, + "line": 3, "offset": 2 }, "end": { - "line": 6, + "line": 5, "offset": 13 } } @@ -310,11 +472,11 @@ Info seq [hh:mm:ss:mss] event: "diagnostics": [ { "start": { - "line": 3, + "line": 2, "offset": 5 }, "end": { - "line": 3, + "line": 2, "offset": 11 }, "text": "Type 'string' is not assignable to type 'number'.", @@ -323,11 +485,11 @@ Info seq [hh:mm:ss:mss] event: }, { "start": { - "line": 6, + "line": 5, "offset": 9 }, "end": { - "line": 6, + "line": 5, "offset": 11 }, "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", @@ -394,11 +556,11 @@ Info seq [hh:mm:ss:mss] event: "diagnostics": [ { "start": { - "line": 7, + "line": 6, "offset": 13 }, "end": { - "line": 7, + "line": 6, "offset": 28 }, "text": "Argument of type 'string' is not assignable to parameter of type 'boolean'.", @@ -466,11 +628,11 @@ Info seq [hh:mm:ss:mss] event: "spans": [ { "start": { - "line": 4, + "line": 3, "offset": 2 }, "end": { - "line": 6, + "line": 5, "offset": 16 } } @@ -496,11 +658,11 @@ Info seq [hh:mm:ss:mss] event: "diagnostics": [ { "start": { - "line": 8, + "line": 7, "offset": 10 }, "end": { - "line": 8, + "line": 7, "offset": 14 }, "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", @@ -593,7 +755,7 @@ Info seq [hh:mm:ss:mss] event: "type": "event", "event": "requestCompleted", "body": { - "request_seq": 2 + "request_seq": 5 } } After running Immedidate callback:: count: 0 diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js index 464726a6aa218..a91f039f3a6b8 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/diagnostics-for-select-nodes-in-a-single-file.js @@ -10,6 +10,19 @@ function foo(x: number, y: string): number { foo(10, 50); +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + Info seq [hh:mm:ss:mss] request: { @@ -22,19 +35,22 @@ Info seq [hh:mm:ss:mss] request: } Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app.ts ProjectRootPath: undefined:: Result: undefined Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /dev/null/inferredProject1* WatchType: Missing file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info 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 (1) +Info seq [hh:mm:ss:mss] Files (2) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" /a/b/app.ts SVC-1-0 "function foo(x: number, y: string): number {\n return x + y;\n}\n\n\n\nfoo(10, 50);" + ../lib/lib.d.ts + Default library for target 'es5' app.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 (1) +Info seq [hh:mm:ss:mss] Files (2) Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] Open files: @@ -46,9 +62,9 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: +FsWatches:: /a/lib/lib.d.ts: *new* - {"pollingInterval":500} + {} Projects:: /dev/null/inferredProject1* (Inferred) *new* @@ -60,6 +76,10 @@ ScriptInfos:: version: SVC-1-0 containingProjects: 1 /dev/null/inferredProject1* *default* +/a/lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /dev/null/inferredProject1* Before request @@ -73,7 +93,7 @@ Info seq [hh:mm:ss:mss] request: "file": "/a/b/app.ts", "ranges": [ { - "startLine": 6, + "startLine": 7, "startOffset": 1, "endLine": 7, "endOffset": 13 diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js b/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js index 88420b6b729d8..0e850f4d9ef21 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/region-does-not-have-suggestion.js @@ -2,43 +2,45 @@ currentDirectory:: / useCaseSensitiveFileNames: false Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist Before request //// [/tsconfig.json] - { - "compilerOptions": { - "allowSyntheticDefaultImports": true, - } -} - + "compilerOptions": { + "allowSyntheticDefaultImports": true + } +} //// [/index.ts] - import add = require("./other.js"); add(3, "a"); -add(1, 2); - +add(1, 2); //// [/other.ts] - function add(a: number, b: number) { return a + b } -export = add; +export = add; +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } Info seq [hh:mm:ss:mss] request: { - "command": "updateOpen", + "command": "open", "arguments": { - "openFiles": [ - { - "file": "/index.ts", - "fileContent": "\nimport add = require(\"./other.js\");\n\nadd(3, \"a\");\n\nadd(1, 2);\n" - } - ] + "file": "/index.ts" }, "seq": 1, "type": "request" @@ -59,7 +61,8 @@ Info seq [hh:mm:ss:mss] event: Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { "rootNames": [ "/index.ts", - "/other.ts" + "/other.ts", + "/a/lib/lib.d.ts" ], "options": { "allowSyntheticDefaultImports": true, @@ -69,13 +72,14 @@ Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /other.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /tsconfig.json WatchType: Missing file Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) -Info seq [hh:mm:ss:mss] Files (2) - /other.ts Text-1 "\nfunction add(a: number, b: number) {\n return a + b\n}\n\nexport = add;\n" - /index.ts SVC-1-0 "\nimport add = require(\"./other.js\");\n\nadd(3, \"a\");\n\nadd(1, 2);\n" +Info seq [hh:mm:ss:mss] Files (3) + /other.ts Text-1 "function add(a: number, b: number) {\n return a + b\n}\n\nexport = add;" + /index.ts SVC-1-0 "import add = require(\"./other.js\");\n\nadd(3, \"a\");\n\nadd(1, 2);" + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" other.ts @@ -83,6 +87,8 @@ Info seq [hh:mm:ss:mss] Files (2) Matched by default include pattern '**/*' index.ts Matched by default include pattern '**/*' + a/lib/lib.d.ts + Matched by default include pattern '**/*' Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] event: @@ -109,11 +115,11 @@ Info seq [hh:mm:ss:mss] event: "jsx": 0, "jsxSize": 0, "ts": 2, - "tsSize": 135, + "tsSize": 131, "tsx": 0, "tsxSize": 0, - "dts": 0, - "dtsSize": 0, + "dts": 1, + "dtsSize": 334, "deferred": 0, "deferredSize": 0 }, @@ -145,57 +151,11 @@ Info seq [hh:mm:ss:mss] event: "body": { "triggerFile": "/index.ts", "configFile": "/tsconfig.json", - "diagnostics": [ - { - "text": "File '/a/lib/lib.d.ts' not found.\n The file is in the program because:\n Default library for target 'es5'", - "code": 6053, - "category": "error" - }, - { - "text": "Cannot find global type 'Array'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'Boolean'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'Function'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'IArguments'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'Number'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'Object'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'RegExp'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'String'.", - "code": 2318, - "category": "error" - } - ] + "diagnostics": [] } } Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) -Info seq [hh:mm:ss:mss] Files (2) +Info seq [hh:mm:ss:mss] Files (3) Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] Open files: @@ -203,16 +163,13 @@ Info seq [hh:mm:ss:mss] FileName: /index.ts ProjectRootPath: undefined Info seq [hh:mm:ss:mss] Projects: /tsconfig.json Info seq [hh:mm:ss:mss] response: { - "response": true, - "responseRequired": true + "responseRequired": false } After request -PolledWatches:: -/a/lib/lib.d.ts: *new* - {"pollingInterval":500} - FsWatches:: +/a/lib/lib.d.ts: *new* + {} /other.ts: *new* {} /tsconfig.json: *new* @@ -228,6 +185,10 @@ Projects:: projectProgramVersion: 1 ScriptInfos:: +/a/lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /tsconfig.json /index.ts (Open) *new* version: SVC-1-0 containingProjects: 1 @@ -249,9 +210,9 @@ Info seq [hh:mm:ss:mss] request: "file": "/index.ts", "ranges": [ { - "startLine": 4, + "startLine": 3, "startOffset": 1, - "endLine": 6, + "endLine": 5, "endOffset": 11 } ] @@ -302,11 +263,11 @@ Info seq [hh:mm:ss:mss] event: "diagnostics": [ { "start": { - "line": 4, + "line": 3, "offset": 8 }, "end": { - "line": 4, + "line": 3, "offset": 11 }, "text": "Argument of type 'string' is not assignable to parameter of type 'number'.", @@ -317,11 +278,11 @@ Info seq [hh:mm:ss:mss] event: "spans": [ { "start": { - "line": 2, + "line": 1, "offset": 36 }, "end": { - "line": 6, + "line": 5, "offset": 11 } } @@ -347,11 +308,11 @@ Info seq [hh:mm:ss:mss] event: "diagnostics": [ { "start": { - "line": 4, + "line": 3, "offset": 8 }, "end": { - "line": 4, + "line": 3, "offset": 11 }, "text": "Argument of type 'string' is not assignable to parameter of type 'number'.", @@ -380,11 +341,11 @@ Info seq [hh:mm:ss:mss] event: "diagnostics": [ { "start": { - "line": 2, + "line": 1, "offset": 8 }, "end": { - "line": 2, + "line": 1, "offset": 11 }, "text": "Import may be converted to a default import.", diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js b/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js index 5b56379e2aa2f..76d066ea64990 100644 --- a/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js +++ b/tests/baselines/reference/tsserver/regionDiagnostics/region-has-suggestion.js @@ -2,43 +2,45 @@ currentDirectory:: / useCaseSensitiveFileNames: false Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist Before request //// [/tsconfig.json] - { - "compilerOptions": { - "allowSyntheticDefaultImports": true, - } -} - + "compilerOptions": { + "allowSyntheticDefaultImports": true + } +} //// [/index.ts] - import add = require("./other.js"); add(3, "a"); -add(1, 2); - +add(1, 2); //// [/other.ts] - function add(a: number, b: number) { return a + b } -export = add; +export = add; +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } Info seq [hh:mm:ss:mss] request: { - "command": "updateOpen", + "command": "open", "arguments": { - "openFiles": [ - { - "file": "/index.ts", - "fileContent": "\nimport add = require(\"./other.js\");\n\nadd(3, \"a\");\n\nadd(1, 2);\n" - } - ] + "file": "/index.ts" }, "seq": 1, "type": "request" @@ -59,7 +61,8 @@ Info seq [hh:mm:ss:mss] event: Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { "rootNames": [ "/index.ts", - "/other.ts" + "/other.ts", + "/a/lib/lib.d.ts" ], "options": { "allowSyntheticDefaultImports": true, @@ -69,13 +72,14 @@ Info seq [hh:mm:ss:mss] Config: /tsconfig.json : { Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: 1 undefined Config: /tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /other.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined Project: /tsconfig.json WatchType: Missing file Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) -Info seq [hh:mm:ss:mss] Files (2) - /other.ts Text-1 "\nfunction add(a: number, b: number) {\n return a + b\n}\n\nexport = add;\n" - /index.ts SVC-1-0 "\nimport add = require(\"./other.js\");\n\nadd(3, \"a\");\n\nadd(1, 2);\n" +Info seq [hh:mm:ss:mss] Files (3) + /other.ts Text-1 "function add(a: number, b: number) {\n return a + b\n}\n\nexport = add;" + /index.ts SVC-1-0 "import add = require(\"./other.js\");\n\nadd(3, \"a\");\n\nadd(1, 2);" + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" other.ts @@ -83,6 +87,8 @@ Info seq [hh:mm:ss:mss] Files (2) Matched by default include pattern '**/*' index.ts Matched by default include pattern '**/*' + a/lib/lib.d.ts + Matched by default include pattern '**/*' Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] event: @@ -109,11 +115,11 @@ Info seq [hh:mm:ss:mss] event: "jsx": 0, "jsxSize": 0, "ts": 2, - "tsSize": 135, + "tsSize": 131, "tsx": 0, "tsxSize": 0, - "dts": 0, - "dtsSize": 0, + "dts": 1, + "dtsSize": 334, "deferred": 0, "deferredSize": 0 }, @@ -145,57 +151,11 @@ Info seq [hh:mm:ss:mss] event: "body": { "triggerFile": "/index.ts", "configFile": "/tsconfig.json", - "diagnostics": [ - { - "text": "File '/a/lib/lib.d.ts' not found.\n The file is in the program because:\n Default library for target 'es5'", - "code": 6053, - "category": "error" - }, - { - "text": "Cannot find global type 'Array'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'Boolean'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'Function'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'IArguments'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'Number'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'Object'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'RegExp'.", - "code": 2318, - "category": "error" - }, - { - "text": "Cannot find global type 'String'.", - "code": 2318, - "category": "error" - } - ] + "diagnostics": [] } } Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured) -Info seq [hh:mm:ss:mss] Files (2) +Info seq [hh:mm:ss:mss] Files (3) Info seq [hh:mm:ss:mss] ----------------------------------------------- Info seq [hh:mm:ss:mss] Open files: @@ -203,16 +163,13 @@ Info seq [hh:mm:ss:mss] FileName: /index.ts ProjectRootPath: undefined Info seq [hh:mm:ss:mss] Projects: /tsconfig.json Info seq [hh:mm:ss:mss] response: { - "response": true, - "responseRequired": true + "responseRequired": false } After request -PolledWatches:: -/a/lib/lib.d.ts: *new* - {"pollingInterval":500} - FsWatches:: +/a/lib/lib.d.ts: *new* + {} /other.ts: *new* {} /tsconfig.json: *new* @@ -228,6 +185,10 @@ Projects:: projectProgramVersion: 1 ScriptInfos:: +/a/lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /tsconfig.json /index.ts (Open) *new* version: SVC-1-0 containingProjects: 1 @@ -249,9 +210,9 @@ Info seq [hh:mm:ss:mss] request: "file": "/index.ts", "ranges": [ { - "startLine": 2, + "startLine": 1, "startOffset": 1, - "endLine": 4, + "endLine": 3, "endOffset": 13 } ] @@ -302,11 +263,11 @@ Info seq [hh:mm:ss:mss] event: "diagnostics": [ { "start": { - "line": 4, + "line": 3, "offset": 8 }, "end": { - "line": 4, + "line": 3, "offset": 11 }, "text": "Argument of type 'string' is not assignable to parameter of type 'number'.", @@ -321,7 +282,7 @@ Info seq [hh:mm:ss:mss] event: "offset": 1 }, "end": { - "line": 4, + "line": 3, "offset": 13 } } @@ -347,11 +308,11 @@ Info seq [hh:mm:ss:mss] event: "diagnostics": [ { "start": { - "line": 4, + "line": 3, "offset": 8 }, "end": { - "line": 4, + "line": 3, "offset": 11 }, "text": "Argument of type 'string' is not assignable to parameter of type 'number'.", @@ -380,11 +341,11 @@ Info seq [hh:mm:ss:mss] event: "diagnostics": [ { "start": { - "line": 2, + "line": 1, "offset": 8 }, "end": { - "line": 2, + "line": 1, "offset": 11 }, "text": "Import may be converted to a default import.", From 1752f8fc4a8d59c77c24f23ba8d6742c8c9c8f1a Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 11 Jun 2024 19:04:24 +0000 Subject: [PATCH 67/74] add option for test session to always enable region checking --- src/testRunner/unittests/helpers/tsserver.ts | 7 +++++-- src/testRunner/unittests/tsserver/regionDiagnostics.ts | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index 8769c3b39db59..90e86ca14f054 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -72,6 +72,7 @@ export interface TestSessionOptions extends ts.server.SessionOptions, TestTyping logger: LoggerWithInMemoryLogs; disableAutomaticTypingAcquisition?: boolean; useCancellationToken?: boolean | number; + alwaysDoRegionDiagnostics?: boolean; } export type TestSessionPartialOptionsAndHost = Partial> & Pick; export type TestSessionConstructorOptions = TestServerHost | TestSessionPartialOptionsAndHost; @@ -89,6 +90,7 @@ export class TestSession extends ts.server.Session { public override logger!: LoggerWithInMemoryLogs; public override readonly typingsInstaller!: TestTypingsInstallerAdapter; public serverCancellationToken: TestServerCancellationToken; + private alwaysDoRegionDiagnostics: boolean; constructor(optsOrHost: TestSessionConstructorOptions) { const opts = getTestSessionPartialOptionsAndHost(optsOrHost); @@ -121,6 +123,7 @@ export class TestSession extends ts.server.Session { this, this.logger, ); + this.alwaysDoRegionDiagnostics = !!opts.alwaysDoRegionDiagnostics; } getProjectService() { @@ -156,8 +159,8 @@ export class TestSession extends ts.server.Session { return this.executeCommand(request); } - protected override shouldDoRegionCheck(_file: ts.server.NormalizedPath): boolean { - return true; + protected override shouldDoRegionCheck(file: ts.server.NormalizedPath): boolean { + return this.alwaysDoRegionDiagnostics || super.shouldDoRegionCheck(file); } } diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index 5a4886146bf2e..6f25519897105 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -24,7 +24,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { foo(10, 50);`, }; const host = createServerHost([file1, libFile]); - const session = new TestSession(host); + const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); openFilesForSession([file1], session); @@ -87,7 +87,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { const files = [file1, file2, file3, file4]; const host = createServerHost([...files, libFile]); - const session = new TestSession(host); + const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); openFilesForSession(files, session); @@ -146,7 +146,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { it("region has suggestion diagnostics", () => { const host = createServerHost([config, indexFile, otherFile, libFile]); - const session = new TestSession(host); + const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); openFilesForSession([indexFile], session); @@ -173,7 +173,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { it("region does not have suggestion diagnostics", () => { const host = createServerHost([config, indexFile, otherFile, libFile]); - const session = new TestSession(host); + const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); openFilesForSession([indexFile], session); From 9320a453225dcbf37ec9afc6d3f609cb01ff80aa Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 11 Jun 2024 19:18:06 +0000 Subject: [PATCH 68/74] add test for skipped region diagnostics --- .../unittests/tsserver/regionDiagnostics.ts | 32 +++ ...n-diagnostics-is-skipped-for-small-file.js | 213 ++++++++++++++++++ 2 files changed, 245 insertions(+) create mode 100644 tests/baselines/reference/tsserver/regionDiagnostics/region-diagnostics-is-skipped-for-small-file.js diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index 6f25519897105..ff5d96ab8e2c3 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -198,4 +198,36 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { baselineTsserverLogs("regionDiagnostics", "region does not have suggestion", session); }); }); + + it("region diagnostics is skipped for small file", () => { + const file1 = { + path: "/a/b/app.ts", + content: dedent` + function foo(x: number, y: string): number { + return x + y; + } + + + + foo(10, 50);`, + }; + const host = createServerHost([file1, libFile]); + const session = new TestSession({ host, alwaysDoRegionDiagnostics: false }); + + openFilesForSession([file1], session); + + + verifyGetErrRequest({ + session, + files: [{ + file: file1.path, + ranges: [protocolTextSpanToFileRange(protocolTextSpanFromSubstring(file1.content, "foo(10, 50);"))], + }], + skip: [ + { regionSemantic: false }, + ], + }); + + baselineTsserverLogs("regionDiagnostics", "region diagnostics is skipped for small file", session); + }); }); diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/region-diagnostics-is-skipped-for-small-file.js b/tests/baselines/reference/tsserver/regionDiagnostics/region-diagnostics-is-skipped-for-small-file.js new file mode 100644 index 0000000000000..6b3b3d2c17a9f --- /dev/null +++ b/tests/baselines/reference/tsserver/regionDiagnostics/region-diagnostics-is-skipped-for-small-file.js @@ -0,0 +1,213 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +Before request +//// [/a/b/app.ts] +function foo(x: number, y: string): number { + return x + y; +} + + + +foo(10, 50); + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/a/b/app.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app.ts ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +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 (2) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /a/b/app.ts SVC-1-0 "function foo(x: number, y: string): number {\n return x + y;\n}\n\n\n\nfoo(10, 50);" + + + ../lib/lib.d.ts + Default library for target 'es5' + app.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 (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /a/b/app.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +FsWatches:: +/a/lib/lib.d.ts: *new* + {} + +Projects:: +/dev/null/inferredProject1* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/a/b/app.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject1* *default* +/a/lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /dev/null/inferredProject1* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "geterr", + "arguments": { + "delay": 0, + "files": [ + { + "file": "/a/b/app.ts", + "ranges": [ + { + "startLine": 7, + "startOffset": 1, + "endLine": 7, + "endOffset": 13 + } + ] + } + ] + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Timeout callback:: count: 1 +1: checkOne *new* + +Before running Timeout callback:: count: 1 +1: checkOne + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +1: regionSemanticCheck *new* + +Before running Immedidate callback:: count: 1 +1: regionSemanticCheck + +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +2: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +2: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [ + { + "start": { + "line": 2, + "offset": 5 + }, + "end": { + "line": 2, + "offset": 11 + }, + "text": "Type 'string' is not assignable to type 'number'.", + "code": 2322, + "category": "error" + }, + { + "start": { + "line": 7, + "offset": 9 + }, + "end": { + "line": 7, + "offset": 11 + }, + "text": "Argument of type 'number' is not assignable to parameter of type 'string'.", + "code": 2345, + "category": "error" + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +3: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +3: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [], + "duration": * + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "requestCompleted", + "body": { + "request_seq": 2 + } + } +After running Immedidate callback:: count: 0 From 68831d13a6cf7d051c80c96b7afd299cb29df26f Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 11 Jun 2024 19:22:32 +0000 Subject: [PATCH 69/74] format --- src/testRunner/unittests/helpers/tsserver.ts | 2 +- .../unittests/tsserver/regionDiagnostics.ts | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index 90e86ca14f054..26e25cf4c1b47 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -233,7 +233,7 @@ export function protocolTextSpanToFileRange(span: ts.server.protocol.TextSpan): startLine: span.start.line, startOffset: span.start.offset, endLine: span.end.line, - endOffset: span.end.offset + endOffset: span.end.offset, }; } diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index ff5d96ab8e2c3..02da81b8fb230 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -8,7 +8,10 @@ import { TestSession, verifyGetErrRequest, } from "../helpers/tsserver.js"; -import { createServerHost, libFile } from "../helpers/virtualFileSystemWithWatch.js"; +import { + createServerHost, + libFile, +} from "../helpers/virtualFileSystemWithWatch.js"; describe("unittests:: tsserver:: regionDiagnostics", () => { it("diagnostics for select nodes in a single file", () => { @@ -27,7 +30,6 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); openFilesForSession([file1], session); - verifyGetErrRequest({ session, @@ -101,7 +103,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { file2.path, { file: file3.path, - ranges: [protocolTextSpanToFileRange(protocolTextSpanFromSubstring(file3.content, "stringId(\"ok\");"))], + ranges: [protocolTextSpanToFileRange(protocolTextSpanFromSubstring(file3.content, 'stringId("ok");'))], }, file4.path, ], @@ -122,7 +124,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { content: jsonToReadableText({ compilerOptions: { allowSyntheticDefaultImports: true, - } + }, }), }; const indexFile = { @@ -147,7 +149,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { it("region has suggestion diagnostics", () => { const host = createServerHost([config, indexFile, otherFile, libFile]); const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); - + openFilesForSession([indexFile], session); verifyGetErrRequest({ @@ -159,8 +161,10 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { protocolTextSpanToFileRange( protocolTextSpanFromSubstring( indexFile.content, - "import add = require(\"./other.js\");\n\nadd(3, \"a\");")) - ], + 'import add = require("./other.js");\n\nadd(3, "a");', + ), + ), + ], }, ], skip: [ @@ -186,8 +190,10 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { protocolTextSpanToFileRange( protocolTextSpanFromSubstring( indexFile.content, - "add(3, \"a\");\n\nadd(1, 2);")) - ], + 'add(3, "a");\n\nadd(1, 2);', + ), + ), + ], }, ], skip: [ @@ -215,7 +221,6 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { const session = new TestSession({ host, alwaysDoRegionDiagnostics: false }); openFilesForSession([file1], session); - verifyGetErrRequest({ session, From eb168b6f5d8bd33518ac6fafc5647359728a6370 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Tue, 11 Jun 2024 22:16:22 +0000 Subject: [PATCH 70/74] add test for file with ts-nocheck --- .../unittests/tsserver/regionDiagnostics.ts | 32 +++ ...nostics-is-skipped-for-@ts-nocheck-file.js | 187 ++++++++++++++++++ 2 files changed, 219 insertions(+) create mode 100644 tests/baselines/reference/tsserver/regionDiagnostics/region-diagnostics-is-skipped-for-@ts-nocheck-file.js diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index 02da81b8fb230..ad4afcfb22efa 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -235,4 +235,36 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { baselineTsserverLogs("regionDiagnostics", "region diagnostics is skipped for small file", session); }); + + it("region diagnostics is skipped for @ts-nocheck file", () => { + const file1 = { + path: "/a/b/app.ts", + content: dedent` + // @ts-nocheck + function foo(x: number, y: string): number { + return x + y; + } + + + + foo(10, 50);`, + }; + const host = createServerHost([file1, libFile]); + const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); + + openFilesForSession([file1], session); + + verifyGetErrRequest({ + session, + files: [{ + file: file1.path, + ranges: [protocolTextSpanToFileRange(protocolTextSpanFromSubstring(file1.content, "foo(10, 50);"))], + }], + skip: [ + { regionSemantic: false }, + ], + }); + + baselineTsserverLogs("regionDiagnostics", "region diagnostics is skipped for @ts-nocheck file", session); + }); }); diff --git a/tests/baselines/reference/tsserver/regionDiagnostics/region-diagnostics-is-skipped-for-@ts-nocheck-file.js b/tests/baselines/reference/tsserver/regionDiagnostics/region-diagnostics-is-skipped-for-@ts-nocheck-file.js new file mode 100644 index 0000000000000..868ad3d2dc122 --- /dev/null +++ b/tests/baselines/reference/tsserver/regionDiagnostics/region-diagnostics-is-skipped-for-@ts-nocheck-file.js @@ -0,0 +1,187 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +Before request +//// [/a/b/app.ts] +// @ts-nocheck +function foo(x: number, y: string): number { + return x + y; +} + + + +foo(10, 50); + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/a/b/app.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /a/b/app.ts ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +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 (2) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /a/b/app.ts SVC-1-0 "// @ts-nocheck\nfunction foo(x: number, y: string): number {\n return x + y;\n}\n\n\n\nfoo(10, 50);" + + + ../lib/lib.d.ts + Default library for target 'es5' + app.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 (2) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /a/b/app.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1* +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +FsWatches:: +/a/lib/lib.d.ts: *new* + {} + +Projects:: +/dev/null/inferredProject1* (Inferred) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/a/b/app.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /dev/null/inferredProject1* *default* +/a/lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /dev/null/inferredProject1* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "geterr", + "arguments": { + "delay": 0, + "files": [ + { + "file": "/a/b/app.ts", + "ranges": [ + { + "startLine": 8, + "startOffset": 1, + "endLine": 8, + "endOffset": 13 + } + ] + } + ] + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Timeout callback:: count: 1 +1: checkOne *new* + +Before running Timeout callback:: count: 1 +1: checkOne + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "syntaxDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +1: regionSemanticCheck *new* + +Before running Immedidate callback:: count: 1 +1: regionSemanticCheck + +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +2: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +2: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +3: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +3: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/a/b/app.ts", + "diagnostics": [], + "duration": * + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "requestCompleted", + "body": { + "request_seq": 2 + } + } +After running Immedidate callback:: count: 0 From 7c512acb6d9987f2482a26f861049a7067b7fdd6 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 12 Jun 2024 14:49:47 -0700 Subject: [PATCH 71/74] add comments and minor refactor --- src/compiler/utilitiesPublic.ts | 6 +++++- src/testRunner/unittests/helpers/tsserver.ts | 14 ++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 600ac689a1472..8c48394ddae26 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -405,7 +405,11 @@ export function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan return start <= end ? createTextSpanFromBounds(start, end) : undefined; } -/** @internal */ +/** + * Given an array of text spans, returns an equivalent sorted array of text spans + * where no span overlaps or is adjacent to another span in the array. + * @internal + */ export function normalizeSpans(spans: readonly TextSpan[]): TextSpan[] { spans = spans.filter(span => span.length > 0).sort((a, b) => { return a.start !== b.start ? a.start - b.start : a.length - b.length; diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index 26e25cf4c1b47..ffd13199b02e2 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -395,6 +395,7 @@ export function verifyGetErrRequest(request: VerifyGetErrRequest) { interface SkipErrors { semantic?: true; suggestion?: true; + /** Region semantic checking will only happen if this is */ regionSemantic?: false; } export interface CheckAllErrors extends VerifyGetErrRequestBase { @@ -403,17 +404,10 @@ export interface CheckAllErrors extends VerifyGetErrRequestBase { } function checkAllErrors({ session, existingTimeouts, files, skip }: CheckAllErrors) { for (let i = 0; i < files.length; i++) { - const fileSkip = skip?.[i]; - // Run syntax check for next file session.host.runQueuedTimeoutCallbacks(existingTimeouts ? session.host.getNextTimeoutId() - 1 : undefined); - if (fileSkip?.regionSemantic === false) { - // Run region check - session.host.runQueuedImmediateCallbacks(); - } - // Run semantic check - if (!fileSkip?.semantic) session.host.runQueuedImmediateCallbacks(); - // Run suggestion check - if (!fileSkip?.suggestion) session.host.runQueuedImmediateCallbacks(); + if (skip?.[i]?.regionSemantic === false) session.host.runQueuedImmediateCallbacks(); + if (!skip?.[i]?.semantic) session.host.runQueuedImmediateCallbacks(); + if (!skip?.[i]?.suggestion) session.host.runQueuedImmediateCallbacks(); } } From ec6772cac5e5d1d51def634331ad66054253f24d Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 13 Jun 2024 11:44:01 -0700 Subject: [PATCH 72/74] refactor --- src/server/session.ts | 35 ++++++++++++------- src/testRunner/unittests/helpers/tsserver.ts | 11 +++--- .../unittests/tsserver/regionDiagnostics.ts | 12 +++---- tests/baselines/reference/api/typescript.d.ts | 2 +- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 0d56b394b0e30..b4816f4c68814 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -994,7 +994,8 @@ export class Session implements EventSender { private eventHandler: ProjectServiceEventHandler | undefined; private readonly noGetErrOnBackgroundUpdate?: boolean; - private diagnosticsTime: [number, number] | undefined; + // Minimum number of lines for attempting to use region diagnostics for a file. + protected regionDiagLineCountThreshold = 500; constructor(opts: SessionOptions) { this.host = opts.host; @@ -1260,53 +1261,61 @@ export class Session implements EventSender { } private semanticCheck(file: NormalizedPath, project: Project) { - this.diagnosticsTime = this.hrtime(); + const diagnosticsStartTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "semanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails const diags = isDeclarationFileInJSOnlyNonConfiguredProject(project, file) ? emptyArray : project.getLanguageService().getSemanticDiagnostics(file).filter(d => !!d.file); - this.sendDiagnosticsEvent(file, project, diags, "semanticDiag"); + this.sendDiagnosticsEvent(file, project, diags, "semanticDiag", diagnosticsStartTime); tracing?.pop(); } private syntacticCheck(file: NormalizedPath, project: Project) { - this.diagnosticsTime = this.hrtime(); + const diagnosticsStartTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "syntacticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails - this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag"); + this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag", diagnosticsStartTime); tracing?.pop(); } private suggestionCheck(file: NormalizedPath, project: Project) { - this.diagnosticsTime = this.hrtime(); + const diagnosticsStartTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "suggestionCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails - this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag"); + this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag", diagnosticsStartTime); tracing?.pop(); } private regionSemanticCheck(file: NormalizedPath, project: Project, ranges: TextRange[]): void { - this.diagnosticsTime = this.hrtime(); + const diagnosticsStartTime = this.hrtime(); tracing?.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: (project as ConfiguredProject).canonicalConfigFilePath }); // undefined is fine if the cast fails let diagnosticsResult; if (!this.shouldDoRegionCheck(file) || !(diagnosticsResult = project.getLanguageService().getRegionSemanticDiagnostics(file, ranges))) { tracing?.pop(); return; } - this.sendDiagnosticsEvent(file, project, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsResult.spans); + this.sendDiagnosticsEvent(file, project, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsStartTime, diagnosticsResult.spans); tracing?.pop(); return; } - // We should only do the region-based semantic check if we think it would be considerably faster than a whole-file semantic check + // We should only do the region-based semantic check if we think it would be + // considerably faster than a whole-file semantic check. /** @internal */ protected shouldDoRegionCheck(file: NormalizedPath): boolean { const lineCount = this.projectService.getScriptInfoForNormalizedPath(file)?.textStorage.getLineInfo().getLineCount(); - return !!(lineCount && lineCount > 500); + return !!(lineCount && lineCount >= this.regionDiagLineCountThreshold); } - private sendDiagnosticsEvent(file: NormalizedPath, project: Project, diagnostics: readonly Diagnostic[], kind: protocol.DiagnosticEventKind, spans?: TextSpan[]): void { + private sendDiagnosticsEvent( + file: NormalizedPath, + project: Project, + diagnostics: readonly Diagnostic[], + kind: protocol.DiagnosticEventKind, + diagnosticsStartTime: [number, number], + spans?: TextSpan[], + ): void { try { const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); - const duration = hrTimeToMilliseconds(this.hrtime(this.diagnosticsTime)); + const duration = hrTimeToMilliseconds(this.hrtime(diagnosticsStartTime)); const body: protocol.DiagnosticEventBody = { file, diff --git a/src/testRunner/unittests/helpers/tsserver.ts b/src/testRunner/unittests/helpers/tsserver.ts index ffd13199b02e2..a78ec260f6e86 100644 --- a/src/testRunner/unittests/helpers/tsserver.ts +++ b/src/testRunner/unittests/helpers/tsserver.ts @@ -72,7 +72,7 @@ export interface TestSessionOptions extends ts.server.SessionOptions, TestTyping logger: LoggerWithInMemoryLogs; disableAutomaticTypingAcquisition?: boolean; useCancellationToken?: boolean | number; - alwaysDoRegionDiagnostics?: boolean; + regionDiagLineCountThreshold?: number; } export type TestSessionPartialOptionsAndHost = Partial> & Pick; export type TestSessionConstructorOptions = TestServerHost | TestSessionPartialOptionsAndHost; @@ -90,7 +90,6 @@ export class TestSession extends ts.server.Session { public override logger!: LoggerWithInMemoryLogs; public override readonly typingsInstaller!: TestTypingsInstallerAdapter; public serverCancellationToken: TestServerCancellationToken; - private alwaysDoRegionDiagnostics: boolean; constructor(optsOrHost: TestSessionConstructorOptions) { const opts = getTestSessionPartialOptionsAndHost(optsOrHost); @@ -123,7 +122,9 @@ export class TestSession extends ts.server.Session { this, this.logger, ); - this.alwaysDoRegionDiagnostics = !!opts.alwaysDoRegionDiagnostics; + if (opts.regionDiagLineCountThreshold !== undefined) { + this.regionDiagLineCountThreshold = opts.regionDiagLineCountThreshold; + } } getProjectService() { @@ -158,10 +159,6 @@ export class TestSession extends ts.server.Session { request.type = "request"; return this.executeCommand(request); } - - protected override shouldDoRegionCheck(file: ts.server.NormalizedPath): boolean { - return this.alwaysDoRegionDiagnostics || super.shouldDoRegionCheck(file); - } } export function createSessionWithCustomEventHandler( diff --git a/src/testRunner/unittests/tsserver/regionDiagnostics.ts b/src/testRunner/unittests/tsserver/regionDiagnostics.ts index ad4afcfb22efa..9a20f7ef42739 100644 --- a/src/testRunner/unittests/tsserver/regionDiagnostics.ts +++ b/src/testRunner/unittests/tsserver/regionDiagnostics.ts @@ -27,7 +27,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { foo(10, 50);`, }; const host = createServerHost([file1, libFile]); - const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); + const session = new TestSession({ host, regionDiagLineCountThreshold: 0 }); openFilesForSession([file1], session); @@ -89,7 +89,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { const files = [file1, file2, file3, file4]; const host = createServerHost([...files, libFile]); - const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); + const session = new TestSession({ host, regionDiagLineCountThreshold: 0 }); openFilesForSession(files, session); @@ -148,7 +148,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { it("region has suggestion diagnostics", () => { const host = createServerHost([config, indexFile, otherFile, libFile]); - const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); + const session = new TestSession({ host, regionDiagLineCountThreshold: 0 }); openFilesForSession([indexFile], session); @@ -177,7 +177,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { it("region does not have suggestion diagnostics", () => { const host = createServerHost([config, indexFile, otherFile, libFile]); - const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); + const session = new TestSession({ host, regionDiagLineCountThreshold: 0 }); openFilesForSession([indexFile], session); @@ -218,7 +218,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { foo(10, 50);`, }; const host = createServerHost([file1, libFile]); - const session = new TestSession({ host, alwaysDoRegionDiagnostics: false }); + const session = new TestSession({ host }); openFilesForSession([file1], session); @@ -250,7 +250,7 @@ describe("unittests:: tsserver:: regionDiagnostics", () => { foo(10, 50);`, }; const host = createServerHost([file1, libFile]); - const session = new TestSession({ host, alwaysDoRegionDiagnostics: true }); + const session = new TestSession({ host, regionDiagLineCountThreshold: 0 }); openFilesForSession([file1], session); diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 1b3296f4b304f..4ed0b08db666a 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3455,7 +3455,7 @@ declare namespace ts { private suppressDiagnosticEvents?; private eventHandler; private readonly noGetErrOnBackgroundUpdate?; - private diagnosticsTime; + protected regionDiagLineCountThreshold: number; constructor(opts: SessionOptions); private sendRequestCompletedEvent; private addPerformanceData; From f1d87dc25e9d1d66cb7561b0eaeda027aca087dc Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 13 Jun 2024 13:47:41 -0700 Subject: [PATCH 73/74] refactor updateErrorCheck to delay work again --- src/server/session.ts | 59 ++++++++++--------- tests/baselines/reference/api/typescript.d.ts | 1 + 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index b4816f4c68814..fadb74243c60f 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -301,8 +301,7 @@ export function formatDiagnosticToProtocol(diag: Diagnostic, includeFileName: bo interface PendingErrorCheck { fileName: NormalizedPath; - ranges?: TextRange[]; - project?: Project; + project: Project; } function allEditsBeforePos(edits: readonly TextChange[], pos: number): boolean { @@ -1143,7 +1142,7 @@ export class Session implements EventSender { if (!this.suppressDiagnosticEvents && !this.noGetErrOnBackgroundUpdate) { this.projectService.logger.info(`Queueing diagnostics update for ${openFiles}`); // For now only queue error checking for open files. We can change this to include non open files as well - this.errorCheck.startNew(next => this.updateErrorCheck(next, mapDefined(openFiles, file => ({ fileName: toNormalizedPath(file) })), 100, /*requireOpen*/ true)); + this.errorCheck.startNew(next => this.updateErrorCheck(next, openFiles, 100, /*requireOpen*/ true)); } // Send project changed event @@ -1336,7 +1335,7 @@ export class Session implements EventSender { /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ private updateErrorCheck( next: NextStep, - checkList: PendingErrorCheck[], + checkList: PendingErrorCheck[] | (string | protocol.FileRangesRequestArgs)[], ms: number, requireOpen = true, ) { @@ -1363,8 +1362,7 @@ export class Session implements EventSender { } if (this.getPreferences(fileName).disableSuggestions) { - goNext(); - return; + return goNext(); } next.immediate("suggestionCheck", () => { this.suggestionCheck(fileName, project); @@ -1377,11 +1375,23 @@ export class Session implements EventSender { return; } - const { fileName, project = this.projectService.tryGetDefaultProjectForFile(fileName), ranges } = checkList[index]; - if (!project) { - return; + let ranges: protocol.FileRange[] | undefined; + let item: string | protocol.FileRangesRequestArgs | PendingErrorCheck | undefined = checkList[index]; + if (isString(item)) { + item = this.toPendingErrorCheck(item); + } + // eslint-disable-next-line local/no-in-operator + else if ("ranges" in item) { + ranges = item.ranges; + item = this.toPendingErrorCheck(item.file); } + if (!item) { + return goNext(); + } + + const { fileName, project } = item; + // Ensure the project is up to date before checking if this file is present in the project. updateProjectIfDirty(project); if (!project.containsFile(fileName, requireOpen)) { @@ -1395,13 +1405,15 @@ export class Session implements EventSender { // Don't provide semantic diagnostics unless we're in full semantic mode. if (project.projectService.serverMode !== LanguageServiceMode.Semantic) { - goNext(); - return; + return goNext(); } if (ranges) { return next.immediate("regionSemanticCheck", () => { - this.regionSemanticCheck(fileName, project, ranges); + const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(fileName); + if (scriptInfo) { + this.regionSemanticCheck(fileName, project, ranges.map(range => this.getRange({ file: fileName, ...range }, scriptInfo))); + } if (this.changeSeq !== seq) { return; } @@ -2560,28 +2572,19 @@ export class Session implements EventSender { } } + private toPendingErrorCheck(uncheckedFileName: string): PendingErrorCheck | undefined { + const fileName = toNormalizedPath(uncheckedFileName); + const project = this.projectService.tryGetDefaultProjectForFile(fileName); + return project && { fileName, project }; + } + private getDiagnostics(next: NextStep, delay: number, fileArgs: (string | protocol.FileRangesRequestArgs)[]): void { if (this.suppressDiagnosticEvents) { return; } if (fileArgs.length > 0) { - const files = mapDefined(fileArgs, fileArg => { - if (isString(fileArg)) { - return { fileName: toNormalizedPath(fileArg) }; - } - const fileName = toNormalizedPath(fileArg.file); - const scriptInfo = this.projectService.getScriptInfo(fileName); - if (!scriptInfo) { - return undefined; - } - const ranges = fileArg.ranges.map(range => this.getRange({ file: fileArg.file, ...range }, scriptInfo)); - return { - fileName, - ranges, - }; - }); - this.updateErrorCheck(next, files, delay); + this.updateErrorCheck(next, fileArgs, delay); } } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 4ed0b08db666a..e37b418358edf 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3548,6 +3548,7 @@ declare namespace ts { private getCompileOnSaveAffectedFileList; private emitFile; private getSignatureHelpItems; + private toPendingErrorCheck; private getDiagnostics; private change; private reload; From 5ed581a1ea7c90fd140370e4bb2297732497cfbb Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Thu, 13 Jun 2024 15:04:58 -0700 Subject: [PATCH 74/74] mark region threshold as internal --- src/server/session.ts | 1 + tests/baselines/reference/api/typescript.d.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/session.ts b/src/server/session.ts index fadb74243c60f..53657410b4b02 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -994,6 +994,7 @@ export class Session implements EventSender { private readonly noGetErrOnBackgroundUpdate?: boolean; // Minimum number of lines for attempting to use region diagnostics for a file. + /** @internal */ protected regionDiagLineCountThreshold = 500; constructor(opts: SessionOptions) { diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index e37b418358edf..44927b84409a2 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3455,7 +3455,6 @@ declare namespace ts { private suppressDiagnosticEvents?; private eventHandler; private readonly noGetErrOnBackgroundUpdate?; - protected regionDiagLineCountThreshold: number; constructor(opts: SessionOptions); private sendRequestCompletedEvent; private addPerformanceData;