robcowie/SublimeTODO

@todo pattern?

Tomzon opened this issue · 4 comments

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

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

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.

@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.

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