Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add an option to scan open files only #22

  • Loading branch information...
commit 168125f58797ab29e6ca1801322eb9bb4f8ce0ed 1 parent c9a0215
@robcowie authored
Showing with 15 additions and 3 deletions.
  1. +11 −0 README.markdown
  2. +4 −3 todo.py
View
11 README.markdown
@@ -30,6 +30,7 @@ All plugin configuration must be placed in user or project-specific settings ins
See an example user settings file [here](https://gist.github.com/2049887).
+
## Adding comment patterns
Extraction uses regular expressions that return one match group
@@ -54,6 +55,7 @@ By default, searching is case insensitive. You can change this behaviour by addi
to the todo settings object.
+
## Excluding files and folders
Global settings `folder_exclude_patterns`, `file_exclude_patterns` and `binary_file_patterns` are excluded from search results.
@@ -86,6 +88,15 @@ Override the results view title by setting `result_title`
"result_title": "TODO Results"
```
+## Scanning open files only
+
+If you have a particularly large project (>2k files), you may want to scan only open (saved) files.
+
+```javascript
+"open_files_only": true
+```
+
+
# Usage
`Show TODOs` command can be triggered from the command palette. No default
View
7 todo.py
@@ -320,11 +320,11 @@ def reset(self):
class TodoCommand(sublime_plugin.TextCommand):
- def search_paths(self, window):
+ def search_paths(self, window, open_files_only=False):
"""Return (filepaths, dirpaths)"""
return (
[view.file_name() for view in window.views() if view.file_name()],
- window.folders()
+ window.folders() if not open_files_only else []
)
def run(self, edit):
@@ -333,7 +333,8 @@ def run(self, edit):
## TODO: Cleanup this init code. Maybe move it to the settings object
- filepaths, dirpaths = self.search_paths(window)
+ filepaths, dirpaths = self.search_paths(window,
+ open_files_only=settings.get('open_files_only', False))
ignored_dirs = settings.get('folder_exclude_patterns', [])
## Get exclude patterns from global settings
Please sign in to comment.
Something went wrong with that request. Please try again.