From 36ab79292c6c013741902839a4c21a8bc0664c67 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 28 Jun 2024 12:53:40 -0700 Subject: [PATCH 1/2] Add test --- .../unittests/tsserver/projectErrors.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/testRunner/unittests/tsserver/projectErrors.ts b/src/testRunner/unittests/tsserver/projectErrors.ts index d5adbef939760..822a47b5881e3 100644 --- a/src/testRunner/unittests/tsserver/projectErrors.ts +++ b/src/testRunner/unittests/tsserver/projectErrors.ts @@ -1,5 +1,6 @@ import * as ts from "../../_namespaces/ts.js"; import { jsonToReadableText } from "../helpers.js"; +import { libContent } from "../helpers/contents.js"; import { baselineTsserverLogs, closeFilesForSession, @@ -833,3 +834,29 @@ describe("unittests:: tsserver:: projectErrors:: with file rename on wsl2::", () baselineTsserverLogs("projectErrors", "file rename on wsl2", session); }); }); + +describe("unittests:: tsserver:: projectErrors:: dts errors when files dont belong to common root", () => { + [undefined, "decls"].forEach(declarationDir => { + it(`dts errors when files dont belong to common root${declarationDir ? " with declarationDir" : ""}`, () => { + const host = createServerHost({ + "/home/src/projects/project/src/file.ts": `import { a } from "../a";`, + "/home/src/projects/project/a.ts": `export const a = 10;`, + "/home/src/projects/project/src/tsconfig.json": jsonToReadableText({ + compilerOptions: { + composite: true, + noEmit: true, + declarationDir, + }, + }), + [libFile.path]: libContent, + }); + const session = new TestSession(host); + openFilesForSession(["/home/src/projects/project/src/file.ts"], session); + verifyGetErrRequest({ + session, + files: ["/home/src/projects/project/src/file.ts"], + }); + baselineTsserverLogs("projectErrors", `dts errors when files dont belong to common root${declarationDir ? " with declarationDir" : ""}`, session); + }); + }); +}); From a42081ab689538850386344531ec4b67d8dfc7ef Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 28 Jun 2024 13:25:52 -0700 Subject: [PATCH 2/2] Delay the calculation of common source root if it would be needed when calculation dts files. Also report error if it would be used (declarationDir is specified) just like we do with outDir --- src/compiler/program.ts | 3 +- src/compiler/utilities.ts | 6 +- src/server/project.ts | 2 +- src/services/sourcemaps.ts | 2 +- ...long-to-common-root-with-declarationDir.js | 342 ++++++++++++++++++ ...s-when-files-dont-belong-to-common-root.js | 326 +++++++++++++++++ ...updates-to-redirect-info-when-requested.js | 26 +- 7 files changed, 676 insertions(+), 31 deletions(-) create mode 100644 tests/baselines/reference/tsserver/projectErrors/dts-errors-when-files-dont-belong-to-common-root-with-declarationDir.js create mode 100644 tests/baselines/reference/tsserver/projectErrors/dts-errors-when-files-dont-belong-to-common-root.js diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 0b26847b20b12..d47c0f2a2dd64 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -4441,7 +4441,8 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg options.outDir || // there is --outDir specified options.rootDir || // there is --rootDir specified options.sourceRoot || // there is --sourceRoot specified - options.mapRoot // there is --mapRoot specified + options.mapRoot || // there is --mapRoot specified + (getEmitDeclarations(options) && options.declarationDir) // there is --declarationDir specified ) { // Precalculate and cache the common source directory const dir = getCommonSourceDirectory(); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ea61f17250ce3..1b972e990f7fb 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -6315,15 +6315,15 @@ export function getOwnEmitOutputFilePath(fileName: string, host: EmitHost, exten /** @internal */ export function getDeclarationEmitOutputFilePath(fileName: string, host: EmitHost) { - return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host.getCurrentDirectory(), host.getCommonSourceDirectory(), f => host.getCanonicalFileName(f)); + return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host); } /** @internal */ -export function getDeclarationEmitOutputFilePathWorker(fileName: string, options: CompilerOptions, currentDirectory: string, commonSourceDirectory: string, getCanonicalFileName: GetCanonicalFileName): string { +export function getDeclarationEmitOutputFilePathWorker(fileName: string, options: CompilerOptions, host: Pick): string { const outputDir = options.declarationDir || options.outDir; // Prefer declaration folder if specified const path = outputDir - ? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName) + ? getSourceFilePathInNewDirWorker(fileName, outputDir, host.getCurrentDirectory(), host.getCommonSourceDirectory(), f => host.getCanonicalFileName(f)) : fileName; const declarationExtension = getDeclarationEmitExtensionForPath(path); return removeFileExtension(path) + declarationExtension; diff --git a/src/server/project.ts b/src/server/project.ts index 3622b83c1fa31..1dc5b9b93be09 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1699,7 +1699,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo !sourceFile || sourceFile.resolvedPath !== source || !this.isValidGeneratedFileWatcher( - getDeclarationEmitOutputFilePathWorker(sourceFile.fileName, this.compilerOptions, this.currentDirectory, this.program!.getCommonSourceDirectory(), this.getCanonicalFileName), + getDeclarationEmitOutputFilePathWorker(sourceFile.fileName, this.compilerOptions, this.program!), watcher, ) ) { diff --git a/src/services/sourcemaps.ts b/src/services/sourcemaps.ts index 954616d3f0317..dffc7f51ea8e4 100644 --- a/src/services/sourcemaps.ts +++ b/src/services/sourcemaps.ts @@ -117,7 +117,7 @@ export function getSourceMapper(host: SourceMapperHost): SourceMapper { const declarationPath = outPath ? removeFileExtension(outPath) + Extension.Dts : - getDeclarationEmitOutputFilePathWorker(info.fileName, program.getCompilerOptions(), currentDirectory, program.getCommonSourceDirectory(), getCanonicalFileName); + getDeclarationEmitOutputFilePathWorker(info.fileName, program.getCompilerOptions(), program); if (declarationPath === undefined) return undefined; const newLoc = getDocumentPositionMapper(declarationPath, info.fileName).getGeneratedPosition(info); diff --git a/tests/baselines/reference/tsserver/projectErrors/dts-errors-when-files-dont-belong-to-common-root-with-declarationDir.js b/tests/baselines/reference/tsserver/projectErrors/dts-errors-when-files-dont-belong-to-common-root-with-declarationDir.js new file mode 100644 index 0000000000000..11fc66981f090 --- /dev/null +++ b/tests/baselines/reference/tsserver/projectErrors/dts-errors-when-files-dont-belong-to-common-root-with-declarationDir.js @@ -0,0 +1,342 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +Before request +//// [/home/src/projects/project/src/file.ts] +import { a } from "../a"; + +//// [/home/src/projects/project/a.ts] +export const a = 10; + +//// [/home/src/projects/project/src/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "noEmit": true, + "declarationDir": "decls" + } +} + +//// [/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; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/home/src/projects/project/src/file.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /home/src/projects/project/src/file.ts ProjectRootPath: undefined:: Result: /home/src/projects/project/src/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /home/src/projects/project/src/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/projects/project/src/tsconfig.json 2000 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/home/src/projects/project/src/tsconfig.json", + "reason": "Creating possible configured project for /home/src/projects/project/src/file.ts to open" + } + } +Info seq [hh:mm:ss:mss] Config: /home/src/projects/project/src/tsconfig.json : { + "rootNames": [ + "/home/src/projects/project/src/file.ts" + ], + "options": { + "composite": true, + "noEmit": true, + "declarationDir": "/home/src/projects/project/src/decls", + "configFilePath": "/home/src/projects/project/src/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/src 1 undefined Config: /home/src/projects/project/src/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/src 1 undefined Config: /home/src/projects/project/src/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /home/src/projects/project/src/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/projects/project/a.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] DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/src/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/src/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /home/src/projects/project/src/tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/home/src/projects/project/src/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + /home/src/projects/project/a.ts Text-1 "export const a = 10;" + /home/src/projects/project/src/file.ts SVC-1-0 "import { a } from \"../a\";" + + + ../../../../../a/lib/lib.d.ts + Default library for target 'es5' + ../a.ts + Imported via "../a" from file 'file.ts' + file.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": "/home/src/projects/project/src/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "telemetry", + "body": { + "telemetryEventName": "projectInfo", + "payload": { + "projectId": "33e5039724fdc4e442f7c0bd4742657476d029f410f9e48ec2da0feff3f20575", + "fileStats": { + "js": 0, + "jsSize": 0, + "jsx": 0, + "jsxSize": 0, + "ts": 2, + "tsSize": 45, + "tsx": 0, + "tsxSize": 0, + "dts": 1, + "dtsSize": 413, + "deferred": 0, + "deferredSize": 0 + }, + "compilerOptions": { + "composite": true, + "noEmit": true, + "declarationDir": "" + }, + "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": "/home/src/projects/project/src/file.ts", + "configFile": "/home/src/projects/project/src/tsconfig.json", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /home/src/projects/project/src/tsconfig.json ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Project '/home/src/projects/project/src/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /home/src/projects/project/src/file.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /home/src/projects/project/src/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "open", + "request_seq": 1, + "success": true, + "performanceData": { + "updateGraphDurationMs": * + } + } +After request + +PolledWatches:: +/home/src/projects/node_modules/@types: *new* + {"pollingInterval":500} +/home/src/projects/project/node_modules/@types: *new* + {"pollingInterval":500} +/home/src/projects/project/src/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/a/lib/lib.d.ts: *new* + {} +/home/src/projects/project/a.ts: *new* + {} +/home/src/projects/project/src/tsconfig.json: *new* + {} + +FsWatchesRecursive:: +/home/src/projects/project/src: *new* + {} + +Projects:: +/home/src/projects/project/src/tsconfig.json (Configured) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/a/lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /home/src/projects/project/src/tsconfig.json +/home/src/projects/project/a.ts *new* + version: Text-1 + containingProjects: 1 + /home/src/projects/project/src/tsconfig.json +/home/src/projects/project/src/file.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /home/src/projects/project/src/tsconfig.json *default* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "geterr", + "arguments": { + "delay": 0, + "files": [ + "/home/src/projects/project/src/file.ts" + ] + }, + "seq": 2, + "type": "request" + } +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": "/home/src/projects/project/src/file.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +1: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +1: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/home/src/projects/project/src/file.ts", + "diagnostics": [ + { + "start": { + "line": 1, + "offset": 19 + }, + "end": { + "line": 1, + "offset": 25 + }, + "text": "File '/home/src/projects/project/a.ts' is not under 'rootDir' '/home/src/projects/project/src'. 'rootDir' is expected to contain all source files.", + "code": 6059, + "category": "error" + }, + { + "start": { + "line": 1, + "offset": 19 + }, + "end": { + "line": 1, + "offset": 25 + }, + "text": "File '/home/src/projects/project/a.ts' is not listed within the file list of project '/home/src/projects/project/src/tsconfig.json'. Projects must list all files or use an 'include' pattern.", + "code": 6307, + "category": "error" + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +2: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +2: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/home/src/projects/project/src/file.ts", + "diagnostics": [ + { + "start": { + "line": 1, + "offset": 1 + }, + "end": { + "line": 1, + "offset": 26 + }, + "text": "'a' is declared but its value is never read.", + "code": 6133, + "category": "suggestion", + "reportsUnnecessary": true + } + ], + "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/projectErrors/dts-errors-when-files-dont-belong-to-common-root.js b/tests/baselines/reference/tsserver/projectErrors/dts-errors-when-files-dont-belong-to-common-root.js new file mode 100644 index 0000000000000..aeb03739c32b6 --- /dev/null +++ b/tests/baselines/reference/tsserver/projectErrors/dts-errors-when-files-dont-belong-to-common-root.js @@ -0,0 +1,326 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/typesMap.json" doesn't exist +Before request +//// [/home/src/projects/project/src/file.ts] +import { a } from "../a"; + +//// [/home/src/projects/project/a.ts] +export const a = 10; + +//// [/home/src/projects/project/src/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "noEmit": true + } +} + +//// [/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; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/home/src/projects/project/src/file.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /home/src/projects/project/src/file.ts ProjectRootPath: undefined:: Result: /home/src/projects/project/src/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /home/src/projects/project/src/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/projects/project/src/tsconfig.json 2000 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/home/src/projects/project/src/tsconfig.json", + "reason": "Creating possible configured project for /home/src/projects/project/src/file.ts to open" + } + } +Info seq [hh:mm:ss:mss] Config: /home/src/projects/project/src/tsconfig.json : { + "rootNames": [ + "/home/src/projects/project/src/file.ts" + ], + "options": { + "composite": true, + "noEmit": true, + "configFilePath": "/home/src/projects/project/src/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/src 1 undefined Config: /home/src/projects/project/src/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/src 1 undefined Config: /home/src/projects/project/src/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /home/src/projects/project/src/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/projects/project/a.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] DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/src/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/src/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/project/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/src/projects/node_modules/@types 1 undefined Project: /home/src/projects/project/src/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /home/src/projects/project/src/tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/home/src/projects/project/src/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /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; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + /home/src/projects/project/a.ts Text-1 "export const a = 10;" + /home/src/projects/project/src/file.ts SVC-1-0 "import { a } from \"../a\";" + + + ../../../../../a/lib/lib.d.ts + Default library for target 'es5' + ../a.ts + Imported via "../a" from file 'file.ts' + file.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": "/home/src/projects/project/src/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "telemetry", + "body": { + "telemetryEventName": "projectInfo", + "payload": { + "projectId": "33e5039724fdc4e442f7c0bd4742657476d029f410f9e48ec2da0feff3f20575", + "fileStats": { + "js": 0, + "jsSize": 0, + "jsx": 0, + "jsxSize": 0, + "ts": 2, + "tsSize": 45, + "tsx": 0, + "tsxSize": 0, + "dts": 1, + "dtsSize": 413, + "deferred": 0, + "deferredSize": 0 + }, + "compilerOptions": { + "composite": true, + "noEmit": 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": "/home/src/projects/project/src/file.ts", + "configFile": "/home/src/projects/project/src/tsconfig.json", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /home/src/projects/project/src/tsconfig.json ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Project '/home/src/projects/project/src/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /home/src/projects/project/src/file.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /home/src/projects/project/src/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "seq": 0, + "type": "response", + "command": "open", + "request_seq": 1, + "success": true, + "performanceData": { + "updateGraphDurationMs": * + } + } +After request + +PolledWatches:: +/home/src/projects/node_modules/@types: *new* + {"pollingInterval":500} +/home/src/projects/project/node_modules/@types: *new* + {"pollingInterval":500} +/home/src/projects/project/src/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/a/lib/lib.d.ts: *new* + {} +/home/src/projects/project/a.ts: *new* + {} +/home/src/projects/project/src/tsconfig.json: *new* + {} + +FsWatchesRecursive:: +/home/src/projects/project/src: *new* + {} + +Projects:: +/home/src/projects/project/src/tsconfig.json (Configured) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + +ScriptInfos:: +/a/lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /home/src/projects/project/src/tsconfig.json +/home/src/projects/project/a.ts *new* + version: Text-1 + containingProjects: 1 + /home/src/projects/project/src/tsconfig.json +/home/src/projects/project/src/file.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /home/src/projects/project/src/tsconfig.json *default* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "geterr", + "arguments": { + "delay": 0, + "files": [ + "/home/src/projects/project/src/file.ts" + ] + }, + "seq": 2, + "type": "request" + } +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": "/home/src/projects/project/src/file.ts", + "diagnostics": [], + "duration": * + } + } +After running Timeout callback:: count: 0 + +Immedidate callback:: count: 1 +1: semanticCheck *new* + +Before running Immedidate callback:: count: 1 +1: semanticCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "semanticDiag", + "body": { + "file": "/home/src/projects/project/src/file.ts", + "diagnostics": [ + { + "start": { + "line": 1, + "offset": 19 + }, + "end": { + "line": 1, + "offset": 25 + }, + "text": "File '/home/src/projects/project/a.ts' is not listed within the file list of project '/home/src/projects/project/src/tsconfig.json'. Projects must list all files or use an 'include' pattern.", + "code": 6307, + "category": "error" + } + ], + "duration": * + } + } +After running Immedidate callback:: count: 1 + +Immedidate callback:: count: 1 +2: suggestionCheck *new* + +Before running Immedidate callback:: count: 1 +2: suggestionCheck + +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "suggestionDiag", + "body": { + "file": "/home/src/projects/project/src/file.ts", + "diagnostics": [ + { + "start": { + "line": 1, + "offset": 1 + }, + "end": { + "line": 1, + "offset": 26 + }, + "text": "'a' is declared but its value is never read.", + "code": 6133, + "category": "suggestion", + "reportsUnnecessary": true + } + ], + "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/projects/synchronizeProjectList-provides-updates-to-redirect-info-when-requested.js b/tests/baselines/reference/tsserver/projects/synchronizeProjectList-provides-updates-to-redirect-info-when-requested.js index 3e954d1fc415f..a878186fe16e8 100644 --- a/tests/baselines/reference/tsserver/projects/synchronizeProjectList-provides-updates-to-redirect-info-when-requested.js +++ b/tests/baselines/reference/tsserver/projects/synchronizeProjectList-provides-updates-to-redirect-info-when-requested.js @@ -717,31 +717,7 @@ Info seq [hh:mm:ss:mss] event: "body": { "triggerFile": "/users/username/projects/project/A/tsconfig.json", "configFile": "/users/username/projects/project/A/tsconfig.json", - "diagnostics": [ - { - "text": "File '/users/username/projects/project/B/b2.ts' is not under 'rootDir' '/users/username/projects/project/A'. 'rootDir' is expected to contain all source files.\n The file is in the program because:\n Matched by include pattern '../B/b2.ts' in '/users/username/projects/project/A/tsconfig.json'", - "code": 6059, - "category": "error", - "relatedInformation": [ - { - "span": { - "start": { - "line": 8, - "offset": 7 - }, - "end": { - "line": 8, - "offset": 19 - }, - "file": "/users/username/projects/project/A/tsconfig.json" - }, - "message": "File is matched by include pattern specified here.", - "category": "message", - "code": 1408 - } - ] - } - ] + "diagnostics": [] } } Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /users/username/projects/project/B/tsconfig.json