Skip to content

Commit 90e11f0

Browse files
author
Benjamin Lichtman
committed
Add dynamic file open test
1 parent d4dd930 commit 90e11f0

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/harness/unittests/tsserverProjectSystem.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,28 @@ namespace ts.projectSystem {
11841184
checkNumberOfInferredProjects(projectService, 0);
11851185
});
11861186

1187+
it("external project for dynamic file", () => {
1188+
const file1 = {
1189+
path: "/a/b/f1.ts",
1190+
content: "let x =1;"
1191+
};
1192+
const externalProjectName = "^ScriptDocument1 file1.ts";
1193+
const externalFiles = toExternalFiles(["^ScriptDocument1 file1.ts"]);
1194+
const host = createServerHost([file1]);
1195+
const projectService = createProjectService(host);
1196+
projectService.openExternalProject({
1197+
rootFiles: externalFiles,
1198+
options: {},
1199+
projectFileName: externalProjectName
1200+
});
1201+
1202+
checkNumberOfExternalProjects(projectService, 1);
1203+
checkNumberOfInferredProjects(projectService, 0);
1204+
1205+
externalFiles[0].content = "let x =1;";
1206+
projectService.applyChangesInOpenFiles(externalFiles, [], []);
1207+
});
1208+
11871209
it("external project that included config files", () => {
11881210
const file1 = {
11891211
path: "/a/b/f1.ts",

0 commit comments

Comments
 (0)