Merge pull request #19058 from Microsoft/whenWatchesFail

Swallow the directory watcher exceptions and ignore them
This commit is contained in:
Sheetal Nandi
2017-10-10 18:32:22 -07:00
committed by GitHub
14 changed files with 79 additions and 25 deletions

View File

@@ -195,7 +195,7 @@ namespace ts.Completions.PathCompletions {
const normalizedPrefixDirectory = getDirectoryPath(normalizedPrefix);
const normalizedPrefixBase = getBaseFileName(normalizedPrefix);
const fragmentHasPath = fragment.indexOf(directorySeparator) !== -1;
const fragmentHasPath = stringContains(fragment, directorySeparator);
// Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call
const expandedPrefixDirectory = fragmentHasPath ? combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + getDirectoryPath(fragment)) : normalizedPrefixDirectory;
@@ -235,7 +235,7 @@ namespace ts.Completions.PathCompletions {
function enumeratePotentialNonRelativeModules(fragment: string, scriptPath: string, options: CompilerOptions, typeChecker: TypeChecker, host: LanguageServiceHost): string[] {
// Check If this is a nested module
const isNestedModule = fragment.indexOf(directorySeparator) !== -1;
const isNestedModule = stringContains(fragment, directorySeparator);
const moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(directorySeparator)) : undefined;
// Get modules that the type checker picked up

View File

@@ -660,7 +660,7 @@ namespace ts.refactor.extractSymbol {
function getUniqueName(baseName: string, fileText: string): string {
let nameText = baseName;
for (let i = 1; fileText.indexOf(nameText) !== -1; i++) {
for (let i = 1; stringContains(fileText, nameText); i++) {
nameText = `${baseName}_${i}`;
}
return nameText;

View File

@@ -1952,7 +1952,7 @@ namespace ts {
function isNodeModulesFile(path: string): boolean {
const node_modulesFolderName = "/node_modules/";
return path.indexOf(node_modulesFolderName) !== -1;
return stringContains(path, node_modulesFolderName);
}
}