Added explanation comment for excluding files.

This commit is contained in:
Armando Aguirre 2017-07-19 15:42:01 -07:00
parent 6f28f83f18
commit 9bdd17e842
4 changed files with 14 additions and 4 deletions

View file

@ -1834,7 +1834,8 @@ namespace ts {
const fileContents = sourceFile.text;
const result: TodoComment[] = [];
if (descriptors.length > 0 && !isNodeModulesFile(fileName)) {
// 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;

View file

@ -1,6 +1,8 @@
/// <reference path='fourslash.ts' />
// Tests node_modules name in file still gets todos.
// @Filename: /node_modules_todotest0.ts
// @Filename: /node_modules_todoTest0.ts
//// // [|TODO|]
verify.todoCommentsInCurrentFile(["TODO"]);

View file

@ -1,6 +1,11 @@
/// <reference path='fourslash.ts' />
// Tests that todos are not found in node_modules folder.
// @Filename: /node_modules/todotest0.ts
// @Filename: todoTest0.ts
//// import * as foo1 from "fake-module";
// @Filename: node_modules/fake-module/ts.ts
//// // TODO
verify.todoCommentsInCurrentFile(["TODO"]);

View file

@ -1,4 +1,6 @@
// @Filename: dir1/node_modules/todotest0.ts
/// <reference path='fourslash.ts' />
// @Filename: dir1/node_modules/todoTest0.ts
//// // TODO
verify.todoCommentsInCurrentFile(["TODO"]);