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.
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!
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: