diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index b0a64432633..b868286ea51 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1002,10 +1002,10 @@ namespace ts.server { directory, fileOrDirectory => { const fileOrDirectoryPath = this.toPath(fileOrDirectory); - const fileSystemResult = project.getCachedDirectoryStructureHost().addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); + project.getCachedDirectoryStructureHost().addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); // don't trigger callback on open, existing files - if (project.fileIsOpen(fileOrDirectoryPath) && fileSystemResult && fileSystemResult.fileExists) { + if (project.fileIsOpen(fileOrDirectoryPath)) { return; } diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index dcbff895f1d..409ce5c525f 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -1343,7 +1343,7 @@ var x = 10;` it("no project structure update on directory watch invoke on open file save", () => { const projectRootPath = "/users/username/projects/project"; - const fileA: File = { + const file1: File = { path: `${projectRootPath}/a.ts`, content: "export const a = 10;" }; @@ -1351,13 +1351,13 @@ var x = 10;` path: `${projectRootPath}/tsconfig.json`, content: "{}" }; - const files = [fileA, config]; + const files = [file1, config]; const host = createServerHost(files); const service = createProjectService(host); - service.openClientFile(fileA.path); + service.openClientFile(file1.path); checkNumberOfProjects(service, { configuredProjects: 1 }); - host.invokeWatchedDirectoriesRecursiveCallback(projectRootPath, "a.ts"); + host.modifyFile(file1.path, file1.content, { invokeFileDeleteCreateAsPartInsteadOfChange: true }); host.checkTimeoutQueueLength(0); }); diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index 05cbf8b9388..768111f3bfe 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.ts @@ -1000,7 +1000,7 @@ export const x = 10;` verifyWatchesWithConfigFile(host, files, file1, expectedNonRelativeDirectories); // invoke callback to simulate saving - host.invokeWatchedDirectoriesRecursiveCallback(projectLocation + "/src", "file1.ts"); + host.modifyFile(file1.path, file1.content, { invokeFileDeleteCreateAsPartInsteadOfChange: true }); host.checkTimeoutQueueLengthAndRun(0); }); }); diff --git a/src/testRunner/unittests/tsserver/syntaxOperations.ts b/src/testRunner/unittests/tsserver/syntaxOperations.ts index 66a962d3625..d3127355191 100644 --- a/src/testRunner/unittests/tsserver/syntaxOperations.ts +++ b/src/testRunner/unittests/tsserver/syntaxOperations.ts @@ -60,13 +60,14 @@ describe("Test Suite 1", () => { const navBarResultUnitTest1 = navBarFull(session, unitTest1); host.deleteFile(unitTest1.path); - host.checkTimeoutQueueLengthAndRun(2); - checkProjectActualFiles(project, expectedFilesWithoutUnitTest1); + host.checkTimeoutQueueLengthAndRun(0); + checkProjectActualFiles(project, expectedFilesWithUnitTest1); session.executeCommandSeq({ command: protocol.CommandTypes.Close, arguments: { file: unitTest1.path } }); + host.checkTimeoutQueueLengthAndRun(2); checkProjectActualFiles(project, expectedFilesWithoutUnitTest1); const unitTest1WithChangedContent: File = {