Todo-tree: Exclude folders from search

Created on 17 Jul 2018  路  11Comments  路  Source: Gruntfuggly/todo-tree

It will be very useful to add the option to be able to exclude folders from adding TODO's to the list, sometimes I don't want to see the TODO's inside my imported plugins.

query

Most helpful comment

The glob patterns simply are wrong. The whole file path of every found TODO occurrence will be matched against the glob patterns. This will work:

"todo-tree.excludeGlobs": [
        "**/node_modules/**", "**/dist/**"
],

All 11 comments

Hi - you can use todo-tree.globs for that. E.g., todo-tree.globs: ["!**/node_modules","!**/resources"] should prevent it from entering any node_modules or resources sub folders.

See https://github.com/isaacs/minimatch for more details of glob matching.

An example of this would be great in the readme. I think mostly everyone using this super helpful extension will have a need for filtering a vendor folder.

I read the docs of the linked glob module but it was not right away obvious to me how to exactly define the pattern. Glad I found this issue.

Yes, it sounds like an example would be a good idea. There is actually an example in the configuration itself, but I guess you're unlikely to get there if you don't spot the globs settings.

I'll add an example to the README.md

this was what I had to use to keep away all the TODO's in imported modules

"todo-tree.excludeGlobs": [
"/node_modules/"
],

tried your solution (i.e. /node_modules/) and it reduced the number of todos (somehow) but did not eliminate it. not sure what "todo"??? (see what i did there? :-)

here's a snippet of my setup:

"todo-tree.defaultHighlight": {},
"todo-tree.excludeGlobs": [
        "/node_modules/", "/dist/"
],
"todo-tree.includeGlobs": [
        "**/*.vue", "**/*.js", "**/*.css", "**/*.stylus"
],
"todo-tree.flat": true,
"todo-tree.tags": [
        "TODO",
        "todo",
        "hack",
        "HACK",
        "TBI",
        "tbi",
        "tbv",
        "TBV",
        "FIXME"
    ]

Note also that my DIST folder is also scanned for TODOs even though I tried to exclude it. Also tried all variations of **/node_modules, **/node_modules/*, **/node_modules/**, "node_modules", node_modules/**, node_modules/**/*. None of these worked.

Any reason?

Same problem as stated from @frudman
Any solutions?

The glob patterns simply are wrong. The whole file path of every found TODO occurrence will be matched against the glob patterns. This will work:

"todo-tree.excludeGlobs": [
        "**/node_modules/**", "**/dist/**"
],

The glob patterns simply are wrong. The whole file path of every found TODO occurrence will be matched against the glob patterns. This will work:

"todo-tree.excludeGlobs": [
        "**/node_modules/**", "**/dist/**"
],

thanks, solved my issue =)

It's now todo-tree.filtering.excludeGlobs, instead of todo-tree.excludeGlobs. Just as a heads-up.

The glob patterns simply are wrong. The whole file path of every found TODO occurrence will be matched against the glob patterns. This will work:

"todo-tree.excludeGlobs": [
        "**/node_modules/**", "**/dist/**"
],

I'm from the future. This fix works like a charm. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rickstaa picture rickstaa  路  5Comments

diminutivesloop picture diminutivesloop  路  5Comments

emanuelenardi picture emanuelenardi  路  3Comments

alexwall picture alexwall  路  6Comments

JonathanTroyer picture JonathanTroyer  路  5Comments