robcowie / SublimeTODO

**[DEPRECATED]** - See https://github.com/jonathandelgado/SublimeTodoReview - Extract TODO-type comments from open files and project folders
295 stars 54 forks source link

@todo pattern? #52

Closed Tomzon closed 11 years ago

Tomzon commented 11 years ago

Hi, I've tried everything, can't seem to figure out a pattern that would work with @todo Description (PHPDoc type comments).

Can someone help please? I would be most thankful :).

Tomzon commented 11 years ago

Anyone? It should be an easy fix. It's idiotic to change all @todo-s to TODO-s, just because of this :P

vovkkk commented 11 years ago

Try to put this into your 'Settings - User'

{
    "todo": {
        "patterns": {
            "@todo": "@todo[\\s]*?:?(?P<phptodo>\\S.*)$"
        },
        "case_sensitive": false
    }
}

"case_sensitive": false is not necessary I guess, but it seems more flexible than when it's true.

chadhenry commented 11 years ago

@Tomzon, this is what I have in my 'Settings - User':

{
    "todo": {
        "case_sensitive": false,
        "core_patterns": {
            "@TODO": "@TODO[\\s:]+(?P.*)$",
            "@NOTE": "@NOTE[\\s:]+(?P.*)$",
            "@FIXME": "@FIX ?ME[\\s:]+(?P.*)$",
            "@CHANGED": "@CHANGED[\\s:]+(?P.*)$"
                },
        "patterns": {
            "@SOURCE": "@SOURCE[\\s:]*?:+(?P.*)$"
        },
        "folder_exclude_patterns": [
            "inc"
        ]
    }
}

It will return the following: @todo:, @todo, @TODO:, @TODO - notice capitalization and colons. This may, or may not be the best way to solve your problem but it works for me and I haven't seen any downsides to it yet.

Tomzon commented 11 years ago

Thank you both very much. I was waiting for 11 days and now you gave it in less than an hour. Both are working!

Cheers