From 13b7af6ea0f05be0e3deadab36e0bcad8662e082 Mon Sep 17 00:00:00 2001 From: Suhas Date: Mon, 17 Jun 2019 23:14:02 -0700 Subject: [PATCH 1/3] fix tsserver picking hidden files created by emacs Saw this good for first timers. I followed what @sheetalkamat suggested. #31916 --- src/compiler/sys.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index b1923a73a27..5abc19cdbc4 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -330,7 +330,7 @@ namespace ts { } /*@internal*/ - export const ignoredPaths = ["/node_modules/.", "/.git"]; + export const ignoredPaths = ["/node_modules/.", "/.git", "/.#"]; /*@internal*/ export interface RecursiveDirectoryWatcherHost { From 8a11f1556928bcd20182aa70188d26c22fd57051 Mon Sep 17 00:00:00 2001 From: Suhas Deshpande Date: Tue, 18 Jun 2019 22:50:40 -0700 Subject: [PATCH 2/3] Add unit test --- .../unittests/tsserver/watchEnvironment.ts | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index bc8e84a8025..33a61bedfb2 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -171,33 +171,37 @@ namespace ts.projectSystem { path: `${projectFolder}/node_modules/.cache/someFile.d.ts`, content: "" }; - host.ensureFileOrFolder(nodeModulesIgnoredFileFromIgnoreDirectory); - host.checkTimeoutQueueLength(0); - verifyProject(); const nodeModulesIgnoredFile: File = { path: `${projectFolder}/node_modules/.cacheFile.ts`, content: "" }; - host.ensureFileOrFolder(nodeModulesIgnoredFile); - host.checkTimeoutQueueLength(0); - verifyProject(); const gitIgnoredFileFromIgnoreDirectory: File = { path: `${projectFolder}/.git/someFile.d.ts`, content: "" }; - host.ensureFileOrFolder(gitIgnoredFileFromIgnoreDirectory); - host.checkTimeoutQueueLength(0); - verifyProject(); const gitIgnoredFile: File = { path: `${projectFolder}/.gitCache.d.ts`, content: "" }; - host.ensureFileOrFolder(gitIgnoredFile); - host.checkTimeoutQueueLength(0); - verifyProject(); + const emacsIgnoredFileFromIgnoreDirectory: File = { + path: `${projectFolder}/src/.#field.ts`, + content: "" + }; + + [ + nodeModulesIgnoredFileFromIgnoreDirectory, + nodeModulesIgnoredFile, + gitIgnoredFileFromIgnoreDirectory, + gitIgnoredFile, + emacsIgnoredFileFromIgnoreDirectory + ].forEach(ignoredEntity => { + host.ensureFileOrFolder(ignoredEntity); + host.checkTimeoutQueueLength(0); + verifyProject(); + }) function verifyProject() { checkWatchedDirectories(host, emptyArray, /*recursive*/ true); From f8004a33dd710efa245c856b2652c44ea567210b Mon Sep 17 00:00:00 2001 From: Suhas Deshpande Date: Tue, 18 Jun 2019 23:17:58 -0700 Subject: [PATCH 3/3] semi-colon --- src/testRunner/unittests/tsserver/watchEnvironment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index 33a61bedfb2..5e776aa9908 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -201,7 +201,7 @@ namespace ts.projectSystem { host.ensureFileOrFolder(ignoredEntity); host.checkTimeoutQueueLength(0); verifyProject(); - }) + }); function verifyProject() { checkWatchedDirectories(host, emptyArray, /*recursive*/ true);