@@ -3491,7 +3491,7 @@ namespace ts.projectSystem {
34913491 host.checkTimeoutQueueLength(2); // Update configured project and projects for open file
34923492 checkProjectActualFiles(services.configuredProjects.get(config.path)!, filesWithFileA.map(f => f.path));
34933493
3494- // host.fileExists = originalFileExists;
3494+ // host.fileExists = originalFileExists;
34953495 openFile(fileSubA);
34963496 // This should create inferred project since fileSubA not on the disk
34973497 checkProjectActualFiles(services.configuredProjects.get(config.path)!, mapDefined(filesWithFileA, f => f === fileA ? undefined : f.path));
@@ -3672,7 +3672,7 @@ namespace ts.projectSystem {
36723672 path: `${projectRoot}/app1/tsconfig.json`,
36733673 content: JSON.stringify({
36743674 files: ["app.ts", "../core/core.ts"],
3675- compilerOptions: { outFile : "build/output.js" },
3675+ compilerOptions: { outFile: "build/output.js" },
36763676 compileOnSave: true
36773677 })
36783678 };
@@ -6778,9 +6778,9 @@ namespace ts.projectSystem {
67786778 fileName: "/a.1.ts",
67796779 textChanges: [
67806780 {
6781- start: { line: 0, offset: 0 },
6782- end: { line: 0, offset: 0 },
6783- newText: "export const a = 0;",
6781+ start: { line: 0, offset: 0 },
6782+ end: { line: 0, offset: 0 },
6783+ newText: "export const a = 0;",
67846784 },
67856785 ],
67866786 }
@@ -8672,7 +8672,7 @@ new C();`
86728672 }));
86738673 checkWatchedDirectories(host, [], /*recursive*/ false);
86748674 checkWatchedDirectories(host, arrayFrom(expectedRecursiveDirectories.keys()), /*recursive*/ true);
8675- }
8675+ }
86768676
86778677 describe("from files in same folder", () => {
86788678 function getFiles(fileContent: string) {
@@ -9750,7 +9750,7 @@ declare class TestLib {
97509750 function verifyATsConfigOriginalProject(session: TestSession) {
97519751 checkNumberOfProjects(session.getProjectService(), { inferredProjects: 1, configuredProjects: 1 });
97529752 verifyInferredProjectUnchanged(session);
9753- verifyATsConfigProject(session);
9753+ verifyATsConfigProject(session);
97549754 // Close user file should close all the projects
97559755 closeFilesForSession([userTs], session);
97569756 verifyOnlyOrphanInferredProject(session);
@@ -9900,11 +9900,12 @@ declare class TestLib {
99009900 verifyATsConfigWhenOpened(session);
99019901 });
99029902
9903+ interface ReferencesFullRequest extends protocol.FileLocationRequest { readonly command: protocol.CommandTypes.ReferencesFull; }
9904+ interface ReferencesFullResponse extends protocol.Response { readonly body: ReadonlyArray<ReferencedSymbol>; }
9905+
99039906 it("findAllReferencesFull", () => {
99049907 const session = makeSampleProjects();
99059908
9906- interface ReferencesFullRequest extends protocol.FileLocationRequest { command: protocol.CommandTypes.ReferencesFull; }
9907- interface ReferencesFullResponse extends protocol.Response { body: ReadonlyArray<ReferencedSymbol>; }
99089909 const responseFull = executeSessionRequest<ReferencesFullRequest, ReferencesFullResponse>(session, protocol.CommandTypes.ReferencesFull, protocolFileLocationFromSubstring(userTs, "fnA()"));
99099910
99109911 function fnAVoid(kind: SymbolDisplayPartKind): SymbolDisplayPart[] {
@@ -9961,6 +9962,67 @@ declare class TestLib {
99619962 verifyATsConfigOriginalProject(session);
99629963 });
99639964
9965+ it("findAllReferencesFull definition is in mapped file", () => {
9966+ const aTs: File = { path: "/a/a.ts", content: `function f() {}` };
9967+ const aTsconfig: File = {
9968+ path: "/a/tsconfig.json",
9969+ content: JSON.stringify({ compilerOptions: { declaration: true, declarationMap: true, outFile: "../bin/a.js" } }),
9970+ };
9971+ const bTs: File = { path: "/b/b.ts", content: `f();` };
9972+ const bTsconfig: File = { path: "/b/tsconfig.json", content: JSON.stringify({ references: [{ path: "../a" }] }) };
9973+ const aDts: File = { path: "/bin/a.d.ts", content: `declare function f(): void;\n//# sourceMappingURL=a.d.ts.map` };
9974+ const aDtsMap: File = {
9975+ path: "/bin/a.d.ts.map",
9976+ content: JSON.stringify({ version: 3, file: "a.d.ts", sourceRoot: "", sources: ["../a/a.ts"], names: [], mappings: "AAAA,iBAAS,CAAC,SAAK" }),
9977+ };
9978+
9979+ const session = createSession(createServerHost([aTs, aTsconfig, bTs, bTsconfig, aDts, aDtsMap]));
9980+ checkDeclarationFiles(aTs, session, [aDtsMap, aDts]);
9981+ openFilesForSession([bTs], session);
9982+ checkNumberOfProjects(session.getProjectService(), { configuredProjects: 1 });
9983+
9984+ const responseFull = executeSessionRequest<ReferencesFullRequest, ReferencesFullResponse>(session, protocol.CommandTypes.ReferencesFull, protocolFileLocationFromSubstring(bTs, "f()"));
9985+
9986+ assert.deepEqual<ReadonlyArray<ReferencedSymbol>>(responseFull, [
9987+ {
9988+ definition: {
9989+ containerKind: ScriptElementKind.unknown,
9990+ containerName: "",
9991+ displayParts: [
9992+ keywordPart(SyntaxKind.FunctionKeyword),
9993+ spacePart(),
9994+ displayPart("f", SymbolDisplayPartKind.functionName),
9995+ punctuationPart(SyntaxKind.OpenParenToken),
9996+ punctuationPart(SyntaxKind.CloseParenToken),
9997+ punctuationPart(SyntaxKind.ColonToken),
9998+ spacePart(),
9999+ keywordPart(SyntaxKind.VoidKeyword),
10000+ ],
10001+ fileName: aTs.path,
10002+ kind: ScriptElementKind.functionElement,
10003+ name: "function f(): void",
10004+ textSpan: { start: 9, length: 1 },
10005+ },
10006+ references: [
10007+ {
10008+ fileName: bTs.path,
10009+ isDefinition: false,
10010+ isInString: undefined,
10011+ isWriteAccess: false,
10012+ textSpan: { start: 0, length: 1 },
10013+ },
10014+ {
10015+ fileName: aTs.path,
10016+ isDefinition: true,
10017+ isInString: undefined,
10018+ isWriteAccess: true,
10019+ textSpan: { start: 9, length: 1 },
10020+ },
10021+ ],
10022+ }
10023+ ]);
10024+ });
10025+
996410026 it("findAllReferences -- target does not exist", () => {
996510027 const session = makeSampleProjects();
996610028
0 commit comments