Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d0282b7
Add test to verify when source changes
sheetalkamat Jun 13, 2019
0adab89
Use source files instead of .d.ts files from project references
sheetalkamat Jun 21, 2019
c97be16
Log the config of the project
sheetalkamat Jun 21, 2019
746b01e
Check only for .d.ts files
sheetalkamat Jun 21, 2019
ecf8751
Check for language serivice enabled when including source files
sheetalkamat Jun 21, 2019
1810288
Fix tests
sheetalkamat Jun 21, 2019
f472868
Watch generated file if it doesnt exist when trying to translate it t…
sheetalkamat Jun 25, 2019
012ecda
Add sourceOf project reference redirect to filesByName list for redir…
sheetalkamat Jun 26, 2019
2f30add
More tests
sheetalkamat Jun 26, 2019
da9260c
Create original project when location is in source of project referen…
sheetalkamat Jun 26, 2019
75bd3cd
Fix more tests
sheetalkamat Jun 27, 2019
96a8c86
Merge branch 'master' into referencesPrototypeSourceFile
sheetalkamat Jun 28, 2019
f72af3b
Verify the scenarios when d.ts directory of dependency doesnt exist
sheetalkamat Jun 28, 2019
4d13f53
Merge branch 'master' into referencesPrototypeSourceFile
sheetalkamat Jul 1, 2019
f9e4b91
Fix incorrectly exported type
sheetalkamat Jul 1, 2019
f7ea0ba
Refactoring
sheetalkamat Jul 1, 2019
b5737fc
Refactor tests so its easy to edit and reason about them
sheetalkamat Jul 2, 2019
15b68a9
Skip typechecking of source of project reference redirect
sheetalkamat Jul 1, 2019
9be475b
Refactoring
sheetalkamat Jul 3, 2019
b1fa2eb
Errors using DiagnosticsSync commands
sheetalkamat Jul 5, 2019
824c22c
Source of project reference behave as if those files cannot be emitted.
sheetalkamat Jul 8, 2019
b631850
Add option disableSourceOfProjectReferenceRedirect to disable using s…
sheetalkamat Jul 10, 2019
103fe5f
Merge branch 'master' into referencesPrototypeSourceFile
sheetalkamat Jul 11, 2019
666c4be
Merge branch 'master' into referencesPrototypeSourceFile
sheetalkamat Jul 25, 2019
4c4ddf8
Merge branch 'master' into referencesPrototypeSourceFile
sheetalkamat Aug 21, 2019
c6e502b
Verify config file errors
sheetalkamat Aug 22, 2019
076dde4
Test with --out as well
sheetalkamat Aug 22, 2019
a469fd8
Should not report that files are not part of config for files that ar…
sheetalkamat Aug 22, 2019
6e09169
Merge branch 'master' into referencesPrototypeSourceFile
sheetalkamat Aug 22, 2019
54d9ce9
Merge branch 'master' into referencesPrototypeSourceFile
sheetalkamat Sep 5, 2019
b26ca16
Merge branch 'master' into referencesPrototypeSourceFile
sheetalkamat Sep 11, 2019
432da93
Add doc comments for fileExists and directoryExists implementation
sheetalkamat Sep 23, 2019
fd3ba67
Reword the option description per feedback
sheetalkamat Sep 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into referencesPrototypeSourceFile
  • Loading branch information
sheetalkamat committed Jul 1, 2019
commit 4d13f53df8953aea0160f1915ecf977d49a1a9b7
2 changes: 1 addition & 1 deletion src/server/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ namespace ts.server {
const path = this.toPath(sourceFile);
if (this.generatedFilesMap) {
if (isGeneratedFileWatcher(this.generatedFilesMap)) {
Debug.fail(`${this.projectName} Expected not to have --out watcher for generated file with options: ${JSON.stringify(this.compilerOptions)}`);
Debug.fail(`${this.projectName} Expected to not have --out watcher for generated file with options: ${JSON.stringify(this.compilerOptions)}`);
return;
}
if (this.generatedFilesMap.has(path)) return;
Expand Down
75 changes: 75 additions & 0 deletions src/testRunner/unittests/tsserver/projectReferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -815,5 +815,80 @@ ${dependencyTs.content}`);
verifyScenarios(/*withRefs*/ false);
verifyScenarios(/*withRefs*/ true);
});

it("reusing d.ts files from composite and non composite projects", () => {
const projectLocation = "/user/username/projects/myproject";
const configA: File = {
path: `${projectLocation}/compositea/tsconfig.json`,
content: JSON.stringify({
compilerOptions: {
composite: true,
outDir: "../dist/",
rootDir: "../",
baseUrl: "../",
paths: { "@ref/*": ["./dist/*"] }
}
})
};
const aTs: File = {
path: `${projectLocation}/compositea/a.ts`,
content: `import { b } from "@ref/compositeb/b";`
};
const a2Ts: File = {
path: `${projectLocation}/compositea/a2.ts`,
content: `export const x = 10;`
};
const configB: File = {
path: `${projectLocation}/compositeb/tsconfig.json`,
content: configA.content
};
const bTs: File = {
path: `${projectLocation}/compositeb/b.ts`,
content: "export function b() {}"
};
const bDts: File = {
path: `${projectLocation}/dist/compositeb/b.d.ts`,
content: "export declare function b(): void;"
};
const configC: File = {
path: `${projectLocation}/compositec/tsconfig.json`,
content: JSON.stringify({
compilerOptions: {
composite: true,
outDir: "../dist/",
rootDir: "../",
baseUrl: "../",
paths: { "@ref/*": ["./*"] }
},
references: [{ path: "../compositeb" }]
})
};
const cTs: File = {
path: `${projectLocation}/compositec/c.ts`,
content: aTs.content
};
const files = [libFile, aTs, a2Ts, configA, bDts, bTs, configB, cTs, configC];
const host = createServerHost(files);
const service = createProjectService(host);
service.openClientFile(aTs.path);
service.checkNumberOfProjects({ configuredProjects: 1 });

// project A referencing b.d.ts without project reference
const projectA = service.configuredProjects.get(configA.path)!;
assert.isDefined(projectA);
checkProjectActualFiles(projectA, [aTs.path, a2Ts.path, bDts.path, libFile.path, configA.path]);

// reuses b.d.ts but sets the path and resolved path since projectC has project references
// as the real resolution was to b.ts
service.openClientFile(cTs.path);
service.checkNumberOfProjects({ configuredProjects: 2 });
const projectC = service.configuredProjects.get(configC.path)!;
checkProjectActualFiles(projectC, [cTs.path, bTs.path, libFile.path, configC.path]);

// Now new project for project A tries to reuse b but there is no filesByName mapping for b's source location
host.writeFile(a2Ts.path, `${a2Ts.content}export const y = 30;`);
assert.isTrue(projectA.dirty);
projectA.updateGraph();
});
});
}
4 changes: 3 additions & 1 deletion tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8544,13 +8544,15 @@ declare namespace ts.server {
private typeAcquisition;
private directoriesWatchedForWildcards;
readonly canonicalConfigFilePath: NormalizedPath;
private getSourceOfProjectReferenceRedirect;
private projectReferenceCallbacks;
private mapOfDeclarationDirectories;
/** Ref count to the project when opened from external project */
private externalProjectRefCount;
private projectErrors;
private projectReferences;
protected isInitialLoadPending: () => boolean;
fileExists(file: string): boolean;
directoryExists(path: string): boolean;
/**
* If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
* @returns: true if set of files in the project stays the same and false - otherwise.
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.