From 95072aab824ba8cc591c778efc7c0e622afa2cd2 Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Fri, 17 Jun 2016 17:11:13 -0700 Subject: [PATCH] Responding to PR feedback --- src/compiler/commandLineParser.ts | 8 ++++---- src/compiler/core.ts | 2 +- src/compiler/sys.ts | 10 +++++++++- tests/cases/unittests/cachingInServerLSHost.ts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 2b83690372a..9cca35977be 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -672,7 +672,7 @@ namespace ts { // Skip over any minified JavaScript files (ending in ".min.js") // Skip over dotted files and folders as well - const IgnoreFileNamePattern = /(\.min\.js$)|([\\/]\.[\w.])/; + const ignoreFileNamePattern = /(\.min\.js$)|([\\/]\.[\w.])/; /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse @@ -969,7 +969,7 @@ namespace ts { continue; } - if (IgnoreFileNamePattern.test(file)) { + if (ignoreFileNamePattern.test(file)) { continue; } @@ -1055,8 +1055,8 @@ namespace ts { // Remove any subpaths under an existing recursively watched directory. for (const key in wildcardDirectories) { if (hasProperty(wildcardDirectories, key)) { - for (const recursiveKey in recursiveKeys) { - if (containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + for (const recursiveKey of recursiveKeys) { + if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { delete wildcardDirectories[key]; } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 56d8262a3ba..c41b4baa9dc 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1211,7 +1211,7 @@ namespace ts { export function isJsxOrTsxExtension(ext: string): boolean { return ext === ".jsx" || ext === ".tsx"; } - + export function changeExtension(path: T, newExtension: string): T { return (removeFileExtension(path) + newExtension); } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 70fef01b504..8b977c53111 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -381,7 +381,15 @@ namespace ts { continue; } const name = combinePaths(path, entry); - const stat = _fs.statSync(name); + + let stat: any; + try { + stat = _fs.statSync(name); + } + catch (e) { + continue; + } + if (stat.isFile()) { files.push(entry); } diff --git a/tests/cases/unittests/cachingInServerLSHost.ts b/tests/cases/unittests/cachingInServerLSHost.ts index 65f3cb1ed9b..2608a082d6d 100644 --- a/tests/cases/unittests/cachingInServerLSHost.ts +++ b/tests/cases/unittests/cachingInServerLSHost.ts @@ -82,7 +82,7 @@ namespace ts { const projectService = new server.ProjectService(serverHost, logger); const rootScriptInfo = projectService.openFile(rootFile, /* openedByClient */true); const project = projectService.createInferredProject(rootScriptInfo); - project.setProjectOptions( {files: [rootScriptInfo.fileName], compilerOptions: {module: ts.ModuleKind.AMD} } ); + project.setProjectOptions({ files: [rootScriptInfo.fileName], compilerOptions: { module: ts.ModuleKind.AMD } }); return { project, rootScriptInfo