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

clarification on the settings option #17

Closed mrvkino closed 12 years ago

mrvkino commented 12 years ago

The only place where the todo option are taken into account are the project setting file. Anywhere else they are ignored.

I'm using the latest version of sublimeTODO, sublime text 2 on lion osx.

robcowie commented 12 years ago

To set globally, add settings to Base File.sublime-settings, via Sublime Text 2... Preferences... File Settings - User

You need to add a 'todo' key to the top-level array and map to that an array, so it looks something like...

{
    // other settings...,

    "todo": {}
}

My current user settings file can be seen at https://gist.github.com/1719536

mrvkino commented 12 years ago

Ok! I think I understand what is happening. Some of the setting put in the "Base File" are over-writted by the "todo" setting in the project setting file.

This Is what I have in my "Base File".

{
// other settings...,

"todo":{
        "result_title": "TODO FILE",
        "patterns": {
            "BUG": "BUG[\\s]*?:+(?P<bug>.*)$",
            "START": "START[\\s]*?:+(?P<start>.*)$"
        }
        "file_exclude_patterns":[
            "*.css"
        ]
    }
}

and this is what I have in my project setting file

{
    "folders":
    [
       // folder
    ]
    "settings":
    {
        "spell_check": false,
        "todo":{
            "patterns":{
                "LIST": "LIST[\\s]*?:+(?P<list>.*)$"
            },
            "folder_exclude_patterns":[
                "reference",
                "RCS",
                "exemple_project",
                "TB_MODULE_record_interface_V1_0",
                "TB_MODULE_flash_data_checker"
            ],
            "file_exclude_patterns":[
                "*.ini","*.t","*.srr","*.ta_Min","*.en*","*.syr","*.htm*","*.log"
            ]
        }
    }
}

If I add a css file in my project it is supposed to be ignored because of the exclude in the "Base File".

"test.css"

BUG: TEST OF CSS
LIST: TEST OF CSS

I get a file called "TODO results" and not "TODO FILE", that contain the following

+ ---------------------------------------------------------------------------- +
| TODOS @ Sunday 19 February 2012 22:53                |
| 322 files scanned                                                     |
+ ---------------------------------------------------------------------------- +

## CHANGED (1)
1. test_make.pl:11 1

## LIST (3)
1. test.css:1  TEST OF CSS
2. TODO.txt:29  Phase one
3. TODO.txt:37  Phase two

## NOTE (1)
1. Base File.sublime-settings:61  word_wrap is explicitly turned off in several syntax specific

## TODO (1)
1. hierarchy.pl:54  Make sure the code is solid

It's missing the BUG and START section even if use these tag in the same file as the LIST or TODO tag. Also, it didn't exclude the css file as specified in the "Base File" because the exclusion was reseted by the project setting file.

The tag BUG and START are not found in my project because the pattern setting of the "Base File" is replaced and not appended by the project setting file. To make it work correctly I have to define a setting once or redefine all the custom option in the project setting file.

My bad! I thought the patterns and exclusion were appended to one another. I will make sure to put my default in the "Base File" and redefine all the "todo" setting in the project setting file if I need it.

robcowie commented 12 years ago

Would it help if exclude and message patterns were appended together from multiple settings files?

mrvkino commented 12 years ago

I don't think it has to change! File and folder exclusion is usually project dependant and the TODO tags are generally the same for all the projects. If the exclude are appended it will be hard to have a default exclusion of files, because in some project you might want to have access to file you usually don't use. Beside, copy-pasting is not very long to do. If I'm the first to make the comment, it doesn't need to change.

It just has to be clear in the README.

robcowie commented 12 years ago

Excellent... I was hoping you'd say that! I'll have a look at the README one day when I'm in a writing mood; I'm sure it can be improved.