This extension quickly searches (using ripgrep) your workspace for comment tags like TODO and FIXME, and displays them in a tree view in the explorer pane. Clicking a TODO within the tree will open the file and put the cursor on the line containing the TODO.
Note: The tree will only appear when it finds some TODOs.
You can install the latest version of the extension via the Visual Studio Marketplace here.
Alternatively, open Visual Studio code, press Ctrl+P
or Cmd+P
and type:
> ext install todo-tree
The source code is available on GitHub here.
The extension can be customised as follows:
Setting | Default | Description |
---|---|---|
todo-tree.rootFolder | "" | The search starts in your current workspace folder (or the workspace of the currently selected file). Change this setting if you want to start somewhere else. You can include environment variables and also use ${workspaceFolder}. e.g. "todo-tree.rootFolder": "${workspaceFolder}/test" or "todo-tree.rootFolder": "${HOME}/project". Note: Other open files (outside of the rootFolder) will be shown (as they are opened) with their full path in brackets.* |
todo-tree.tags | ["TODO","FIXME"] | This defines the tags which are recognised as TODOs. This list is automatically inserted into the regex. |
todo-tree.regex | "((//|#|<!--|;|/\\*)\\s*($TAGS)|^\\s*- \\[ \\])" | This defines the regex used to locate TODOs. By default, it searches for tags in comments starting with //, #, ;, <!-- or /*. This should cover most languages. However if you want to refine it, make sure that the ($TAGS) is kept. The second part of the expression allows matching of Github markdown task lists. Note: This is a Rust regular expression, not javascript. |
todo-tree.globs | [] | If you want to modify the files which are searched, you can define a list of globs. |
todo-tree.ripgrep | "" | Normally, the extension will locate ripgrep itself as and when required. If you want to use an alternate version of ripgrep, set this to point to wherever it is installed. |
todo-tree.ripgrepArgs | "" | Use this to pass additional arguments to ripgrep. e.g. "-i" to make the search case insensitive. Use with caution! |
todo-tree.ripgrepMaxBuffer | 200 | By default, the ripgrep process will have a buffer of 200KB. However, this is sometimes not enough for all the tags you might want to see. This setting can be used to increase the buffer size accordingly. |
todo-tree.expanded | false | If you want the tree to be opened with all nodes expanded, set this to true. By default, the tree will be collapsed. |
todo-tree.flat | false | Set to true to show the tree as a flat list of files (with folder names in brackets). |
todo-tree.icons | {} | Use alternative icons from the octicon set for specific tags, e.g. {"TODO":"pin", "FIXME":"issue-opened"} |
todo-tree.iconColour | "green" | Use this to change the colour of the icon for TODOs in the tree. Can be hex (e.g. "#FF80FF" ) or one of "red", "green", "blue", "yellow", "magenta", "cyan" or "grey". |
todo-tree.iconColours | {} | Use this if you need different icon colours based on the type of tag. The colours can be hex codes, or from the list above, and the match can be a javascript regex. e.g. {"TODO": "#FF80FF","^BUG": "red"}. Note: The colours are applied after the search results, so don't forget to modify todo-tree.tags if you want to add new tags! |
todo-tree.showInExplorer | true | The tree is now also available in the activity bar. If you no longer want to see it in the explorer view, set this to false. |
todo-tree.filterCaseSensitive | false | Use this if you need the filtering to be case sensitive. |
todo-tree.highlight | false | Set this to true to highlight tags in files. |
todo-tree.highlightDelay | 500 | The delay before highlighting (milliseconds). |
Grouping by tag will only work when your configuration defines the tags using the todo-tree.tags
setting. Older versions of the extension had the tags directly defined in the todo-tree.regex
whereas now, the regex replaces $TAGS with the contents of todo-tree.tags
.
Grouping by tag doesn't work for markdown task list items as there is no tag to group with. The tree will show the files alongside the tag groups.
Uses a modified version of ripgrep-js.