From 11ebae9a8cd0ad8c9d5dbd615539497e072fa7e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Thu, 19 Sep 2024 11:15:37 +0200 Subject: [PATCH 1/7] Add source mappings for serialized properties with available declaration --- src/compiler/checker.ts | 7 +- .../helpers/virtualFileSystemWithWatch.ts | 7 +- .../tsserver/projectReferencesSourcemap.ts | 78 ++- ...e-of-a-property-with-mapped-type-origin.js | 517 ++++++++++++++++ ...e-of-a-property-with-mapped-type-origin.js | 482 +++++++++++++++ ...e-of-a-property-with-mapped-type-origin.js | 553 ++++++++++++++++++ 6 files changed, 1627 insertions(+), 17 deletions(-) create mode 100644 tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/configHasNoReference/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js create mode 100644 tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/configWithReference/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js create mode 100644 tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/disabledSourceRef/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 438e46eca11b6..6f735dae9cce2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -985,6 +985,7 @@ import { setNodeFlags, setOriginalNode, setParent, + setSourceMapRange, setSyntheticLeadingComments, setTextRange as setTextRangeWorker, setTextRangePosEnd, @@ -7174,8 +7175,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { context.tracker.reportNonSerializableProperty(symbolToString(propertySymbol)); } } - context.enclosingDeclaration = propertySymbol.valueDeclaration || propertySymbol.declarations?.[0] || saveEnclosingDeclaration; + const propertyDeclaration = propertySymbol.valueDeclaration || propertySymbol.declarations?.[0]; + context.enclosingDeclaration = propertyDeclaration || saveEnclosingDeclaration; const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context); + if (propertyDeclaration && (isPropertyAssignment(propertyDeclaration) || isShorthandPropertyAssignment(propertyDeclaration) || isMethodDeclaration(propertyDeclaration) || isMethodSignature(propertyDeclaration) || isPropertySignature(propertyDeclaration) || isPropertyDeclaration(propertyDeclaration) || isGetOrSetAccessorDeclaration(propertyDeclaration))) { + setSourceMapRange(propertyName, propertyDeclaration.name); + } context.enclosingDeclaration = saveEnclosingDeclaration; context.approximateLength += symbolName(propertySymbol).length + 1; diff --git a/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts index f4cd771c092d4..48545818a1744 100644 --- a/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts @@ -1158,7 +1158,12 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, // base folder has to be present const base = getDirectoryPath(file.path); - const folder = Debug.checkDefined(this.getRealFolder(base)); + const folder = this.getRealFolder(base); + // this line can throw on purpose, don't use Debug.assert to avoid redundant debugger hits + // eslint-disable-next-line no-restricted-syntax + if (folder === null || folder === undefined) { + throw new Error(`Directory not found: ${base}`); + } if (folder.path === base) { if (!this.fs.has(file.path)) { diff --git a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts index 5423b784a39bd..a6bd13dd7305d 100644 --- a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts +++ b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts @@ -1,4 +1,5 @@ import * as ts from "../../_namespaces/ts.js"; +import { dedent } from "../../_namespaces/Utils.js"; import { jsonToReadableText } from "../helpers.js"; import { baselineTsserverLogs, @@ -14,11 +15,11 @@ import { } from "../helpers/virtualFileSystemWithWatch.js"; describe("unittests:: tsserver:: projectReferencesSourcemap:: with project references and tsbuild source map", () => { - const dependecyLocation = `/user/username/projects/myproject/dependency`; - const dependecyDeclsLocation = `/user/username/projects/myproject/decls`; + const dependencyLocation = `/user/username/projects/myproject/dependency`; + const dependencyDeclsLocation = `/user/username/projects/myproject/decls`; const mainLocation = `/user/username/projects/myproject/main`; const dependencyTs: File = { - path: `${dependecyLocation}/FnS.ts`, + path: `${dependencyLocation}/FnS.ts`, content: `export function fn1() { } export function fn2() { } export function fn3() { } @@ -27,7 +28,7 @@ export function fn5() { } `, }; const dependencyConfig: File = { - path: `${dependecyLocation}/tsconfig.json`, + path: `${dependencyLocation}/tsconfig.json`, content: jsonToReadableText({ compilerOptions: { composite: true, declarationMap: true, declarationDir: "../decls" } }), }; @@ -64,8 +65,8 @@ fn5(); path: `/user/username/projects/myproject/random/tsconfig.json`, content: "{}", }; - const dtsLocation = `${dependecyDeclsLocation}/FnS.d.ts`; - const dtsMapLocation = `${dependecyDeclsLocation}/FnS.d.ts.map`; + const dtsLocation = `${dependencyDeclsLocation}/FnS.d.ts`; + const dtsMapLocation = `${dependencyDeclsLocation}/FnS.d.ts.map`; const files = [dependencyTs, dependencyConfig, mainTs, mainConfig, randomFile, randomConfig]; @@ -142,7 +143,7 @@ fn5(); } type OnHostCreate = (host: TestServerHost) => void; - function createSessionWithoutProjectReferences(onHostCreate?: OnHostCreate) { + function createSessionWithoutProjectReferences(files: File[], onHostCreate?: OnHostCreate) { const host = createHostWithSolutionBuild(files, [mainConfig.path]); // Erase project reference writeConfigWithoutProjectReferences(host); @@ -159,13 +160,13 @@ fn5(); ); } - function createSessionWithProjectReferences(onHostCreate?: OnHostCreate) { + function createSessionWithProjectReferences(files: File[], onHostCreate?: OnHostCreate) { const host = createHostWithSolutionBuild(files, [mainConfig.path]); onHostCreate?.(host); return new TestSession(host); } - function createSessionWithDisabledProjectReferences(onHostCreate?: OnHostCreate) { + function createSessionWithDisabledProjectReferences(files: File[], onHostCreate?: OnHostCreate) { const host = createHostWithSolutionBuild(files, [mainConfig.path]); // Erase project reference WithDisabledProjectReferences(host); @@ -227,16 +228,16 @@ fn5(); }); } - function createSession(type: SessionType, onHostCreate?: OnHostCreate) { - return type === SessionType.NoReference ? createSessionWithoutProjectReferences(onHostCreate) : - type === SessionType.ProjectReference ? createSessionWithProjectReferences(onHostCreate) : + function createSession(type: SessionType, files: File[], onHostCreate?: OnHostCreate) { + return type === SessionType.NoReference ? createSessionWithoutProjectReferences(files, onHostCreate) : + type === SessionType.ProjectReference ? createSessionWithProjectReferences(files, onHostCreate) : type === SessionType.DisableSourceOfProjectReferenceRedirect ? - createSessionWithDisabledProjectReferences(onHostCreate) : + createSessionWithDisabledProjectReferences(files, onHostCreate) : ts.Debug.assertNever(type); } function setup(type: SessionType, openFiles: readonly File[], action: Action | Action[], max?: number, onHostCreate?: OnHostCreate) { - const session = createSession(type, onHostCreate); + const session = createSession(type, files, onHostCreate); openFilesForSession(openFiles, session); runActions(session, action, max); return session; @@ -510,7 +511,7 @@ fn5(); verifyForAllSessionTypes(type => { it("goto Definition in usage and rename locations, deleting config file", () => { - const session = createSession(type); + const session = createSession(type, files); openFilesForSession([mainTs], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.Rename, @@ -549,4 +550,51 @@ fn5(); }); }, /*options*/ undefined); }); + + verifyForAllSessionTypes(type => { + it("goto Definition in usage of a property with mapped type origin", () => { + const dependencyTs: File = { + path: `${dependencyLocation}/api.ts`, + content: dedent` + type ValidateShape = { + [K in keyof T]: T[K]; + }; + + function getApi(arg: ValidateShape) { + function createCaller(arg: T): () => { + [K in keyof T]: () => T[K]; + } { + return null as any; + } + return { + createCaller: createCaller(arg), + }; + } + + const obj = getApi({ + foo: 1, + bar: "", + }); + + export const createCaller = obj.createCaller; + `, + }; + const mainTs: File = { + path: `${mainLocation}/main.ts`, + content: dedent` + import { createCaller } from "../decls/api"; + const caller = createCaller(); + caller.foo; + `, + }; + const files = [dependencyTs, dependencyConfig, mainTs, mainConfig]; + const session = createSession(type, files); + openFilesForSession([mainTs], session); + session.executeCommandSeq({ + command: ts.server.protocol.CommandTypes.DefinitionAndBoundSpan, + arguments: { file: mainTs.path, line: 3, offset: "caller.foo".length - 2 }, + }); + baselineTsserverLogs("projectReferencesSourcemap", `dependencyAndUsage/${type}/goto Definition in usage of a property with mapped type origin`, session); + }); + }, /*options*/ undefined); }); diff --git a/tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/configHasNoReference/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js b/tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/configHasNoReference/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js new file mode 100644 index 0000000000000..de93ed5c99312 --- /dev/null +++ b/tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/configHasNoReference/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js @@ -0,0 +1,517 @@ +Info seq [hh:mm:ss:mss] currentDirectory:: /home/src/Vscode/Projects/bin useCaseSensitiveFileNames:: false +Info seq [hh:mm:ss:mss] libs Location:: /home/src/tslibs/TS/Lib +Info seq [hh:mm:ss:mss] globalTypingsCacheLocation:: /home/src/Library/Caches/typescript +Info seq [hh:mm:ss:mss] Provided types map file "/home/src/tslibs/TS/Lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/dependency/api.ts] +type ValidateShape = { + [K in keyof T]: T[K]; +}; + +function getApi(arg: ValidateShape) { + function createCaller(arg: T): () => { + [K in keyof T]: () => T[K]; + } { + return null as any; + } + return { + createCaller: createCaller(arg), + }; +} + +const obj = getApi({ + foo: 1, + bar: "", +}); + +export const createCaller = obj.createCaller; + + +//// [/user/username/projects/myproject/dependency/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declarationMap": true, + "declarationDir": "../decls" + } +} + +//// [/user/username/projects/myproject/main/main.ts] +import { createCaller } from "../decls/api"; +const caller = createCaller(); +caller.foo; + + +//// [/user/username/projects/myproject/main/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declarationMap": true + } +} + +//// [/home/src/tslibs/TS/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; }; + +//// [/user/username/projects/myproject/dependency/api.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createCaller = void 0; +function getApi(arg) { + function createCaller(arg) { + return null; + } + return { + createCaller: createCaller(arg), + }; +} +var obj = getApi({ + foo: 1, + bar: "", +}); +exports.createCaller = obj.createCaller; + + +//// [/user/username/projects/myproject/decls/api.d.ts.map] +{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../dependency/api.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,YAAY;IAJrB,GAAG;IACH,GAAG;CAGqC,CAAC"} + +//// [/user/username/projects/myproject/decls/api.d.ts] +export declare const createCaller: () => { + foo: () => number; + bar: () => string; +}; +//# sourceMappingURL=api.d.ts.map + +//// [/user/username/projects/myproject/dependency/tsconfig.tsbuildinfo] +{"fileNames":["../../../../../home/src/tslibs/ts/lib/lib.d.ts","./api.ts"],"fileInfos":[{"version":"3858781397-/// \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; };","affectsGlobalScope":true},{"version":"-16529739457-type ValidateShape = {\n [K in keyof T]: T[K];\n};\n\nfunction getApi(arg: ValidateShape) {\n function createCaller(arg: T): () => {\n [K in keyof T]: () => T[K];\n } {\n return null as any;\n }\n return {\n createCaller: createCaller(arg),\n };\n}\n\nconst obj = getApi({\n foo: 1,\n bar: \"\",\n});\n\nexport const createCaller = obj.createCaller;\n","signature":"23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n"}],"root":[2],"options":{"composite":true,"declarationDir":"../decls","declarationMap":true},"latestChangedDtsFile":"../decls/api.d.ts","version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/dependency/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "fileNames": [ + "../../../../../home/src/tslibs/ts/lib/lib.d.ts", + "./api.ts" + ], + "fileInfos": { + "../../../../../home/src/tslibs/ts/lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "version": "3858781397-/// \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; };", + "signature": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "./api.ts": { + "original": { + "version": "-16529739457-type ValidateShape = {\n [K in keyof T]: T[K];\n};\n\nfunction getApi(arg: ValidateShape) {\n function createCaller(arg: T): () => {\n [K in keyof T]: () => T[K];\n } {\n return null as any;\n }\n return {\n createCaller: createCaller(arg),\n };\n}\n\nconst obj = getApi({\n foo: 1,\n bar: \"\",\n});\n\nexport const createCaller = obj.createCaller;\n", + "signature": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n" + }, + "version": "-16529739457-type ValidateShape = {\n [K in keyof T]: T[K];\n};\n\nfunction getApi(arg: ValidateShape) {\n function createCaller(arg: T): () => {\n [K in keyof T]: () => T[K];\n } {\n return null as any;\n }\n return {\n createCaller: createCaller(arg),\n };\n}\n\nconst obj = getApi({\n foo: 1,\n bar: \"\",\n});\n\nexport const createCaller = obj.createCaller;\n", + "signature": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n" + } + }, + "root": [ + [ + 2, + "./api.ts" + ] + ], + "options": { + "composite": true, + "declarationDir": "../decls", + "declarationMap": true + }, + "latestChangedDtsFile": "../decls/api.d.ts", + "version": "FakeTSVersion", + "size": 1286 +} + +//// [/user/username/projects/myproject/main/main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var api_1 = require("../decls/api"); +var caller = (0, api_1.createCaller)(); +caller.foo; + + +//// [/user/username/projects/myproject/main/main.d.ts.map] +{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":""} + +//// [/user/username/projects/myproject/main/main.d.ts] +export {}; +//# sourceMappingURL=main.d.ts.map + +//// [/user/username/projects/myproject/main/tsconfig.tsbuildinfo] +{"fileNames":["../../../../../home/src/tslibs/ts/lib/lib.d.ts","../decls/api.d.ts","./main.ts"],"fileIdsList":[[2]],"fileInfos":[{"version":"3858781397-/// \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; };","affectsGlobalScope":true},"23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n",{"version":"-4091673735-import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n","signature":"-3531856636-export {};\n"}],"root":[3],"options":{"composite":true,"declarationMap":true},"referencedMap":[[3,1]],"latestChangedDtsFile":"./main.d.ts","version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/main/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "fileNames": [ + "../../../../../home/src/tslibs/ts/lib/lib.d.ts", + "../decls/api.d.ts", + "./main.ts" + ], + "fileIdsList": [ + [ + "../decls/api.d.ts" + ] + ], + "fileInfos": { + "../../../../../home/src/tslibs/ts/lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "version": "3858781397-/// \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; };", + "signature": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "../decls/api.d.ts": { + "version": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n", + "signature": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n" + }, + "./main.ts": { + "original": { + "version": "-4091673735-import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n", + "signature": "-3531856636-export {};\n" + }, + "version": "-4091673735-import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n", + "signature": "-3531856636-export {};\n" + } + }, + "root": [ + [ + 3, + "./main.ts" + ] + ], + "options": { + "composite": true, + "declarationMap": true + }, + "referencedMap": { + "./main.ts": [ + "../decls/api.d.ts" + ] + }, + "latestChangedDtsFile": "./main.d.ts", + "version": "FakeTSVersion", + "size": 1028 +} + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/main/main.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /user/username/projects/myproject/main/main.ts ProjectRootPath: undefined:: Result: /user/username/projects/myproject/main/tsconfig.json +Info seq [hh:mm:ss:mss] Creating ConfiguredProject: /user/username/projects/myproject/main/tsconfig.json, currentDirectory: /user/username/projects/myproject/main +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/user/username/projects/myproject/main/tsconfig.json", + "reason": "Creating possible configured project for /user/username/projects/myproject/main/main.ts to open" + } + } +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/main/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/main/main.ts" + ], + "options": { + "composite": true, + "declarationMap": true, + "configFilePath": "/user/username/projects/myproject/main/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main 1 undefined Config: /user/username/projects/myproject/main/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main 1 undefined Config: /user/username/projects/myproject/main/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/main/tsconfig.json +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/decls 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/decls 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/decls/api.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/tslibs/TS/Lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/main/tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/main/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /home/src/tslibs/TS/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; };" + /user/username/projects/myproject/decls/api.d.ts Text-1 "export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n//# sourceMappingURL=api.d.ts.map" + /user/username/projects/myproject/main/main.ts SVC-1-0 "import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n" + + + ../../../../../home/src/tslibs/TS/Lib/lib.d.ts + Default library for target 'es5' + ../decls/api.d.ts + Imported via "../decls/api" from file 'main.ts' + main.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": "/user/username/projects/myproject/main/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "telemetry", + "body": { + "telemetryEventName": "projectInfo", + "payload": { + "projectId": "725f5b69066c57a96b52ceff33e6f8ba051a781bb82cf6869a874428cad2bf97", + "fileStats": { + "js": 0, + "jsSize": 0, + "jsx": 0, + "jsxSize": 0, + "ts": 1, + "tsSize": 88, + "tsx": 0, + "tsxSize": 0, + "dts": 2, + "dtsSize": 538, + "deferred": 0, + "deferredSize": 0 + }, + "compilerOptions": { + "composite": true, + "declarationMap": 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": "/user/username/projects/myproject/main/main.ts", + "configFile": "/user/username/projects/myproject/main/tsconfig.json", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /user/username/projects/myproject/main/tsconfig.json ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/main/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: /user/username/projects/myproject/main/main.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/main/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:: +/user/username/projects/myproject/main/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/home/src/tslibs/TS/Lib/lib.d.ts: *new* + {} +/user/username/projects/myproject/decls/api.d.ts: *new* + {} +/user/username/projects/myproject/main/tsconfig.json: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject/decls: *new* + {} +/user/username/projects/myproject/main: *new* + {} + +Projects:: +/user/username/projects/myproject/main/tsconfig.json (Configured) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + autoImportProviderHost: false + +ScriptInfos:: +/home/src/tslibs/TS/Lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json +/user/username/projects/myproject/decls/api.d.ts *new* + version: Text-1 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json +/user/username/projects/myproject/main/main.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json *default* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "definitionAndBoundSpan", + "arguments": { + "file": "/user/username/projects/myproject/main/main.ts", + "line": 3, + "offset": 8 + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/decls/api.d.ts.map 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/dependency/api.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] response: + { + "response": { + "definitions": [ + { + "file": "/user/username/projects/myproject/dependency/api.ts", + "start": { + "line": 17, + "offset": 5 + }, + "end": { + "line": 17, + "offset": 8 + }, + "contextStart": { + "line": 17, + "offset": 5 + }, + "contextEnd": { + "line": 18, + "offset": 5 + } + } + ], + "textSpan": { + "start": { + "line": 3, + "offset": 8 + }, + "end": { + "line": 3, + "offset": 11 + } + } + }, + "responseRequired": true + } +After request + +PolledWatches:: +/user/username/projects/myproject/main/node_modules/@types: + {"pollingInterval":500} +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} +/user/username/projects/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/home/src/tslibs/TS/Lib/lib.d.ts: + {} +/user/username/projects/myproject/decls/api.d.ts: + {} +/user/username/projects/myproject/decls/api.d.ts.map: *new* + {} +/user/username/projects/myproject/dependency/api.ts: *new* + {} +/user/username/projects/myproject/main/tsconfig.json: + {} + +FsWatchesRecursive:: +/user/username/projects/myproject/decls: + {} +/user/username/projects/myproject/main: + {} + +Projects:: +/user/username/projects/myproject/main/tsconfig.json (Configured) *changed* + projectStateVersion: 1 + projectProgramVersion: 1 + documentPositionMappers: 1 *changed* + /user/username/projects/myproject/decls/api.d.ts: DocumentPositionMapper1 *new* + autoImportProviderHost: false + +ScriptInfos:: +/home/src/tslibs/TS/Lib/lib.d.ts + version: Text-1 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json +/user/username/projects/myproject/decls/api.d.ts *changed* + version: Text-1 + sourceMapFilePath: /user/username/projects/myproject/decls/api.d.ts.map *changed* + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json +/user/username/projects/myproject/decls/api.d.ts.map *new* + version: Text-1 + declarationInfoPath: /user/username/projects/myproject/decls/api.d.ts + sourceInfos: 1 + /user/username/projects/myproject/dependency/api.ts + documentPositionMapper: DocumentPositionMapper1 + containingProjects: 0 +/user/username/projects/myproject/dependency/api.ts *new* + version: Text-1 + containingProjects: 0 +/user/username/projects/myproject/main/main.ts (Open) + version: SVC-1-0 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json *default* + +DocumentPositionMappers:: +DocumentPositionMapper1 *new* diff --git a/tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/configWithReference/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js b/tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/configWithReference/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js new file mode 100644 index 0000000000000..4def59109d7ec --- /dev/null +++ b/tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/configWithReference/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js @@ -0,0 +1,482 @@ +Info seq [hh:mm:ss:mss] currentDirectory:: /home/src/Vscode/Projects/bin useCaseSensitiveFileNames:: false +Info seq [hh:mm:ss:mss] libs Location:: /home/src/tslibs/TS/Lib +Info seq [hh:mm:ss:mss] globalTypingsCacheLocation:: /home/src/Library/Caches/typescript +Info seq [hh:mm:ss:mss] Provided types map file "/home/src/tslibs/TS/Lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/dependency/api.ts] +type ValidateShape = { + [K in keyof T]: T[K]; +}; + +function getApi(arg: ValidateShape) { + function createCaller(arg: T): () => { + [K in keyof T]: () => T[K]; + } { + return null as any; + } + return { + createCaller: createCaller(arg), + }; +} + +const obj = getApi({ + foo: 1, + bar: "", +}); + +export const createCaller = obj.createCaller; + + +//// [/user/username/projects/myproject/dependency/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declarationMap": true, + "declarationDir": "../decls" + } +} + +//// [/user/username/projects/myproject/main/main.ts] +import { createCaller } from "../decls/api"; +const caller = createCaller(); +caller.foo; + + +//// [/user/username/projects/myproject/main/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declarationMap": true + }, + "references": [ + { + "path": "../dependency" + } + ] +} + +//// [/home/src/tslibs/TS/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; }; + +//// [/user/username/projects/myproject/dependency/api.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createCaller = void 0; +function getApi(arg) { + function createCaller(arg) { + return null; + } + return { + createCaller: createCaller(arg), + }; +} +var obj = getApi({ + foo: 1, + bar: "", +}); +exports.createCaller = obj.createCaller; + + +//// [/user/username/projects/myproject/decls/api.d.ts.map] +{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../dependency/api.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,YAAY;IAJrB,GAAG;IACH,GAAG;CAGqC,CAAC"} + +//// [/user/username/projects/myproject/decls/api.d.ts] +export declare const createCaller: () => { + foo: () => number; + bar: () => string; +}; +//# sourceMappingURL=api.d.ts.map + +//// [/user/username/projects/myproject/dependency/tsconfig.tsbuildinfo] +{"fileNames":["../../../../../home/src/tslibs/ts/lib/lib.d.ts","./api.ts"],"fileInfos":[{"version":"3858781397-/// \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; };","affectsGlobalScope":true},{"version":"-16529739457-type ValidateShape = {\n [K in keyof T]: T[K];\n};\n\nfunction getApi(arg: ValidateShape) {\n function createCaller(arg: T): () => {\n [K in keyof T]: () => T[K];\n } {\n return null as any;\n }\n return {\n createCaller: createCaller(arg),\n };\n}\n\nconst obj = getApi({\n foo: 1,\n bar: \"\",\n});\n\nexport const createCaller = obj.createCaller;\n","signature":"23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n"}],"root":[2],"options":{"composite":true,"declarationDir":"../decls","declarationMap":true},"latestChangedDtsFile":"../decls/api.d.ts","version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/dependency/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "fileNames": [ + "../../../../../home/src/tslibs/ts/lib/lib.d.ts", + "./api.ts" + ], + "fileInfos": { + "../../../../../home/src/tslibs/ts/lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "version": "3858781397-/// \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; };", + "signature": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "./api.ts": { + "original": { + "version": "-16529739457-type ValidateShape = {\n [K in keyof T]: T[K];\n};\n\nfunction getApi(arg: ValidateShape) {\n function createCaller(arg: T): () => {\n [K in keyof T]: () => T[K];\n } {\n return null as any;\n }\n return {\n createCaller: createCaller(arg),\n };\n}\n\nconst obj = getApi({\n foo: 1,\n bar: \"\",\n});\n\nexport const createCaller = obj.createCaller;\n", + "signature": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n" + }, + "version": "-16529739457-type ValidateShape = {\n [K in keyof T]: T[K];\n};\n\nfunction getApi(arg: ValidateShape) {\n function createCaller(arg: T): () => {\n [K in keyof T]: () => T[K];\n } {\n return null as any;\n }\n return {\n createCaller: createCaller(arg),\n };\n}\n\nconst obj = getApi({\n foo: 1,\n bar: \"\",\n});\n\nexport const createCaller = obj.createCaller;\n", + "signature": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n" + } + }, + "root": [ + [ + 2, + "./api.ts" + ] + ], + "options": { + "composite": true, + "declarationDir": "../decls", + "declarationMap": true + }, + "latestChangedDtsFile": "../decls/api.d.ts", + "version": "FakeTSVersion", + "size": 1286 +} + +//// [/user/username/projects/myproject/main/main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var api_1 = require("../decls/api"); +var caller = (0, api_1.createCaller)(); +caller.foo; + + +//// [/user/username/projects/myproject/main/main.d.ts.map] +{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":""} + +//// [/user/username/projects/myproject/main/main.d.ts] +export {}; +//# sourceMappingURL=main.d.ts.map + +//// [/user/username/projects/myproject/main/tsconfig.tsbuildinfo] +{"fileNames":["../../../../../home/src/tslibs/ts/lib/lib.d.ts","../decls/api.d.ts","./main.ts"],"fileIdsList":[[2]],"fileInfos":[{"version":"3858781397-/// \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; };","affectsGlobalScope":true},"23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n",{"version":"-4091673735-import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n","signature":"-3531856636-export {};\n"}],"root":[3],"options":{"composite":true,"declarationMap":true},"referencedMap":[[3,1]],"latestChangedDtsFile":"./main.d.ts","version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/main/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "fileNames": [ + "../../../../../home/src/tslibs/ts/lib/lib.d.ts", + "../decls/api.d.ts", + "./main.ts" + ], + "fileIdsList": [ + [ + "../decls/api.d.ts" + ] + ], + "fileInfos": { + "../../../../../home/src/tslibs/ts/lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "version": "3858781397-/// \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; };", + "signature": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "../decls/api.d.ts": { + "version": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n", + "signature": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n" + }, + "./main.ts": { + "original": { + "version": "-4091673735-import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n", + "signature": "-3531856636-export {};\n" + }, + "version": "-4091673735-import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n", + "signature": "-3531856636-export {};\n" + } + }, + "root": [ + [ + 3, + "./main.ts" + ] + ], + "options": { + "composite": true, + "declarationMap": true + }, + "referencedMap": { + "./main.ts": [ + "../decls/api.d.ts" + ] + }, + "latestChangedDtsFile": "./main.d.ts", + "version": "FakeTSVersion", + "size": 1028 +} + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/main/main.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /user/username/projects/myproject/main/main.ts ProjectRootPath: undefined:: Result: /user/username/projects/myproject/main/tsconfig.json +Info seq [hh:mm:ss:mss] Creating ConfiguredProject: /user/username/projects/myproject/main/tsconfig.json, currentDirectory: /user/username/projects/myproject/main +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/user/username/projects/myproject/main/tsconfig.json", + "reason": "Creating possible configured project for /user/username/projects/myproject/main/main.ts to open" + } + } +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/main/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/main/main.ts" + ], + "options": { + "composite": true, + "declarationMap": true, + "configFilePath": "/user/username/projects/myproject/main/tsconfig.json" + }, + "projectReferences": [ + { + "path": "/user/username/projects/myproject/dependency", + "originalPath": "../dependency" + } + ] +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main 1 undefined Config: /user/username/projects/myproject/main/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main 1 undefined Config: /user/username/projects/myproject/main/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/main/tsconfig.json +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/dependency/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/dependency/api.ts" + ], + "options": { + "composite": true, + "declarationMap": true, + "declarationDir": "/user/username/projects/myproject/decls", + "configFilePath": "/user/username/projects/myproject/dependency/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/dependency/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/dependency 1 undefined Config: /user/username/projects/myproject/dependency/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/dependency 1 undefined Config: /user/username/projects/myproject/dependency/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/decls 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/decls 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/dependency/api.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/tslibs/TS/Lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/main/tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/main/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /home/src/tslibs/TS/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; };" + /user/username/projects/myproject/dependency/api.ts Text-1 "type ValidateShape = {\n [K in keyof T]: T[K];\n};\n\nfunction getApi(arg: ValidateShape) {\n function createCaller(arg: T): () => {\n [K in keyof T]: () => T[K];\n } {\n return null as any;\n }\n return {\n createCaller: createCaller(arg),\n };\n}\n\nconst obj = getApi({\n foo: 1,\n bar: \"\",\n});\n\nexport const createCaller = obj.createCaller;\n" + /user/username/projects/myproject/main/main.ts SVC-1-0 "import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n" + + + ../../../../../home/src/tslibs/TS/Lib/lib.d.ts + Default library for target 'es5' + ../dependency/api.ts + Imported via "../decls/api" from file 'main.ts' + main.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": "/user/username/projects/myproject/main/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "telemetry", + "body": { + "telemetryEventName": "projectInfo", + "payload": { + "projectId": "725f5b69066c57a96b52ceff33e6f8ba051a781bb82cf6869a874428cad2bf97", + "fileStats": { + "js": 0, + "jsSize": 0, + "jsx": 0, + "jsxSize": 0, + "ts": 2, + "tsSize": 473, + "tsx": 0, + "tsxSize": 0, + "dts": 1, + "dtsSize": 413, + "deferred": 0, + "deferredSize": 0 + }, + "compilerOptions": { + "composite": true, + "declarationMap": 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": "/user/username/projects/myproject/main/main.ts", + "configFile": "/user/username/projects/myproject/main/tsconfig.json", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /user/username/projects/myproject/main/tsconfig.json ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/main/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: /user/username/projects/myproject/main/main.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/main/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:: +/user/username/projects/myproject/main/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/home/src/tslibs/TS/Lib/lib.d.ts: *new* + {} +/user/username/projects/myproject/dependency/api.ts: *new* + {} +/user/username/projects/myproject/dependency/tsconfig.json: *new* + {} +/user/username/projects/myproject/main/tsconfig.json: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject/decls: *new* + {} +/user/username/projects/myproject/dependency: *new* + {} +/user/username/projects/myproject/main: *new* + {} + +Projects:: +/user/username/projects/myproject/main/tsconfig.json (Configured) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + autoImportProviderHost: false + +ScriptInfos:: +/home/src/tslibs/TS/Lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json +/user/username/projects/myproject/dependency/api.ts *new* + version: Text-1 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json +/user/username/projects/myproject/main/main.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json *default* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "definitionAndBoundSpan", + "arguments": { + "file": "/user/username/projects/myproject/main/main.ts", + "line": 3, + "offset": 8 + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + { + "response": { + "definitions": [ + { + "file": "/user/username/projects/myproject/dependency/api.ts", + "start": { + "line": 17, + "offset": 5 + }, + "end": { + "line": 17, + "offset": 8 + }, + "contextStart": { + "line": 17, + "offset": 5 + }, + "contextEnd": { + "line": 17, + "offset": 11 + } + } + ], + "textSpan": { + "start": { + "line": 3, + "offset": 8 + }, + "end": { + "line": 3, + "offset": 11 + } + } + }, + "responseRequired": true + } +After request diff --git a/tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/disabledSourceRef/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js b/tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/disabledSourceRef/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js new file mode 100644 index 0000000000000..9669792008719 --- /dev/null +++ b/tests/baselines/reference/tsserver/projectReferencesSourcemap/dependencyAndUsage/disabledSourceRef/goto-Definition-in-usage-of-a-property-with-mapped-type-origin.js @@ -0,0 +1,553 @@ +Info seq [hh:mm:ss:mss] currentDirectory:: /home/src/Vscode/Projects/bin useCaseSensitiveFileNames:: false +Info seq [hh:mm:ss:mss] libs Location:: /home/src/tslibs/TS/Lib +Info seq [hh:mm:ss:mss] globalTypingsCacheLocation:: /home/src/Library/Caches/typescript +Info seq [hh:mm:ss:mss] Provided types map file "/home/src/tslibs/TS/Lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/dependency/api.ts] +type ValidateShape = { + [K in keyof T]: T[K]; +}; + +function getApi(arg: ValidateShape) { + function createCaller(arg: T): () => { + [K in keyof T]: () => T[K]; + } { + return null as any; + } + return { + createCaller: createCaller(arg), + }; +} + +const obj = getApi({ + foo: 1, + bar: "", +}); + +export const createCaller = obj.createCaller; + + +//// [/user/username/projects/myproject/dependency/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declarationMap": true, + "declarationDir": "../decls" + } +} + +//// [/user/username/projects/myproject/main/main.ts] +import { createCaller } from "../decls/api"; +const caller = createCaller(); +caller.foo; + + +//// [/user/username/projects/myproject/main/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declarationMap": true, + "disableSourceOfProjectReferenceRedirect": true + }, + "references": [ + { + "path": "../dependency" + } + ] +} + +//// [/home/src/tslibs/TS/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; }; + +//// [/user/username/projects/myproject/dependency/api.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createCaller = void 0; +function getApi(arg) { + function createCaller(arg) { + return null; + } + return { + createCaller: createCaller(arg), + }; +} +var obj = getApi({ + foo: 1, + bar: "", +}); +exports.createCaller = obj.createCaller; + + +//// [/user/username/projects/myproject/decls/api.d.ts.map] +{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../dependency/api.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,YAAY;IAJrB,GAAG;IACH,GAAG;CAGqC,CAAC"} + +//// [/user/username/projects/myproject/decls/api.d.ts] +export declare const createCaller: () => { + foo: () => number; + bar: () => string; +}; +//# sourceMappingURL=api.d.ts.map + +//// [/user/username/projects/myproject/dependency/tsconfig.tsbuildinfo] +{"fileNames":["../../../../../home/src/tslibs/ts/lib/lib.d.ts","./api.ts"],"fileInfos":[{"version":"3858781397-/// \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; };","affectsGlobalScope":true},{"version":"-16529739457-type ValidateShape = {\n [K in keyof T]: T[K];\n};\n\nfunction getApi(arg: ValidateShape) {\n function createCaller(arg: T): () => {\n [K in keyof T]: () => T[K];\n } {\n return null as any;\n }\n return {\n createCaller: createCaller(arg),\n };\n}\n\nconst obj = getApi({\n foo: 1,\n bar: \"\",\n});\n\nexport const createCaller = obj.createCaller;\n","signature":"23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n"}],"root":[2],"options":{"composite":true,"declarationDir":"../decls","declarationMap":true},"latestChangedDtsFile":"../decls/api.d.ts","version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/dependency/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "fileNames": [ + "../../../../../home/src/tslibs/ts/lib/lib.d.ts", + "./api.ts" + ], + "fileInfos": { + "../../../../../home/src/tslibs/ts/lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "version": "3858781397-/// \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; };", + "signature": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "./api.ts": { + "original": { + "version": "-16529739457-type ValidateShape = {\n [K in keyof T]: T[K];\n};\n\nfunction getApi(arg: ValidateShape) {\n function createCaller(arg: T): () => {\n [K in keyof T]: () => T[K];\n } {\n return null as any;\n }\n return {\n createCaller: createCaller(arg),\n };\n}\n\nconst obj = getApi({\n foo: 1,\n bar: \"\",\n});\n\nexport const createCaller = obj.createCaller;\n", + "signature": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n" + }, + "version": "-16529739457-type ValidateShape = {\n [K in keyof T]: T[K];\n};\n\nfunction getApi(arg: ValidateShape) {\n function createCaller(arg: T): () => {\n [K in keyof T]: () => T[K];\n } {\n return null as any;\n }\n return {\n createCaller: createCaller(arg),\n };\n}\n\nconst obj = getApi({\n foo: 1,\n bar: \"\",\n});\n\nexport const createCaller = obj.createCaller;\n", + "signature": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n" + } + }, + "root": [ + [ + 2, + "./api.ts" + ] + ], + "options": { + "composite": true, + "declarationDir": "../decls", + "declarationMap": true + }, + "latestChangedDtsFile": "../decls/api.d.ts", + "version": "FakeTSVersion", + "size": 1286 +} + +//// [/user/username/projects/myproject/main/main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var api_1 = require("../decls/api"); +var caller = (0, api_1.createCaller)(); +caller.foo; + + +//// [/user/username/projects/myproject/main/main.d.ts.map] +{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":""} + +//// [/user/username/projects/myproject/main/main.d.ts] +export {}; +//# sourceMappingURL=main.d.ts.map + +//// [/user/username/projects/myproject/main/tsconfig.tsbuildinfo] +{"fileNames":["../../../../../home/src/tslibs/ts/lib/lib.d.ts","../decls/api.d.ts","./main.ts"],"fileIdsList":[[2]],"fileInfos":[{"version":"3858781397-/// \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; };","affectsGlobalScope":true},"23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n",{"version":"-4091673735-import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n","signature":"-3531856636-export {};\n"}],"root":[3],"options":{"composite":true,"declarationMap":true},"referencedMap":[[3,1]],"latestChangedDtsFile":"./main.d.ts","version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/main/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "fileNames": [ + "../../../../../home/src/tslibs/ts/lib/lib.d.ts", + "../decls/api.d.ts", + "./main.ts" + ], + "fileIdsList": [ + [ + "../decls/api.d.ts" + ] + ], + "fileInfos": { + "../../../../../home/src/tslibs/ts/lib/lib.d.ts": { + "original": { + "version": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "version": "3858781397-/// \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; };", + "signature": "3858781397-/// \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; };", + "affectsGlobalScope": true + }, + "../decls/api.d.ts": { + "version": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n", + "signature": "23035000737-export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n" + }, + "./main.ts": { + "original": { + "version": "-4091673735-import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n", + "signature": "-3531856636-export {};\n" + }, + "version": "-4091673735-import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n", + "signature": "-3531856636-export {};\n" + } + }, + "root": [ + [ + 3, + "./main.ts" + ] + ], + "options": { + "composite": true, + "declarationMap": true + }, + "referencedMap": { + "./main.ts": [ + "../decls/api.d.ts" + ] + }, + "latestChangedDtsFile": "./main.d.ts", + "version": "FakeTSVersion", + "size": 1028 +} + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/main/main.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /user/username/projects/myproject/main/main.ts ProjectRootPath: undefined:: Result: /user/username/projects/myproject/main/tsconfig.json +Info seq [hh:mm:ss:mss] Creating ConfiguredProject: /user/username/projects/myproject/main/tsconfig.json, currentDirectory: /user/username/projects/myproject/main +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "projectLoadingStart", + "body": { + "projectName": "/user/username/projects/myproject/main/tsconfig.json", + "reason": "Creating possible configured project for /user/username/projects/myproject/main/main.ts to open" + } + } +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/main/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/main/main.ts" + ], + "options": { + "composite": true, + "declarationMap": true, + "disableSourceOfProjectReferenceRedirect": true, + "configFilePath": "/user/username/projects/myproject/main/tsconfig.json" + }, + "projectReferences": [ + { + "path": "/user/username/projects/myproject/dependency", + "originalPath": "../dependency" + } + ] +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main 1 undefined Config: /user/username/projects/myproject/main/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main 1 undefined Config: /user/username/projects/myproject/main/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/main/tsconfig.json +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/dependency/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/dependency/api.ts" + ], + "options": { + "composite": true, + "declarationMap": true, + "declarationDir": "/user/username/projects/myproject/decls", + "configFilePath": "/user/username/projects/myproject/dependency/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/dependency/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/dependency 1 undefined Config: /user/username/projects/myproject/dependency/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/dependency 1 undefined Config: /user/username/projects/myproject/dependency/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/decls 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/decls 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Failed Lookup Locations +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/decls/api.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/tslibs/TS/Lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/main/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Project: /user/username/projects/myproject/main/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/main/tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/main/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /home/src/tslibs/TS/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; };" + /user/username/projects/myproject/decls/api.d.ts Text-1 "export declare const createCaller: () => {\n foo: () => number;\n bar: () => string;\n};\n//# sourceMappingURL=api.d.ts.map" + /user/username/projects/myproject/main/main.ts SVC-1-0 "import { createCaller } from \"../decls/api\";\nconst caller = createCaller();\ncaller.foo;\n" + + + ../../../../../home/src/tslibs/TS/Lib/lib.d.ts + Default library for target 'es5' + ../decls/api.d.ts + Imported via "../decls/api" from file 'main.ts' + main.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": "/user/username/projects/myproject/main/tsconfig.json" + } + } +Info seq [hh:mm:ss:mss] event: + { + "seq": 0, + "type": "event", + "event": "telemetry", + "body": { + "telemetryEventName": "projectInfo", + "payload": { + "projectId": "725f5b69066c57a96b52ceff33e6f8ba051a781bb82cf6869a874428cad2bf97", + "fileStats": { + "js": 0, + "jsSize": 0, + "jsx": 0, + "jsxSize": 0, + "ts": 1, + "tsSize": 88, + "tsx": 0, + "tsxSize": 0, + "dts": 2, + "dtsSize": 538, + "deferred": 0, + "deferredSize": 0 + }, + "compilerOptions": { + "composite": true, + "declarationMap": true, + "disableSourceOfProjectReferenceRedirect": 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": "/user/username/projects/myproject/main/main.ts", + "configFile": "/user/username/projects/myproject/main/tsconfig.json", + "diagnostics": [] + } + } +Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /user/username/projects/myproject/main/tsconfig.json ProjectRootPath: undefined:: Result: undefined +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/main/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: /user/username/projects/myproject/main/main.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/main/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:: +/user/username/projects/myproject/main/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/home/src/tslibs/TS/Lib/lib.d.ts: *new* + {} +/user/username/projects/myproject/decls/api.d.ts: *new* + {} +/user/username/projects/myproject/dependency/tsconfig.json: *new* + {} +/user/username/projects/myproject/main/tsconfig.json: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject/decls: *new* + {} +/user/username/projects/myproject/dependency: *new* + {} +/user/username/projects/myproject/main: *new* + {} + +Projects:: +/user/username/projects/myproject/main/tsconfig.json (Configured) *new* + projectStateVersion: 1 + projectProgramVersion: 1 + autoImportProviderHost: false + +ScriptInfos:: +/home/src/tslibs/TS/Lib/lib.d.ts *new* + version: Text-1 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json +/user/username/projects/myproject/decls/api.d.ts *new* + version: Text-1 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json +/user/username/projects/myproject/main/main.ts (Open) *new* + version: SVC-1-0 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json *default* + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "definitionAndBoundSpan", + "arguments": { + "file": "/user/username/projects/myproject/main/main.ts", + "line": 3, + "offset": 8 + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/decls/api.d.ts.map 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/dependency/api.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] response: + { + "response": { + "definitions": [ + { + "file": "/user/username/projects/myproject/dependency/api.ts", + "start": { + "line": 17, + "offset": 5 + }, + "end": { + "line": 17, + "offset": 8 + }, + "contextStart": { + "line": 17, + "offset": 5 + }, + "contextEnd": { + "line": 18, + "offset": 5 + } + } + ], + "textSpan": { + "start": { + "line": 3, + "offset": 8 + }, + "end": { + "line": 3, + "offset": 11 + } + } + }, + "responseRequired": true + } +After request + +PolledWatches:: +/user/username/projects/myproject/main/node_modules/@types: + {"pollingInterval":500} +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} +/user/username/projects/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/home/src/tslibs/TS/Lib/lib.d.ts: + {} +/user/username/projects/myproject/decls/api.d.ts: + {} +/user/username/projects/myproject/decls/api.d.ts.map: *new* + {} +/user/username/projects/myproject/dependency/api.ts: *new* + {} +/user/username/projects/myproject/dependency/tsconfig.json: + {} +/user/username/projects/myproject/main/tsconfig.json: + {} + +FsWatchesRecursive:: +/user/username/projects/myproject/decls: + {} +/user/username/projects/myproject/dependency: + {} +/user/username/projects/myproject/main: + {} + +Projects:: +/user/username/projects/myproject/main/tsconfig.json (Configured) *changed* + projectStateVersion: 1 + projectProgramVersion: 1 + documentPositionMappers: 1 *changed* + /user/username/projects/myproject/decls/api.d.ts: DocumentPositionMapper1 *new* + autoImportProviderHost: false + +ScriptInfos:: +/home/src/tslibs/TS/Lib/lib.d.ts + version: Text-1 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json +/user/username/projects/myproject/decls/api.d.ts *changed* + version: Text-1 + sourceMapFilePath: /user/username/projects/myproject/decls/api.d.ts.map *changed* + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json +/user/username/projects/myproject/decls/api.d.ts.map *new* + version: Text-1 + declarationInfoPath: /user/username/projects/myproject/decls/api.d.ts + sourceInfos: 1 + /user/username/projects/myproject/dependency/api.ts + documentPositionMapper: DocumentPositionMapper1 + containingProjects: 0 +/user/username/projects/myproject/dependency/api.ts *new* + version: Text-1 + containingProjects: 0 +/user/username/projects/myproject/main/main.ts (Open) + version: SVC-1-0 + containingProjects: 1 + /user/username/projects/myproject/main/tsconfig.json *default* + +DocumentPositionMappers:: +DocumentPositionMapper1 *new* From c5c2fe78484c4046b825144501c97db05b17bc55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Thu, 19 Sep 2024 12:27:33 +0200 Subject: [PATCH 2/7] update baselines --- .../reference/declarationMapsMultifile.js.map | 8 ++--- .../declarationMapsMultifile.sourcemap.txt | 26 ++++++++++++---- .../reference/declarationMapsOutFile.js.map | 4 +-- .../declarationMapsOutFile.sourcemap.txt | 30 ++++++++++++++----- .../reference/declarationMapsOutFile2.js.map | 4 +-- .../declarationMapsOutFile2.sourcemap.txt | 28 ++++++++++++----- .../declarationMapsWithSourceMap.js.map | 4 +-- ...declarationMapsWithSourceMap.sourcemap.txt | 28 ++++++++++++----- .../declarationMapsEnableMapping_NoInline.js | 4 +-- ...rationMapsEnableMapping_NoInlineSources.js | 4 +-- ...clarationMapsGeneratedMapsEnableMapping.js | 4 +-- ...larationMapsGeneratedMapsEnableMapping2.js | 4 +-- ...larationMapsGeneratedMapsEnableMapping3.js | 4 +-- .../declarationMapsEnableMapping_NoInline.ts | 4 +-- ...rationMapsEnableMapping_NoInlineSources.ts | 4 +-- ...clarationMapsGeneratedMapsEnableMapping.ts | 4 +-- ...larationMapsGeneratedMapsEnableMapping2.ts | 2 +- ...larationMapsGeneratedMapsEnableMapping3.ts | 4 +-- 18 files changed, 115 insertions(+), 55 deletions(-) diff --git a/tests/baselines/reference/declarationMapsMultifile.js.map b/tests/baselines/reference/declarationMapsMultifile.js.map index 6c718bdae2ae4..bd2fa86911d33 100644 --- a/tests/baselines/reference/declarationMapsMultifile.js.map +++ b/tests/baselines/reference/declarationMapsMultifile.js.map @@ -1,7 +1,7 @@ //// [a.d.ts.map] -{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,OAAO,CAAC,CAAC,EAAE;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;;;IAGtB,MAAM,CAAC,IAAI;CAGd"} -//// https://sokra.github.io/source-map-visualization#base64,ZXhwb3J0IGRlY2xhcmUgY2xhc3MgRm9vIHsNCiAgICBkb1RoaW5nKHg6IHsNCiAgICAgICAgYTogbnVtYmVyOw0KICAgIH0pOiB7DQogICAgICAgIGI6IG51bWJlcjsNCiAgICB9Ow0KICAgIHN0YXRpYyBtYWtlKCk6IEZvbzsNCn0NCi8vIyBzb3VyY2VNYXBwaW5nVVJMPWEuZC50cy5tYXA=,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxQkFBYSxHQUFHO0lBQ1osT0FBTyxDQUFDLENBQUMsRUFBRTtRQUFDLENBQUMsRUFBRSxNQUFNLENBQUE7S0FBQzs7O0lBR3RCLE1BQU0sQ0FBQyxJQUFJO0NBR2QifQ==,ZXhwb3J0IGNsYXNzIEZvbyB7CiAgICBkb1RoaW5nKHg6IHthOiBudW1iZXJ9KSB7CiAgICAgICAgcmV0dXJuIHtiOiB4LmF9OwogICAgfQogICAgc3RhdGljIG1ha2UoKSB7CiAgICAgICAgcmV0dXJuIG5ldyBGb28oKTsKICAgIH0KfQ== +{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,OAAO,CAAC,CAAC,EAAE;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;QACV,CAAC;;IAEb,MAAM,CAAC,IAAI;CAGd"} +//// https://sokra.github.io/source-map-visualization#base64,ZXhwb3J0IGRlY2xhcmUgY2xhc3MgRm9vIHsNCiAgICBkb1RoaW5nKHg6IHsNCiAgICAgICAgYTogbnVtYmVyOw0KICAgIH0pOiB7DQogICAgICAgIGI6IG51bWJlcjsNCiAgICB9Ow0KICAgIHN0YXRpYyBtYWtlKCk6IEZvbzsNCn0NCi8vIyBzb3VyY2VNYXBwaW5nVVJMPWEuZC50cy5tYXA=,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxQkFBYSxHQUFHO0lBQ1osT0FBTyxDQUFDLENBQUMsRUFBRTtRQUFDLENBQUMsRUFBRSxNQUFNLENBQUE7S0FBQztRQUNWLENBQUM7O0lBRWIsTUFBTSxDQUFDLElBQUk7Q0FHZCJ9,ZXhwb3J0IGNsYXNzIEZvbyB7CiAgICBkb1RoaW5nKHg6IHthOiBudW1iZXJ9KSB7CiAgICAgICAgcmV0dXJuIHtiOiB4LmF9OwogICAgfQogICAgc3RhdGljIG1ha2UoKSB7CiAgICAgICAgcmV0dXJuIG5ldyBGb28oKTsKICAgIH0KfQ== //// [index.d.ts.map] -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,CAAC,KAAY,CAAC;AAGpB,eAAO,IAAI,CAAC;;CAAqB,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC"} -//// https://sokra.github.io/source-map-visualization#base64,aW1wb3J0IHsgRm9vIH0gZnJvbSAiLi9hIjsNCmRlY2xhcmUgY29uc3QgYzogRm9vOw0KZXhwb3J0IGRlY2xhcmUgbGV0IHg6IHsNCiAgICBiOiBudW1iZXI7DQp9Ow0KZXhwb3J0IHsgYywgRm9vIH07DQovLyMgc291cmNlTWFwcGluZ1VSTD1pbmRleC5kLnRzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxHQUFHLEVBQUMsTUFBTSxLQUFLLENBQUM7QUFFeEIsUUFBQSxNQUFNLENBQUMsS0FBWSxDQUFDO0FBR3BCLGVBQU8sSUFBSSxDQUFDOztDQUFxQixDQUFDO0FBQ2xDLE9BQU8sRUFBRSxDQUFDLEVBQUUsR0FBRyxFQUFFLENBQUMifQ==,aW1wb3J0IHtGb299IGZyb20gIi4vYSI7Cgpjb25zdCBjID0gbmV3IEZvbygpOwpjLmRvVGhpbmcoe2E6IDQyfSk7CgpleHBvcnQgbGV0IHggPSBjLmRvVGhpbmcoe2E6IDEyfSk7CmV4cG9ydCB7IGMsIEZvbyB9Owo= +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,CAAC,KAAY,CAAC;AAGpB,eAAO,IAAI,CAAC;IAFM,CAAC;CAEc,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,aW1wb3J0IHsgRm9vIH0gZnJvbSAiLi9hIjsNCmRlY2xhcmUgY29uc3QgYzogRm9vOw0KZXhwb3J0IGRlY2xhcmUgbGV0IHg6IHsNCiAgICBiOiBudW1iZXI7DQp9Ow0KZXhwb3J0IHsgYywgRm9vIH07DQovLyMgc291cmNlTWFwcGluZ1VSTD1pbmRleC5kLnRzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxHQUFHLEVBQUMsTUFBTSxLQUFLLENBQUM7QUFFeEIsUUFBQSxNQUFNLENBQUMsS0FBWSxDQUFDO0FBR3BCLGVBQU8sSUFBSSxDQUFDO0lBRk0sQ0FBQztDQUVjLENBQUM7QUFDbEMsT0FBTyxFQUFFLENBQUMsRUFBRSxHQUFHLEVBQUUsQ0FBQyJ9,aW1wb3J0IHtGb299IGZyb20gIi4vYSI7Cgpjb25zdCBjID0gbmV3IEZvbygpOwpjLmRvVGhpbmcoe2E6IDQyfSk7CgpleHBvcnQgbGV0IHggPSBjLmRvVGhpbmcoe2E6IDEyfSk7CmV4cG9ydCB7IGMsIEZvbyB9Owo= diff --git a/tests/baselines/reference/declarationMapsMultifile.sourcemap.txt b/tests/baselines/reference/declarationMapsMultifile.sourcemap.txt index f13fe742ce2d3..0da98eb72a607 100644 --- a/tests/baselines/reference/declarationMapsMultifile.sourcemap.txt +++ b/tests/baselines/reference/declarationMapsMultifile.sourcemap.txt @@ -62,20 +62,27 @@ sourceFile:a.ts 1 >Emitted(4, 6) Source(2, 27) + SourceIndex(0) --- >>> b: number; +1->^^^^^^^^ +2 > ^ +1->) { + > return { +2 > b +1->Emitted(5, 9) Source(3, 17) + SourceIndex(0) +2 >Emitted(5, 10) Source(3, 18) + SourceIndex(0) +--- >>> }; >>> static make(): Foo; -1->^^^^ +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^^^^ -1->) { - > return {b: x.a}; +1 >: x.a}; > } > 2 > static 3 > 4 > make -1->Emitted(7, 5) Source(5, 5) + SourceIndex(0) +1 >Emitted(7, 5) Source(5, 5) + SourceIndex(0) 2 >Emitted(7, 11) Source(5, 11) + SourceIndex(0) 3 >Emitted(7, 12) Source(5, 12) + SourceIndex(0) 4 >Emitted(7, 16) Source(5, 16) + SourceIndex(0) @@ -166,11 +173,20 @@ sourceFile:index.ts 4 >Emitted(3, 21) Source(6, 13) + SourceIndex(0) --- >>> b: number; +1 >^^^^ +2 > ^ +1 > +2 > ; +1 >Emitted(4, 5) Source(4, 19) + SourceIndex(0) +2 >Emitted(4, 6) Source(4, 20) + SourceIndex(0) +--- >>>}; 1 >^ 2 > ^ 3 > ^^^^^^^^^^^^^^^^^-> -1 > = c.doThing({a: 12}) +1 > + > + >export let x = c.doThing({a: 12}) 2 > ; 1 >Emitted(5, 2) Source(6, 34) + SourceIndex(0) 2 >Emitted(5, 3) Source(6, 35) + SourceIndex(0) diff --git a/tests/baselines/reference/declarationMapsOutFile.js.map b/tests/baselines/reference/declarationMapsOutFile.js.map index efa89ba138362..eb84a68de093d 100644 --- a/tests/baselines/reference/declarationMapsOutFile.js.map +++ b/tests/baselines/reference/declarationMapsOutFile.js.map @@ -1,3 +1,3 @@ //// [bundle.d.ts.map] -{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["a.ts","index.ts"],"names":[],"mappings":";IAAA,MAAM,OAAO,GAAG;QACZ,OAAO,CAAC,GAAG;YAAC,CAAC,EAAE,MAAM,CAAA;SAAC;;;QAGtB,MAAM,CAAC,IAAI;KAGd;;;ICPD,OAAO,EAAC,GAAG,EAAC,UAAY;IAExB,MAAM,CAAC,KAAY,CAAC;IAGpB,MAAM,CAAC,IAAI,CAAC;;KAAqB,CAAC;IAClC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC"} -//// https://sokra.github.io/source-map-visualization#base64,ZGVjbGFyZSBtb2R1bGUgImEiIHsNCiAgICBleHBvcnQgY2xhc3MgRm9vIHsNCiAgICAgICAgZG9UaGluZyh4OiB7DQogICAgICAgICAgICBhOiBudW1iZXI7DQogICAgICAgIH0pOiB7DQogICAgICAgICAgICBiOiBudW1iZXI7DQogICAgICAgIH07DQogICAgICAgIHN0YXRpYyBtYWtlKCk6IEZvbzsNCiAgICB9DQp9DQpkZWNsYXJlIG1vZHVsZSAiaW5kZXgiIHsNCiAgICBpbXBvcnQgeyBGb28gfSBmcm9tICJhIjsNCiAgICBjb25zdCBjOiBGb287DQogICAgZXhwb3J0IGxldCB4OiB7DQogICAgICAgIGI6IG51bWJlcjsNCiAgICB9Ow0KICAgIGV4cG9ydCB7IGMsIEZvbyB9Ow0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9YnVuZGxlLmQudHMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhLnRzIiwiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtJQUFBLE1BQU0sT0FBTyxHQUFHO1FBQ1osT0FBTyxDQUFDLEdBQUc7WUFBQyxDQUFDLEVBQUUsTUFBTSxDQUFBO1NBQUM7OztRQUd0QixNQUFNLENBQUMsSUFBSTtLQUdkOzs7SUNQRCxPQUFPLEVBQUMsR0FBRyxFQUFDLFVBQVk7SUFFeEIsTUFBTSxDQUFDLEtBQVksQ0FBQztJQUdwQixNQUFNLENBQUMsSUFBSSxDQUFDOztLQUFxQixDQUFDO0lBQ2xDLE9BQU8sRUFBRSxDQUFDLEVBQUUsR0FBRyxFQUFFLENBQUMifQ==,ZXhwb3J0IGNsYXNzIEZvbyB7CiAgICBkb1RoaW5nKHg6IHthOiBudW1iZXJ9KSB7CiAgICAgICAgcmV0dXJuIHtiOiB4LmF9OwogICAgfQogICAgc3RhdGljIG1ha2UoKSB7CiAgICAgICAgcmV0dXJuIG5ldyBGb28oKTsKICAgIH0KfQ==,aW1wb3J0IHtGb299IGZyb20gIi4vYSI7Cgpjb25zdCBjID0gbmV3IEZvbygpOwpjLmRvVGhpbmcoe2E6IDQyfSk7CgpleHBvcnQgbGV0IHggPSBjLmRvVGhpbmcoe2E6IDEyfSk7CmV4cG9ydCB7IGMsIEZvbyB9Owo= +{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["a.ts","index.ts"],"names":[],"mappings":";IAAA,MAAM,OAAO,GAAG;QACZ,OAAO,CAAC,GAAG;YAAC,CAAC,EAAE,MAAM,CAAA;SAAC;YACV,CAAC;;QAEb,MAAM,CAAC,IAAI;KAGd;;;ICPD,OAAO,EAAC,GAAG,EAAC,UAAY;IAExB,MAAM,CAAC,KAAY,CAAC;IAGpB,MAAM,CAAC,IAAI,CAAC;QAFM,CAAC;KAEc,CAAC;IAClC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,ZGVjbGFyZSBtb2R1bGUgImEiIHsNCiAgICBleHBvcnQgY2xhc3MgRm9vIHsNCiAgICAgICAgZG9UaGluZyh4OiB7DQogICAgICAgICAgICBhOiBudW1iZXI7DQogICAgICAgIH0pOiB7DQogICAgICAgICAgICBiOiBudW1iZXI7DQogICAgICAgIH07DQogICAgICAgIHN0YXRpYyBtYWtlKCk6IEZvbzsNCiAgICB9DQp9DQpkZWNsYXJlIG1vZHVsZSAiaW5kZXgiIHsNCiAgICBpbXBvcnQgeyBGb28gfSBmcm9tICJhIjsNCiAgICBjb25zdCBjOiBGb287DQogICAgZXhwb3J0IGxldCB4OiB7DQogICAgICAgIGI6IG51bWJlcjsNCiAgICB9Ow0KICAgIGV4cG9ydCB7IGMsIEZvbyB9Ow0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9YnVuZGxlLmQudHMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhLnRzIiwiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtJQUFBLE1BQU0sT0FBTyxHQUFHO1FBQ1osT0FBTyxDQUFDLEdBQUc7WUFBQyxDQUFDLEVBQUUsTUFBTSxDQUFBO1NBQUM7WUFDVixDQUFDOztRQUViLE1BQU0sQ0FBQyxJQUFJO0tBR2Q7OztJQ1BELE9BQU8sRUFBQyxHQUFHLEVBQUMsVUFBWTtJQUV4QixNQUFNLENBQUMsS0FBWSxDQUFDO0lBR3BCLE1BQU0sQ0FBQyxJQUFJLENBQUM7UUFGTSxDQUFDO0tBRWMsQ0FBQztJQUNsQyxPQUFPLEVBQUUsQ0FBQyxFQUFFLEdBQUcsRUFBRSxDQUFDIn0=,ZXhwb3J0IGNsYXNzIEZvbyB7CiAgICBkb1RoaW5nKHg6IHthOiBudW1iZXJ9KSB7CiAgICAgICAgcmV0dXJuIHtiOiB4LmF9OwogICAgfQogICAgc3RhdGljIG1ha2UoKSB7CiAgICAgICAgcmV0dXJuIG5ldyBGb28oKTsKICAgIH0KfQ==,aW1wb3J0IHtGb299IGZyb20gIi4vYSI7Cgpjb25zdCBjID0gbmV3IEZvbygpOwpjLmRvVGhpbmcoe2E6IDQyfSk7CgpleHBvcnQgbGV0IHggPSBjLmRvVGhpbmcoe2E6IDEyfSk7CmV4cG9ydCB7IGMsIEZvbyB9Owo= diff --git a/tests/baselines/reference/declarationMapsOutFile.sourcemap.txt b/tests/baselines/reference/declarationMapsOutFile.sourcemap.txt index 5e7d5c40b8880..3f44f1e3ad4ee 100644 --- a/tests/baselines/reference/declarationMapsOutFile.sourcemap.txt +++ b/tests/baselines/reference/declarationMapsOutFile.sourcemap.txt @@ -64,20 +64,27 @@ sourceFile:a.ts 1 >Emitted(5, 10) Source(2, 27) + SourceIndex(0) --- >>> b: number; +1->^^^^^^^^^^^^ +2 > ^ +1->) { + > return { +2 > b +1->Emitted(6, 13) Source(3, 17) + SourceIndex(0) +2 >Emitted(6, 14) Source(3, 18) + SourceIndex(0) +--- >>> }; >>> static make(): Foo; -1->^^^^^^^^ +1 >^^^^^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^^^^ -1->) { - > return {b: x.a}; +1 >: x.a}; > } > 2 > static 3 > 4 > make -1->Emitted(8, 9) Source(5, 5) + SourceIndex(0) +1 >Emitted(8, 9) Source(5, 5) + SourceIndex(0) 2 >Emitted(8, 15) Source(5, 11) + SourceIndex(0) 3 >Emitted(8, 16) Source(5, 12) + SourceIndex(0) 4 >Emitted(8, 20) Source(5, 16) + SourceIndex(0) @@ -158,13 +165,22 @@ sourceFile:index.ts 5 >Emitted(14, 17) Source(6, 13) + SourceIndex(1) --- >>> b: number; +1->^^^^^^^^ +2 > ^ +1-> +2 > ; +1->Emitted(15, 9) Source(4, 19) + SourceIndex(1) +2 >Emitted(15, 10) Source(4, 20) + SourceIndex(1) +--- >>> }; -1->^^^^^ +1 >^^^^^ 2 > ^ 3 > ^^^^^^^^^^^^^^^^^-> -1-> = c.doThing({a: 12}) +1 > + > + >export let x = c.doThing({a: 12}) 2 > ; -1->Emitted(16, 6) Source(6, 34) + SourceIndex(1) +1 >Emitted(16, 6) Source(6, 34) + SourceIndex(1) 2 >Emitted(16, 7) Source(6, 35) + SourceIndex(1) --- >>> export { c, Foo }; diff --git a/tests/baselines/reference/declarationMapsOutFile2.js.map b/tests/baselines/reference/declarationMapsOutFile2.js.map index 9fbc681df5c64..f38ff92943c00 100644 --- a/tests/baselines/reference/declarationMapsOutFile2.js.map +++ b/tests/baselines/reference/declarationMapsOutFile2.js.map @@ -1,3 +1,3 @@ //// [bundle.d.ts.map] -{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["a.ts","index.ts"],"names":[],"mappings":"AAAA,cAAM,GAAG;IACL,OAAO,CAAC,GAAG;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;;;IAGtB,MAAM,CAAC,IAAI;CAGd;ACPD,QAAA,MAAM,CAAC,KAAY,CAAC;AAGpB,QAAA,IAAI,CAAC;;CAAqB,CAAC"} -//// https://sokra.github.io/source-map-visualization#base64,ZGVjbGFyZSBjbGFzcyBGb28gew0KICAgIGRvVGhpbmcoeDogew0KICAgICAgICBhOiBudW1iZXI7DQogICAgfSk6IHsNCiAgICAgICAgYjogbnVtYmVyOw0KICAgIH07DQogICAgc3RhdGljIG1ha2UoKTogRm9vOw0KfQ0KZGVjbGFyZSBjb25zdCBjOiBGb287DQpkZWNsYXJlIGxldCB4OiB7DQogICAgYjogbnVtYmVyOw0KfTsNCi8vIyBzb3VyY2VNYXBwaW5nVVJMPWJ1bmRsZS5kLnRzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhLnRzIiwiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBTSxHQUFHO0lBQ0wsT0FBTyxDQUFDLEdBQUc7UUFBQyxDQUFDLEVBQUUsTUFBTSxDQUFBO0tBQUM7OztJQUd0QixNQUFNLENBQUMsSUFBSTtDQUdkO0FDUEQsUUFBQSxNQUFNLENBQUMsS0FBWSxDQUFDO0FBR3BCLFFBQUEsSUFBSSxDQUFDOztDQUFxQixDQUFDIn0=,Y2xhc3MgRm9vIHsKICAgIGRvVGhpbmcoeDoge2E6IG51bWJlcn0pIHsKICAgICAgICByZXR1cm4ge2I6IHguYX07CiAgICB9CiAgICBzdGF0aWMgbWFrZSgpIHsKICAgICAgICByZXR1cm4gbmV3IEZvbygpOwogICAgfQp9,Y29uc3QgYyA9IG5ldyBGb28oKTsKYy5kb1RoaW5nKHthOiA0Mn0pOwoKbGV0IHggPSBjLmRvVGhpbmcoe2E6IDEyfSk7Cg== +{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["a.ts","index.ts"],"names":[],"mappings":"AAAA,cAAM,GAAG;IACL,OAAO,CAAC,GAAG;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;QACV,CAAC;;IAEb,MAAM,CAAC,IAAI;CAGd;ACPD,QAAA,MAAM,CAAC,KAAY,CAAC;AAGpB,QAAA,IAAI,CAAC;IAAW,CAAC;CAAS,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,ZGVjbGFyZSBjbGFzcyBGb28gew0KICAgIGRvVGhpbmcoeDogew0KICAgICAgICBhOiBudW1iZXI7DQogICAgfSk6IHsNCiAgICAgICAgYjogbnVtYmVyOw0KICAgIH07DQogICAgc3RhdGljIG1ha2UoKTogRm9vOw0KfQ0KZGVjbGFyZSBjb25zdCBjOiBGb287DQpkZWNsYXJlIGxldCB4OiB7DQogICAgYjogbnVtYmVyOw0KfTsNCi8vIyBzb3VyY2VNYXBwaW5nVVJMPWJ1bmRsZS5kLnRzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhLnRzIiwiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBTSxHQUFHO0lBQ0wsT0FBTyxDQUFDLEdBQUc7UUFBQyxDQUFDLEVBQUUsTUFBTSxDQUFBO0tBQUM7UUFDVixDQUFDOztJQUViLE1BQU0sQ0FBQyxJQUFJO0NBR2Q7QUNQRCxRQUFBLE1BQU0sQ0FBQyxLQUFZLENBQUM7QUFHcEIsUUFBQSxJQUFJLENBQUM7SUFBVyxDQUFDO0NBQVMsQ0FBQyJ9,Y2xhc3MgRm9vIHsKICAgIGRvVGhpbmcoeDoge2E6IG51bWJlcn0pIHsKICAgICAgICByZXR1cm4ge2I6IHguYX07CiAgICB9CiAgICBzdGF0aWMgbWFrZSgpIHsKICAgICAgICByZXR1cm4gbmV3IEZvbygpOwogICAgfQp9,Y29uc3QgYyA9IG5ldyBGb28oKTsKYy5kb1RoaW5nKHthOiA0Mn0pOwoKbGV0IHggPSBjLmRvVGhpbmcoe2E6IDEyfSk7Cg== diff --git a/tests/baselines/reference/declarationMapsOutFile2.sourcemap.txt b/tests/baselines/reference/declarationMapsOutFile2.sourcemap.txt index ec4ae6a40e3ff..4e8e2d43f58ba 100644 --- a/tests/baselines/reference/declarationMapsOutFile2.sourcemap.txt +++ b/tests/baselines/reference/declarationMapsOutFile2.sourcemap.txt @@ -59,20 +59,27 @@ sourceFile:a.ts 1 >Emitted(4, 6) Source(2, 27) + SourceIndex(0) --- >>> b: number; +1->^^^^^^^^ +2 > ^ +1->) { + > return { +2 > b +1->Emitted(5, 9) Source(3, 17) + SourceIndex(0) +2 >Emitted(5, 10) Source(3, 18) + SourceIndex(0) +--- >>> }; >>> static make(): Foo; -1->^^^^ +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^^^^ -1->) { - > return {b: x.a}; +1 >: x.a}; > } > 2 > static 3 > 4 > make -1->Emitted(7, 5) Source(5, 5) + SourceIndex(0) +1 >Emitted(7, 5) Source(5, 5) + SourceIndex(0) 2 >Emitted(7, 11) Source(5, 11) + SourceIndex(0) 3 >Emitted(7, 12) Source(5, 12) + SourceIndex(0) 4 >Emitted(7, 16) Source(5, 16) + SourceIndex(0) @@ -129,13 +136,20 @@ sourceFile:index.ts 4 >Emitted(10, 14) Source(4, 6) + SourceIndex(1) --- >>> b: number; +1->^^^^ +2 > ^ +1-> = c.doThin +2 > g +1->Emitted(11, 5) Source(4, 17) + SourceIndex(1) +2 >Emitted(11, 6) Source(4, 18) + SourceIndex(1) +--- >>>}; -1->^ +1 >^ 2 > ^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> = c.doThing({a: 12}) +1 >({a: 12}) 2 > ; -1->Emitted(12, 2) Source(4, 27) + SourceIndex(1) +1 >Emitted(12, 2) Source(4, 27) + SourceIndex(1) 2 >Emitted(12, 3) Source(4, 28) + SourceIndex(1) --- >>>//# sourceMappingURL=bundle.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/declarationMapsWithSourceMap.js.map b/tests/baselines/reference/declarationMapsWithSourceMap.js.map index c0ab927400229..f383b3c6c88bd 100644 --- a/tests/baselines/reference/declarationMapsWithSourceMap.js.map +++ b/tests/baselines/reference/declarationMapsWithSourceMap.js.map @@ -3,5 +3,5 @@ //// https://sokra.github.io/source-map-visualization#base64,dmFyIEZvbyA9IC8qKiBAY2xhc3MgKi8gKGZ1bmN0aW9uICgpIHsNCiAgICBmdW5jdGlvbiBGb28oKSB7DQogICAgfQ0KICAgIEZvby5wcm90b3R5cGUuZG9UaGluZyA9IGZ1bmN0aW9uICh4KSB7DQogICAgICAgIHJldHVybiB7IGI6IHguYSB9Ow0KICAgIH07DQogICAgRm9vLm1ha2UgPSBmdW5jdGlvbiAoKSB7DQogICAgICAgIHJldHVybiBuZXcgRm9vKCk7DQogICAgfTsNCiAgICByZXR1cm4gRm9vOw0KfSgpKTsNCnZhciBjID0gbmV3IEZvbygpOw0KYy5kb1RoaW5nKHsgYTogNDIgfSk7DQp2YXIgeCA9IGMuZG9UaGluZyh7IGE6IDEyIH0pOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9YnVuZGxlLmpzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYS50cyIsImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0lBQUE7SUFPQSxDQUFDO0lBTkcscUJBQU8sR0FBUCxVQUFRLENBQWM7UUFDbEIsT0FBTyxFQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxFQUFDLENBQUM7SUFDcEIsQ0FBQztJQUNNLFFBQUksR0FBWDtRQUNJLE9BQU8sSUFBSSxHQUFHLEVBQUUsQ0FBQztJQUNyQixDQUFDO0lBQ0wsVUFBQztBQUFELENBQUMsQUFQRCxJQU9DO0FDUEQsSUFBTSxDQUFDLEdBQUcsSUFBSSxHQUFHLEVBQUUsQ0FBQztBQUNwQixDQUFDLENBQUMsT0FBTyxDQUFDLEVBQUMsQ0FBQyxFQUFFLEVBQUUsRUFBQyxDQUFDLENBQUM7QUFFbkIsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxFQUFDLENBQUMsRUFBRSxFQUFFLEVBQUMsQ0FBQyxDQUFDIn0=,Y2xhc3MgRm9vIHsKICAgIGRvVGhpbmcoeDoge2E6IG51bWJlcn0pIHsKICAgICAgICByZXR1cm4ge2I6IHguYX07CiAgICB9CiAgICBzdGF0aWMgbWFrZSgpIHsKICAgICAgICByZXR1cm4gbmV3IEZvbygpOwogICAgfQp9,Y29uc3QgYyA9IG5ldyBGb28oKTsKYy5kb1RoaW5nKHthOiA0Mn0pOwoKbGV0IHggPSBjLmRvVGhpbmcoe2E6IDEyfSk7Cg== //// [bundle.d.ts.map] -{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["a.ts","index.ts"],"names":[],"mappings":"AAAA,cAAM,GAAG;IACL,OAAO,CAAC,GAAG;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;;;IAGtB,MAAM,CAAC,IAAI;CAGd;ACPD,QAAA,MAAM,CAAC,KAAY,CAAC;AAGpB,QAAA,IAAI,CAAC;;CAAqB,CAAC"} -//// https://sokra.github.io/source-map-visualization#base64,ZGVjbGFyZSBjbGFzcyBGb28gew0KICAgIGRvVGhpbmcoeDogew0KICAgICAgICBhOiBudW1iZXI7DQogICAgfSk6IHsNCiAgICAgICAgYjogbnVtYmVyOw0KICAgIH07DQogICAgc3RhdGljIG1ha2UoKTogRm9vOw0KfQ0KZGVjbGFyZSBjb25zdCBjOiBGb287DQpkZWNsYXJlIGxldCB4OiB7DQogICAgYjogbnVtYmVyOw0KfTsNCi8vIyBzb3VyY2VNYXBwaW5nVVJMPWJ1bmRsZS5kLnRzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhLnRzIiwiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBTSxHQUFHO0lBQ0wsT0FBTyxDQUFDLEdBQUc7UUFBQyxDQUFDLEVBQUUsTUFBTSxDQUFBO0tBQUM7OztJQUd0QixNQUFNLENBQUMsSUFBSTtDQUdkO0FDUEQsUUFBQSxNQUFNLENBQUMsS0FBWSxDQUFDO0FBR3BCLFFBQUEsSUFBSSxDQUFDOztDQUFxQixDQUFDIn0=,Y2xhc3MgRm9vIHsKICAgIGRvVGhpbmcoeDoge2E6IG51bWJlcn0pIHsKICAgICAgICByZXR1cm4ge2I6IHguYX07CiAgICB9CiAgICBzdGF0aWMgbWFrZSgpIHsKICAgICAgICByZXR1cm4gbmV3IEZvbygpOwogICAgfQp9,Y29uc3QgYyA9IG5ldyBGb28oKTsKYy5kb1RoaW5nKHthOiA0Mn0pOwoKbGV0IHggPSBjLmRvVGhpbmcoe2E6IDEyfSk7Cg== +{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["a.ts","index.ts"],"names":[],"mappings":"AAAA,cAAM,GAAG;IACL,OAAO,CAAC,GAAG;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;QACV,CAAC;;IAEb,MAAM,CAAC,IAAI;CAGd;ACPD,QAAA,MAAM,CAAC,KAAY,CAAC;AAGpB,QAAA,IAAI,CAAC;IAAW,CAAC;CAAS,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,ZGVjbGFyZSBjbGFzcyBGb28gew0KICAgIGRvVGhpbmcoeDogew0KICAgICAgICBhOiBudW1iZXI7DQogICAgfSk6IHsNCiAgICAgICAgYjogbnVtYmVyOw0KICAgIH07DQogICAgc3RhdGljIG1ha2UoKTogRm9vOw0KfQ0KZGVjbGFyZSBjb25zdCBjOiBGb287DQpkZWNsYXJlIGxldCB4OiB7DQogICAgYjogbnVtYmVyOw0KfTsNCi8vIyBzb3VyY2VNYXBwaW5nVVJMPWJ1bmRsZS5kLnRzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhLnRzIiwiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBTSxHQUFHO0lBQ0wsT0FBTyxDQUFDLEdBQUc7UUFBQyxDQUFDLEVBQUUsTUFBTSxDQUFBO0tBQUM7UUFDVixDQUFDOztJQUViLE1BQU0sQ0FBQyxJQUFJO0NBR2Q7QUNQRCxRQUFBLE1BQU0sQ0FBQyxLQUFZLENBQUM7QUFHcEIsUUFBQSxJQUFJLENBQUM7SUFBVyxDQUFDO0NBQVMsQ0FBQyJ9,Y2xhc3MgRm9vIHsKICAgIGRvVGhpbmcoeDoge2E6IG51bWJlcn0pIHsKICAgICAgICByZXR1cm4ge2I6IHguYX07CiAgICB9CiAgICBzdGF0aWMgbWFrZSgpIHsKICAgICAgICByZXR1cm4gbmV3IEZvbygpOwogICAgfQp9,Y29uc3QgYyA9IG5ldyBGb28oKTsKYy5kb1RoaW5nKHthOiA0Mn0pOwoKbGV0IHggPSBjLmRvVGhpbmcoe2E6IDEyfSk7Cg== diff --git a/tests/baselines/reference/declarationMapsWithSourceMap.sourcemap.txt b/tests/baselines/reference/declarationMapsWithSourceMap.sourcemap.txt index ca0144e49ecd6..b9be57d660d9f 100644 --- a/tests/baselines/reference/declarationMapsWithSourceMap.sourcemap.txt +++ b/tests/baselines/reference/declarationMapsWithSourceMap.sourcemap.txt @@ -353,20 +353,27 @@ sourceFile:a.ts 1 >Emitted(4, 6) Source(2, 27) + SourceIndex(0) --- >>> b: number; +1->^^^^^^^^ +2 > ^ +1->) { + > return { +2 > b +1->Emitted(5, 9) Source(3, 17) + SourceIndex(0) +2 >Emitted(5, 10) Source(3, 18) + SourceIndex(0) +--- >>> }; >>> static make(): Foo; -1->^^^^ +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^^^^ -1->) { - > return {b: x.a}; +1 >: x.a}; > } > 2 > static 3 > 4 > make -1->Emitted(7, 5) Source(5, 5) + SourceIndex(0) +1 >Emitted(7, 5) Source(5, 5) + SourceIndex(0) 2 >Emitted(7, 11) Source(5, 11) + SourceIndex(0) 3 >Emitted(7, 12) Source(5, 12) + SourceIndex(0) 4 >Emitted(7, 16) Source(5, 16) + SourceIndex(0) @@ -423,13 +430,20 @@ sourceFile:index.ts 4 >Emitted(10, 14) Source(4, 6) + SourceIndex(1) --- >>> b: number; +1->^^^^ +2 > ^ +1-> = c.doThin +2 > g +1->Emitted(11, 5) Source(4, 17) + SourceIndex(1) +2 >Emitted(11, 6) Source(4, 18) + SourceIndex(1) +--- >>>}; -1->^ +1 >^ 2 > ^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> = c.doThing({a: 12}) +1 >({a: 12}) 2 > ; -1->Emitted(12, 2) Source(4, 27) + SourceIndex(1) +1 >Emitted(12, 2) Source(4, 27) + SourceIndex(1) 2 >Emitted(12, 3) Source(4, 28) + SourceIndex(1) --- >>>//# sourceMappingURL=bundle.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/tsserver/fourslashServer/declarationMapsEnableMapping_NoInline.js b/tests/baselines/reference/tsserver/fourslashServer/declarationMapsEnableMapping_NoInline.js index dc19a23822143..a1a2761ef3845 100644 --- a/tests/baselines/reference/tsserver/fourslashServer/declarationMapsEnableMapping_NoInline.js +++ b/tests/baselines/reference/tsserver/fourslashServer/declarationMapsEnableMapping_NoInline.js @@ -29,7 +29,7 @@ export interface SomeType { //# sourceMappingURL=index.d.ts.map //// [/home/src/workspaces/project/dist/index.d.ts.map] -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} //// [/home/src/workspaces/project/dist/index.js] "use strict"; @@ -412,7 +412,7 @@ Info seq [hh:mm:ss:mss] response: { "name": "/home/src/workspaces/project/dist/index.d.ts.map", "writeByteOrderMark": false, - "text": "{\"version\":3,\"file\":\"index.d.ts\",\"sourceRoot\":\"\",\"sources\":[\"../index.ts\"],\"names\":[],\"mappings\":\"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB\"}" + "text": "{\"version\":3,\"file\":\"index.d.ts\",\"sourceRoot\":\"\",\"sources\":[\"../index.ts\"],\"names\":[],\"mappings\":\"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB\"}" }, { "name": "/home/src/workspaces/project/dist/index.d.ts", diff --git a/tests/baselines/reference/tsserver/fourslashServer/declarationMapsEnableMapping_NoInlineSources.js b/tests/baselines/reference/tsserver/fourslashServer/declarationMapsEnableMapping_NoInlineSources.js index a836c758e88dc..772c122e19187 100644 --- a/tests/baselines/reference/tsserver/fourslashServer/declarationMapsEnableMapping_NoInlineSources.js +++ b/tests/baselines/reference/tsserver/fourslashServer/declarationMapsEnableMapping_NoInlineSources.js @@ -29,7 +29,7 @@ export interface SomeType { //# sourceMappingURL=index.d.ts.map //// [/home/src/workspaces/project/dist/index.d.ts.map] -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} //// [/home/src/workspaces/project/dist/index.js] "use strict"; @@ -414,7 +414,7 @@ Info seq [hh:mm:ss:mss] response: { "name": "/home/src/workspaces/project/dist/index.d.ts.map", "writeByteOrderMark": false, - "text": "{\"version\":3,\"file\":\"index.d.ts\",\"sourceRoot\":\"\",\"sources\":[\"../index.ts\"],\"names\":[],\"mappings\":\"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB\"}" + "text": "{\"version\":3,\"file\":\"index.d.ts\",\"sourceRoot\":\"\",\"sources\":[\"../index.ts\"],\"names\":[],\"mappings\":\"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB\"}" }, { "name": "/home/src/workspaces/project/dist/index.d.ts", diff --git a/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping.js b/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping.js index 7594be8aef360..f3dfdccb8ab3f 100644 --- a/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping.js +++ b/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping.js @@ -29,7 +29,7 @@ export interface SomeType { //# sourceMappingURL=index.d.ts.map //// [/home/src/workspaces/project/dist/index.d.ts.map] -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} //// [/home/src/workspaces/project/dist/index.js] "use strict"; @@ -410,7 +410,7 @@ Info seq [hh:mm:ss:mss] response: { "name": "/home/src/workspaces/project/dist/index.d.ts.map", "writeByteOrderMark": false, - "text": "{\"version\":3,\"file\":\"index.d.ts\",\"sourceRoot\":\"\",\"sources\":[\"../index.ts\"],\"names\":[],\"mappings\":\"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB\"}" + "text": "{\"version\":3,\"file\":\"index.d.ts\",\"sourceRoot\":\"\",\"sources\":[\"../index.ts\"],\"names\":[],\"mappings\":\"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB\"}" }, { "name": "/home/src/workspaces/project/dist/index.d.ts", diff --git a/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping2.js b/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping2.js index e573902037323..dc4a6b890aa88 100644 --- a/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping2.js +++ b/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping2.js @@ -29,7 +29,7 @@ export interface SomeType { //# sourceMappingURL=index.d.ts.map //// [/home/src/workspaces/project/dist/index.d.ts.map] -{"version":3,"file":"index.d.ts","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} +{"version":3,"file":"index.d.ts","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} //// [/home/src/workspaces/project/dist/index.js] "use strict"; @@ -422,7 +422,7 @@ Info seq [hh:mm:ss:mss] response: { "name": "/home/src/workspaces/project/dist/index.d.ts.map", "writeByteOrderMark": false, - "text": "{\"version\":3,\"file\":\"index.d.ts\",\"sourceRoot\":\"/home/src/workspaces/project/\",\"sources\":[\"index.ts\"],\"names\":[],\"mappings\":\"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB\"}" + "text": "{\"version\":3,\"file\":\"index.d.ts\",\"sourceRoot\":\"/home/src/workspaces/project/\",\"sources\":[\"index.ts\"],\"names\":[],\"mappings\":\"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB\"}" }, { "name": "/home/src/workspaces/project/dist/index.d.ts", diff --git a/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping3.js b/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping3.js index 4fc71d2a08943..d2cfae22f51f6 100644 --- a/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping3.js +++ b/tests/baselines/reference/tsserver/fourslashServer/declarationMapsGeneratedMapsEnableMapping3.js @@ -29,7 +29,7 @@ export interface SomeType { //# sourceMappingURL=index.d.ts.map //// [/home/src/workspaces/project/dist/index.d.ts.map] -{"version":3,"file":"index.d.ts","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} +{"version":3,"file":"index.d.ts","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} //// [/home/src/workspaces/project/dist/index.js] "use strict"; @@ -427,7 +427,7 @@ Info seq [hh:mm:ss:mss] response: { "name": "/home/src/workspaces/project/dist/index.d.ts.map", "writeByteOrderMark": false, - "text": "{\"version\":3,\"file\":\"index.d.ts\",\"sourceRoot\":\"/home/src/workspaces/project/\",\"sources\":[\"index.ts\"],\"names\":[],\"mappings\":\"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB\"}" + "text": "{\"version\":3,\"file\":\"index.d.ts\",\"sourceRoot\":\"/home/src/workspaces/project/\",\"sources\":[\"index.ts\"],\"names\":[],\"mappings\":\"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB\"}" }, { "name": "/home/src/workspaces/project/dist/index.d.ts", diff --git a/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInline.ts b/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInline.ts index fffd4662f0892..d37de4e0b3e58 100644 --- a/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInline.ts +++ b/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInline.ts @@ -54,7 +54,7 @@ //////# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQTtJQUFBO0lBU0EsQ0FBQztJQVBHLHdCQUFVLEdBQVYsVUFBVyxRQUFrQixJQUFjLE9BQU8sUUFBUSxDQUFDLENBQUMsQ0FBQztJQUM3RCx5QkFBVyxHQUFYO1FBQ0ksSUFBSSxJQUFJLENBQUMsTUFBTSxFQUFFLEdBQUcsR0FBRyxFQUFFLENBQUM7WUFDdEIsT0FBTyxFQUFDLENBQUMsRUFBRSxFQUFFLEVBQUMsQ0FBQztRQUNuQixDQUFDO1FBQ0QsT0FBTyxFQUFDLENBQUMsRUFBRSxLQUFLLEVBQUMsQ0FBQztJQUN0QixDQUFDO0lBQ0wsVUFBQztBQUFELENBQUMsQUFURCxJQVNDO0FBVFksa0JBQUcifQ== // @Filename: /home/src/workspaces/project/dist/index.d.ts.map -////{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} +////{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} // @Filename: /home/src/workspaces/project/dist/index.d.ts ////export declare class Foo { @@ -83,4 +83,4 @@ verify.getEmitOutput([ verify.baselineGoToImplementation("1");// getImplementationAtPosition verify.baselineGoToType("1");// getTypeDefinitionAtPosition verify.baselineGoToDefinition("1");// getDefinitionAndBoundSpan -verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition \ No newline at end of file +verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition diff --git a/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInlineSources.ts b/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInlineSources.ts index d0720f53a481c..71c87713a1551 100644 --- a/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInlineSources.ts +++ b/tests/cases/fourslash/server/declarationMapsEnableMapping_NoInlineSources.ts @@ -55,7 +55,7 @@ //////# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQTtJQUFBO0lBU0EsQ0FBQztJQVBHLHdCQUFVLEdBQVYsVUFBVyxRQUFrQixJQUFjLE9BQU8sUUFBUSxDQUFDLENBQUMsQ0FBQztJQUM3RCx5QkFBVyxHQUFYO1FBQ0ksSUFBSSxJQUFJLENBQUMsTUFBTSxFQUFFLEdBQUcsR0FBRyxFQUFFLENBQUM7WUFDdEIsT0FBTyxFQUFDLENBQUMsRUFBRSxFQUFFLEVBQUMsQ0FBQztRQUNuQixDQUFDO1FBQ0QsT0FBTyxFQUFDLENBQUMsRUFBRSxLQUFLLEVBQUMsQ0FBQztJQUN0QixDQUFDO0lBQ0wsVUFBQztBQUFELENBQUMsQUFURCxJQVNDO0FBVFksa0JBQUciLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY2xhc3MgRm9vIHtcbiAgICBtZW1iZXI6IHN0cmluZztcbiAgICBtZXRob2ROYW1lKHByb3BOYW1lOiBTb21lVHlwZSk6IFNvbWVUeXBlIHsgcmV0dXJuIHByb3BOYW1lOyB9XG4gICAgb3RoZXJNZXRob2QoKSB7XG4gICAgICAgIGlmIChNYXRoLnJhbmRvbSgpID4gMC41KSB7XG4gICAgICAgICAgICByZXR1cm4ge3g6IDQyfTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4ge3k6IFwieWVzXCJ9O1xuICAgIH1cbn1cblxuZXhwb3J0IGludGVyZmFjZSBTb21lVHlwZSB7XG4gICAgbWVtYmVyOiBudW1iZXI7XG59Il19 // @Filename: /home/src/workspaces/project/dist/index.d.ts.map -////{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} +////{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} // @Filename: /home/src/workspaces/project/dist/index.d.ts ////export declare class Foo { @@ -84,4 +84,4 @@ verify.getEmitOutput([ verify.baselineGoToImplementation("1");// getImplementationAtPosition verify.baselineGoToType("1");// getTypeDefinitionAtPosition verify.baselineGoToDefinition("1");// getDefinitionAndBoundSpan -verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition \ No newline at end of file +verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition diff --git a/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping.ts b/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping.ts index 12f60211ede0c..cae14fcd41839 100644 --- a/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping.ts +++ b/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping.ts @@ -53,7 +53,7 @@ //// // @Filename: /home/src/workspaces/project/dist/index.d.ts.map -////{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} +////{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} // @Filename: /home/src/workspaces/project/dist/index.d.ts ////export declare class Foo { @@ -82,4 +82,4 @@ verify.getEmitOutput([ verify.baselineGoToImplementation("1");// getImplementationAtPosition verify.baselineGoToType("1");// getTypeDefinitionAtPosition verify.baselineGoToDefinition("1");// getDefinitionAndBoundSpan -verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition \ No newline at end of file +verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition diff --git a/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping2.ts b/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping2.ts index fe529c2794925..2d9795e0cab63 100644 --- a/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping2.ts +++ b/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping2.ts @@ -58,7 +58,7 @@ //////# sourceMappingURL=index.js.map // @Filename: /home/src/workspaces/project/dist/index.d.ts.map -////{"version":3,"file":"index.d.ts","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} +////{"version":3,"file":"index.d.ts","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} // @Filename: /home/src/workspaces/project/dist/index.d.ts ////export declare class Foo { diff --git a/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping3.ts b/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping3.ts index b27faeb8919a2..7b9abd8bacd71 100644 --- a/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping3.ts +++ b/tests/cases/fourslash/server/declarationMapsGeneratedMapsEnableMapping3.ts @@ -54,7 +54,7 @@ //// // @Filename: /home/src/workspaces/project/dist/index.d.ts.map -////{"version":3,"file":"index.d.ts","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} +////{"version":3,"file":"index.d.ts","sourceRoot":"/home/src/workspaces/project/","sources":["index.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IACxC,WAAW;QAEK,CAAC;QAEL,CAAC;;QAAD,CAAC;QAFG,CAAC;;CAIpB;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} // @Filename: /home/src/workspaces/project/dist/index.d.ts ////export declare class Foo { @@ -82,4 +82,4 @@ verify.getEmitOutput([ verify.baselineGoToImplementation("1");// getImplementationAtPosition verify.baselineGoToType("1");// getTypeDefinitionAtPosition verify.baselineGoToDefinition("1");// getDefinitionAndBoundSpan -verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition \ No newline at end of file +verify.baselineGetDefinitionAtPosition("1"); // getDefinitionAtPosition From 5a8bc8b0e436d040c71f3bdbd8065cf8a7bb1fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Thu, 19 Sep 2024 21:30:39 +0200 Subject: [PATCH 3/7] revert change to writeFile --- .../unittests/helpers/virtualFileSystemWithWatch.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts index 48545818a1744..f4cd771c092d4 100644 --- a/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts @@ -1158,12 +1158,7 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, // base folder has to be present const base = getDirectoryPath(file.path); - const folder = this.getRealFolder(base); - // this line can throw on purpose, don't use Debug.assert to avoid redundant debugger hits - // eslint-disable-next-line no-restricted-syntax - if (folder === null || folder === undefined) { - throw new Error(`Directory not found: ${base}`); - } + const folder = Debug.checkDefined(this.getRealFolder(base)); if (folder.path === base) { if (!this.fs.has(file.path)) { From aeaede2c48d2db2d94cc7002e52b6922bf47de85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Fri, 20 Sep 2024 09:40:20 +0200 Subject: [PATCH 4/7] use `protocolFileLocationFromSubstring` --- .../unittests/tsserver/projectReferencesSourcemap.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts index a6bd13dd7305d..2e75c7ab9581b 100644 --- a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts +++ b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts @@ -6,6 +6,7 @@ import { closeFilesForSession, createHostWithSolutionBuild, openFilesForSession, + protocolFileLocationFromSubstring, TestSession, TestSessionRequest, } from "../helpers/tsserver.js"; @@ -592,7 +593,7 @@ fn5(); openFilesForSession([mainTs], session); session.executeCommandSeq({ command: ts.server.protocol.CommandTypes.DefinitionAndBoundSpan, - arguments: { file: mainTs.path, line: 3, offset: "caller.foo".length - 2 }, + arguments: protocolFileLocationFromSubstring(mainTs, "foo"), }); baselineTsserverLogs("projectReferencesSourcemap", `dependencyAndUsage/${type}/goto Definition in usage of a property with mapped type origin`, session); }); From 4b57ecb9efc4d7b60fd508eab4ef3c373d528e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Wed, 25 Sep 2024 10:30:09 +0200 Subject: [PATCH 5/7] use `setTextRangeWorker` --- src/compiler/checker.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6f735dae9cce2..8c8a1e76fe2a8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -985,7 +985,6 @@ import { setNodeFlags, setOriginalNode, setParent, - setSourceMapRange, setSyntheticLeadingComments, setTextRange as setTextRangeWorker, setTextRangePosEnd, @@ -7179,7 +7178,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { context.enclosingDeclaration = propertyDeclaration || saveEnclosingDeclaration; const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context); if (propertyDeclaration && (isPropertyAssignment(propertyDeclaration) || isShorthandPropertyAssignment(propertyDeclaration) || isMethodDeclaration(propertyDeclaration) || isMethodSignature(propertyDeclaration) || isPropertySignature(propertyDeclaration) || isPropertyDeclaration(propertyDeclaration) || isGetOrSetAccessorDeclaration(propertyDeclaration))) { - setSourceMapRange(propertyName, propertyDeclaration.name); + setTextRangeWorker(propertyName, propertyDeclaration.name); } context.enclosingDeclaration = saveEnclosingDeclaration; context.approximateLength += symbolName(propertySymbol).length + 1; From ff71ac907db790c9cdf9479923539259ce04a8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Wed, 25 Sep 2024 13:02:18 +0200 Subject: [PATCH 6/7] Revert "use `setTextRangeWorker`" This reverts commit 4b57ecb9efc4d7b60fd508eab4ef3c373d528e69. --- 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 4f22e2842b932..d73c25a74de3d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -987,6 +987,7 @@ import { setNodeFlags, setOriginalNode, setParent, + setSourceMapRange, setSyntheticLeadingComments, setTextRange as setTextRangeWorker, setTextRangePosEnd, @@ -7180,7 +7181,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { context.enclosingDeclaration = propertyDeclaration || saveEnclosingDeclaration; const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context); if (propertyDeclaration && (isPropertyAssignment(propertyDeclaration) || isShorthandPropertyAssignment(propertyDeclaration) || isMethodDeclaration(propertyDeclaration) || isMethodSignature(propertyDeclaration) || isPropertySignature(propertyDeclaration) || isPropertyDeclaration(propertyDeclaration) || isGetOrSetAccessorDeclaration(propertyDeclaration))) { - setTextRangeWorker(propertyName, propertyDeclaration.name); + setSourceMapRange(propertyName, propertyDeclaration.name); } context.enclosingDeclaration = saveEnclosingDeclaration; context.approximateLength += symbolName(propertySymbol).length + 1; From 5dac6a66a2c78550920640d48b47d207565517d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Wed, 25 Sep 2024 13:10:14 +0200 Subject: [PATCH 7/7] move the fix to `getPropertyNameNodeForSymbol` --- src/compiler/checker.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d73c25a74de3d..829ad268b4c0f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7177,12 +7177,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { context.tracker.reportNonSerializableProperty(symbolToString(propertySymbol)); } } - const propertyDeclaration = propertySymbol.valueDeclaration || propertySymbol.declarations?.[0]; - context.enclosingDeclaration = propertyDeclaration || saveEnclosingDeclaration; + context.enclosingDeclaration = propertySymbol.valueDeclaration || propertySymbol.declarations?.[0] || saveEnclosingDeclaration; const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context); - if (propertyDeclaration && (isPropertyAssignment(propertyDeclaration) || isShorthandPropertyAssignment(propertyDeclaration) || isMethodDeclaration(propertyDeclaration) || isMethodSignature(propertyDeclaration) || isPropertySignature(propertyDeclaration) || isPropertyDeclaration(propertyDeclaration) || isGetOrSetAccessorDeclaration(propertyDeclaration))) { - setSourceMapRange(propertyName, propertyDeclaration.name); - } context.enclosingDeclaration = saveEnclosingDeclaration; context.approximateLength += symbolName(propertySymbol).length + 1; @@ -8280,12 +8276,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed); const singleQuote = !!length(symbol.declarations) && every(symbol.declarations, isSingleQuotedStringNamed); const isMethod = !!(symbol.flags & SymbolFlags.Method); - const fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod); - if (fromNameType) { - return fromNameType; + let propertyNameNode = getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod); + if (!propertyNameNode) { + const rawName = unescapeLeadingUnderscores(symbol.escapedName); + propertyNameNode = createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod); + } + const declaration = symbol.valueDeclaration ?? symbol.declarations?.[0]; + if (declaration && (isPropertyAssignment(declaration) || isShorthandPropertyAssignment(declaration) || isMethodDeclaration(declaration) || isMethodSignature(declaration) || isPropertySignature(declaration) || isPropertyDeclaration(declaration) || isGetOrSetAccessorDeclaration(declaration))) { + setSourceMapRange(propertyNameNode, declaration.name); } - const rawName = unescapeLeadingUnderscores(symbol.escapedName); - return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod); + return propertyNameNode; } // See getNameForSymbolFromNameType for a stringy equivalent