Skip to content

Commit b9ea347

Browse files
author
Benjamin Lichtman
committed
Simplify test and add explanatory assertion
1 parent 90e11f0 commit b9ea347

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

src/harness/unittests/tsserverProjectSystem.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,13 +1185,9 @@ namespace ts.projectSystem {
11851185
});
11861186

11871187
it("external project for dynamic file", () => {
1188-
const file1 = {
1189-
path: "/a/b/f1.ts",
1190-
content: "let x =1;"
1191-
};
11921188
const externalProjectName = "^ScriptDocument1 file1.ts";
11931189
const externalFiles = toExternalFiles(["^ScriptDocument1 file1.ts"]);
1194-
const host = createServerHost([file1]);
1190+
const host = createServerHost([]);
11951191
const projectService = createProjectService(host);
11961192
projectService.openExternalProject({
11971193
rootFiles: externalFiles,

src/server/editorServices.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,7 @@ namespace ts.server {
17791779
const isDynamic = isDynamicFileName(fileName);
17801780
Debug.assert(isRootedDiskPath(fileName) || isDynamic || openedByClient, "Script info with non-dynamic relative file name can only be open script info");
17811781
Debug.assert(!isRootedDiskPath(fileName) || this.currentDirectory === currentDirectory || !this.openFilesWithNonRootedDiskPath.has(this.toCanonicalFileName(fileName)), "Open script files with non rooted disk path opened with current directory context cannot have same canonical names");
1782+
Debug.assert(!isDynamic || this.currentDirectory === currentDirectory, "Dynamic files must always have current directory context since containing external project name will always match the script info name.");
17821783
// If the file is not opened by client and the file doesnot exist on the disk, return
17831784
if (!openedByClient && !isDynamic && !(hostToQueryFileExistsOn || this.host).fileExists(fileName)) {
17841785
return;

0 commit comments

Comments
 (0)