Open eduardo4jesus opened 1 year ago
add the comment to regex setting
default is:
todo-tree.regex.regex (
(//|#|<!--|;|/\\*|^|^[ \\t]*(-|\\d+.))\\s*($TAGS))
to my understanding of regex, its looking for text that starts with literals (//, # <!--, ;, /*) followed by a tag (TODO, FIXME, etc)
add the literal /* and/or and it should find > /\*\*|\*|
change regex setting to
(//|#|<!--|;|/\*|/\*\*|\*|^|^[ \t]*(-|\d+.))\s*($TAGS)
See it here https://regex101.com/r/S3b75K/1
@Gruntfuggly could we change the default regex to support this ootb? Same comment style is also found in other languages like Java (JavaDoc) + JavaScript (JSDoc/TSDoc).
Based on @smalls89's comment, I added & tested this in ~/.vscode/settings.json
. This change would go into the appropriate line in package.json
.
"todo-tree.regex.regex": "(//|// -|#|<!--|;|\\* -|\\/\\*\\*|\\*|/\\*|^|^[ \\t]*(-|\\d+.))\\s*($TAGS)",
To understand better what changed, I broke down the diff
from the default for todo-tree.regex.regex
from https://github.com/Gruntfuggly/todo-tree/blob/master/package.json
+ "todo-tree.regex.regex": "(//|// -|#|<!--|;|\\* -|\\/\\*\\*|\\*|/\\*|^|^[ \\t]*(-|\\d+.))\\s*($TAGS)",
- // "default": "(// |#|<!--|; |/\\*|^|^[ \\t]*(-|\\d+.))\\s*($TAGS)",
^^^^^^^^^^^^^^^^^^^^ added for /** */ style block comments
^^^^^ added for // -[ ]
Demo of Todo Tree with 3 types of Javascript comments (single line, block no leading character, block with leading `):
todo-tree-demo.js`*
// BUG - bug 🐛 single-line comment // FIXME - needed fixes 🔥 single-line comment // HACK - hack 🔧 single-line comment // TODO - future updates ⚠︎ single-line comment // XXX - XXXXXX single-line comment // -[ ] issue draft // -[x] issue complete /** Block Comment with no leading character BUG - bug 🐛 Block Comment FIXME - needed fixes 🔥 Block Comment HACK - hack 🔧 Block Comment TODO - future updates ⚠︎ Block Comment XXX - XXXXXX Block Comment -[ ] issue draft Block Comment -[x] issue complete Block Comment */ /** Block comments with leading `*` * * BUG - bug 🐛 Block Comment with * * FIXME - needed fixes 🔥 Block Comment with * * HACK - hack 🔧 Block Comment with * * TODO - future updates ⚠︎ Block Comment with * * XXX - XXXXXX Block Comment with * * -[ ] issue draft Block Comment with * * -[x] issue complete Block Comment with * * */
In C/C++ files, TODOs are hightlighted when present in comments like
but not in comments like
what am I missing?