Skip to content

Commit 796d5bb

Browse files
authored
Merge pull request #31954 from suhasdeshpande/patch-1
fix tsserver picking hidden files created by emacs
2 parents 6def72b + f8004a3 commit 796d5bb

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

src/compiler/sys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ namespace ts {
330330
}
331331

332332
/*@internal*/
333-
export const ignoredPaths = ["/node_modules/.", "/.git"];
333+
export const ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
334334

335335
/*@internal*/
336336
export interface RecursiveDirectoryWatcherHost {

src/testRunner/unittests/tsserver/watchEnvironment.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -171,33 +171,37 @@ namespace ts.projectSystem {
171171
path: `${projectFolder}/node_modules/.cache/someFile.d.ts`,
172172
content: ""
173173
};
174-
host.ensureFileOrFolder(nodeModulesIgnoredFileFromIgnoreDirectory);
175-
host.checkTimeoutQueueLength(0);
176-
verifyProject();
177174

178175
const nodeModulesIgnoredFile: File = {
179176
path: `${projectFolder}/node_modules/.cacheFile.ts`,
180177
content: ""
181178
};
182-
host.ensureFileOrFolder(nodeModulesIgnoredFile);
183-
host.checkTimeoutQueueLength(0);
184-
verifyProject();
185179

186180
const gitIgnoredFileFromIgnoreDirectory: File = {
187181
path: `${projectFolder}/.git/someFile.d.ts`,
188182
content: ""
189183
};
190-
host.ensureFileOrFolder(gitIgnoredFileFromIgnoreDirectory);
191-
host.checkTimeoutQueueLength(0);
192-
verifyProject();
193184

194185
const gitIgnoredFile: File = {
195186
path: `${projectFolder}/.gitCache.d.ts`,
196187
content: ""
197188
};
198-
host.ensureFileOrFolder(gitIgnoredFile);
199-
host.checkTimeoutQueueLength(0);
200-
verifyProject();
189+
const emacsIgnoredFileFromIgnoreDirectory: File = {
190+
path: `${projectFolder}/src/.#field.ts`,
191+
content: ""
192+
};
193+
194+
[
195+
nodeModulesIgnoredFileFromIgnoreDirectory,
196+
nodeModulesIgnoredFile,
197+
gitIgnoredFileFromIgnoreDirectory,
198+
gitIgnoredFile,
199+
emacsIgnoredFileFromIgnoreDirectory
200+
].forEach(ignoredEntity => {
201+
host.ensureFileOrFolder(ignoredEntity);
202+
host.checkTimeoutQueueLength(0);
203+
verifyProject();
204+
});
201205

202206
function verifyProject() {
203207
checkWatchedDirectories(host, emptyArray, /*recursive*/ true);

0 commit comments

Comments
 (0)