mikaeljorhult / brackets-todo

Brackets/Edge Code extension that displays all TODO comments in current document or project.
144 stars 37 forks source link

A todo within a multiline comment will not show #67

Closed JustinTheClouds closed 10 years ago

JustinTheClouds commented 10 years ago
/**
 * Some Doc Block
 * 
 * @Todo doesn't work
 * Todo: doesn't work
 * Todo doesn't work
 * # Todo: works
 */

I'm guessing this is just a regex issue?

I notice you have a note that says multiline comments will not work and it will only return the first line of the comment. I assume that note was only for comments like the one below?

/* Todo This is a multi
line comment */
sbruchmann commented 10 years ago

The instructions for using JSDoc-style comments can be found at Custom Settings.

JustinTheClouds commented 10 years ago

I tried it with those settings too. No luck though :/

JustinTheClouds commented 10 years ago

I believe there is an error in the JSDoc style example. I'm not very good with regex so I don't see it. But I was debugging and I noticed that when I try to use the JSDoc regex given, it defaults back to the default .todo settings all together and ignores the projects .todo file.

I did though get it working by adding this to the end of the default prefix regex

|\\*

So I ended up with

"prefix": "(?:\\/\\*|\\/\\/|#|\\*) *@?(",

I hope this doesn't match any other code throughout my files that shouldn't be matched. So far so good.

mikaeljorhult commented 10 years ago

Sorry for slow response time. Your initial problem was because of the multiline limitation but the JSDoc example @sbruchmann linked to should work for the @todo comments.

That said, I looked at your given code example and took the opportunity to make some adjustments to the JSDoc example. Please try the code below in your .todo file instead. It might be a bit slower (shouldn't be noticeable though) but will identify all the comments in your example.

{
    "regex": {
        "prefix": "(?:\\* *@*)(",
        "suffix": "):? *(.*?) ?(?=\\n)"
    }
}