diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 023013b64b641..910becfce68d7 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -4379,7 +4379,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 2e76fbf4f6f73..8599c2693ced4 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -6345,15 +6345,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 a851b346813a0..8dcbd6fe323af 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1622,7 +1622,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/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); + }); + }); +}); 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..33b136852a092 --- /dev/null +++ b/tests/baselines/reference/tsserver/projectErrors/dts-errors-when-files-dont-belong-to-common-root-with-declarationDir.js @@ -0,0 +1,336 @@ +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: + { + "responseRequired": false + } +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" + } +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": "/home/src/projects/project/src/file.ts", + "diagnostics": [] + } + } +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" + } + ] + } + } +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 + } + ] + } + } +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..ab8b63358ab0f --- /dev/null +++ b/tests/baselines/reference/tsserver/projectErrors/dts-errors-when-files-dont-belong-to-common-root.js @@ -0,0 +1,320 @@ +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: + { + "responseRequired": false + } +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" + } +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": "/home/src/projects/project/src/file.ts", + "diagnostics": [] + } + } +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" + } + ] + } + } +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 + } + ] + } + } +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 2a14b83336166..0a1af0eb4c425 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 @@ -703,31 +703,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