Merge pull request #17257 from armanio123/FixNodeModulesTodos

Added node_modules path check on getTodoComments method.
This commit is contained in:
Armando Aguirre
2017-07-20 14:58:36 -07:00
committed by GitHub
4 changed files with 33 additions and 1 deletions

View File

@@ -1834,7 +1834,8 @@ namespace ts {
const fileContents = sourceFile.text;
const result: TodoComment[] = [];
if (descriptors.length > 0) {
// Exclude node_modules files as we don't want to show the todos of external libraries.
if (descriptors.length > 0 && !isNodeModulesFile(sourceFile.fileName)) {
const regExp = getTodoCommentsRegExp();
let matchArray: RegExpExecArray;
@@ -1958,6 +1959,12 @@ namespace ts {
(char >= CharacterCodes.A && char <= CharacterCodes.Z) ||
(char >= CharacterCodes._0 && char <= CharacterCodes._9);
}
function isNodeModulesFile(path: string): boolean {
const node_modulesFolderName = "/node_modules/";
return path.indexOf(node_modulesFolderName) !== -1;
}
}
function getRenameInfo(fileName: string, position: number): RenameInfo {