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

binary_file_patterns not loaded from project settings? #57

Open AllanLRH opened 11 years ago

AllanLRH commented 11 years ago

I have a lot of binary files in my project directory. Excluding them the with the file_exclude_patterns works, but the binary_file_patterns does not.

Here is my TODO-relevant project setup:

{
    "folders":
    [
        {
            "path": "/foo/bar/baz",
            "file_exclude_patterns": ["*.sim", "*.dat", "*.nb", "*.m~", "*.hdf"],
            "folder_exclude_patterns": ["folder1", "folder2"],
            "binary_file_patterns": ["*.hdf"]
        }
    ],

    "settings":
    {
        "todo":
        {
            "file_exclude_patterns":
            [
                "*.m~",
                "*.nb"
            ],
            "binary_file_patterns":
            [
                "*.hdf", // They are still searched!
            ]
        }
    }
}

When examening the code for the plugin, I wonder if the settings for binary files is even loaded from anywhere but the global settings... theese lines seems to be responsible for loading the file exclusion patterns. The next-to-last of theese lines is the only place in the file where the word binary is present.

ignored_dirs = settings.get('folder_exclude_patterns', [])
## Get exclude patterns from global settings
## Is there really no better way to access global settings?
global_settings = sublime.load_settings('Global.sublime-settings')
ignored_dirs.extend(global_settings.get('folder_exclude_patterns', []))

exclude_file_patterns = settings.get('file_exclude_patterns', [])
exclude_file_patterns.extend(global_settings.get('file_exclude_patterns', []))
exclude_file_patterns.extend(global_settings.get('binary_file_patterns', []))
exclude_file_patterns = [fnmatch.translate(patt) for patt in exclude_file_patterns]
vovkkk commented 11 years ago

put it outside of todo

"todo":{something},
"binary_file_patterns":[anything]
argyleink commented 9 years ago

I struggled with this today as well. Putting the binary_file_patterns in my sublime user preferences works, but if it's in my sublime-project file, it's ignored. Below is what's in my project file, which the same json works in the user settings:

"settings":
    {
        "tab_size": 2,
        "translate_tabs_to_spaces": true,
        "binary_file_patterns": ["dist/*", "node_modules/*", "app/js/bower/*"]
    }
jonathanrdelgado commented 9 years ago

Just fyi, this project has been deprecated. https://github.com/jonathandelgado/SublimeTodoReview is the successor.

argyleink commented 9 years ago

I see, so a plugin is required. Guess I'll stick my editing my preferences file. Thanks =)

jonathanrdelgado commented 9 years ago

@argyleink I think you misunderstood, this package has been deprecated. You can upgrade to the newer one I mentioned and your problem will be fixed. It's just a fork of this project.

argyleink commented 9 years ago

I did, I also logged an issue on the wrong repo. My comments can be ignored.