@@ -3491,7 +3491,7 @@ namespace ts.projectSystem {
3491
3491
host.checkTimeoutQueueLength(2); // Update configured project and projects for open file
3492
3492
checkProjectActualFiles(services.configuredProjects.get(config.path)!, filesWithFileA.map(f => f.path));
3493
3493
3494
- // host.fileExists = originalFileExists;
3494
+ // host.fileExists = originalFileExists;
3495
3495
openFile(fileSubA);
3496
3496
// This should create inferred project since fileSubA not on the disk
3497
3497
checkProjectActualFiles(services.configuredProjects.get(config.path)!, mapDefined(filesWithFileA, f => f === fileA ? undefined : f.path));
@@ -3672,7 +3672,7 @@ namespace ts.projectSystem {
3672
3672
path: `${projectRoot}/app1/tsconfig.json`,
3673
3673
content: JSON.stringify({
3674
3674
files: ["app.ts", "../core/core.ts"],
3675
- compilerOptions: { outFile : "build/output.js" },
3675
+ compilerOptions: { outFile: "build/output.js" },
3676
3676
compileOnSave: true
3677
3677
})
3678
3678
};
@@ -6778,9 +6778,9 @@ namespace ts.projectSystem {
6778
6778
fileName: "/a.1.ts",
6779
6779
textChanges: [
6780
6780
{
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;",
6784
6784
},
6785
6785
],
6786
6786
}
@@ -8672,7 +8672,7 @@ new C();`
8672
8672
}));
8673
8673
checkWatchedDirectories(host, [], /*recursive*/ false);
8674
8674
checkWatchedDirectories(host, arrayFrom(expectedRecursiveDirectories.keys()), /*recursive*/ true);
8675
- }
8675
+ }
8676
8676
8677
8677
describe("from files in same folder", () => {
8678
8678
function getFiles(fileContent: string) {
@@ -9750,7 +9750,7 @@ declare class TestLib {
9750
9750
function verifyATsConfigOriginalProject(session: TestSession) {
9751
9751
checkNumberOfProjects(session.getProjectService(), { inferredProjects: 1, configuredProjects: 1 });
9752
9752
verifyInferredProjectUnchanged(session);
9753
- verifyATsConfigProject(session);
9753
+ verifyATsConfigProject(session);
9754
9754
// Close user file should close all the projects
9755
9755
closeFilesForSession([userTs], session);
9756
9756
verifyOnlyOrphanInferredProject(session);
@@ -9900,11 +9900,12 @@ declare class TestLib {
9900
9900
verifyATsConfigWhenOpened(session);
9901
9901
});
9902
9902
9903
+ interface ReferencesFullRequest extends protocol.FileLocationRequest { readonly command: protocol.CommandTypes.ReferencesFull; }
9904
+ interface ReferencesFullResponse extends protocol.Response { readonly body: ReadonlyArray<ReferencedSymbol>; }
9905
+
9903
9906
it("findAllReferencesFull", () => {
9904
9907
const session = makeSampleProjects();
9905
9908
9906
- interface ReferencesFullRequest extends protocol.FileLocationRequest { command: protocol.CommandTypes.ReferencesFull; }
9907
- interface ReferencesFullResponse extends protocol.Response { body: ReadonlyArray<ReferencedSymbol>; }
9908
9909
const responseFull = executeSessionRequest<ReferencesFullRequest, ReferencesFullResponse>(session, protocol.CommandTypes.ReferencesFull, protocolFileLocationFromSubstring(userTs, "fnA()"));
9909
9910
9910
9911
function fnAVoid(kind: SymbolDisplayPartKind): SymbolDisplayPart[] {
@@ -9961,6 +9962,67 @@ declare class TestLib {
9961
9962
verifyATsConfigOriginalProject(session);
9962
9963
});
9963
9964
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
+
9964
10026
it("findAllReferences -- target does not exist", () => {
9965
10027
const session = makeSampleProjects();
9966
10028
0 commit comments