Skip to content

Configuration Examples

Tʾōmā edited this page Apr 26, 2026 · 34 revisions

Regexs for various languages

If you are modifying the settings directly in settings.json you'll need to escape the backslashes, as shown in these examples. If you are using the setting GUI, you only need one backslash.

Note: I haven't personally tested all of these, so you may need to make further tweaks. https://regex101.com/ is a useful website for experimenting.

COBOL

"todo-tree.regex.regex": "(//|#|<!--|;|/\\*|\\*>|^......\\*)\\s*($TAGS)"

or in the settings GUI:

Todo Tree: Regex: Regex: (//|#|<!--|;|/\*|\*>|^......\*)\s*($TAGS)

Fortran

"todo-tree.regex.regex": "(//|#|<!--|;|/\\*|!|^|^[ \\t]*(-|\\d+.))\\s*($TAGS)"

or in the settings GUI:

Todo Tree: Regex: Regex: (//|#|<!--|;|/\*|!|^|^[ \t]*(-|\d+.))\s*($TAGS)

Haskell

"todo-tree.regex.regex": "((--\\s*($TAGS))|\\{-\\s($TAGS).*(\\n.*)*-})"

or in the settings GUI:

Todo Tree: Regex: Regex ((--\s*($TAGS))|\{-\s($TAGS).*(\n.*)*-})

JavaDoc

"todo-tree.regex.regex": "(//|#|<!--|/\\*|^\\s*\\*)\\s*($TAGS)"

or in the settings GUI:

Todo Tree: Regex: Regex: (//|#|<!--|/\*|^\s*\*)\s*($TAGS)

It will match

  • //
  • #
  • <!--
  • /*,
  • * (for JSDoc)

Also works with JS, BASH, PHP, HTML, CSS, MD, JSON, XML.

LaTeX, MatLab (%comment style)

"todo-tree.regex.regex": "((//|#|<!--|;|/\\*|^|%|\\\\)\\s*($TAGS)\\{*|^\\s*- \\[ \\])",

or in the settings GUI:

Todo Tree: Regex: Regex: ((//|#|<!--|;|/\*|^|%|\\)\s*($TAGS)\{*|^\s*- \[ \])

Note: For LaTeX, you will probably also want to add the tag todo (lowercase), or set todo-tree.regex.regexCaseSensitive to false.

Lua

"todo-tree.regex.regex": "--\\[\\[[\\s|\\n|\\r]*($TAGS)[\\s|\\n|\\r]*\\]\\]|--\\s*($TAGS)",

or in the settings GUI:

Todo Tree: Regex: Regex: --\[\[[\s|\n|\r]*($TAGS)[\s|\n|\r]*\]\]|--\s*($TAGS)

It will match

  • --
  • --[[ ]]
  • --[[
    ]]

Markdown

The following config is useful if you want to highlight incomplete/complete TODOs.

"todo-tree.regex.regex": "((//|#|<!--|;|/\\*|^)\\s*($TAGS)|^//\\s*\\[x\\]|^//\\s*\\[ \\])",
"todo-tree.general.tags": [
  "TODO",
  "[x]",
  "[ ]",
],
"todo-tree.highlights.customHighlight": {
  "[x]":{
    "foreground": "#64dd17",
    "background":"#008800"
  },
  "[ ]":{
    "foreground": "#f44336",
    "background": "#592c2c",
  },
}

Ocaml (and other ML languages using (* comment *) style comments)

"todo-tree.regex.regex": "(//|#|<!--|;|/\\*|^|\\(\\*)\\s*($TAGS)"

or in the settings GUI:

Todo Tree: Regex: Regex: (//|#|<!--|;|/\*|^|\(\*)\s*($TAGS)

PQSL

"todo-tree.regex.regex": "(//|#|<!--|;|/\\*|^|\\(\\*|--)\\s*($TAGS)"

or in the settings GUI:

Todo Tree: Regex: Regex: (//|#|<!--|;|/\*|^|\(\*|--)\s*($TAGS)

PHP

To match standard @todo tags:

"todo-tree.regex.regex": "(//|#|<!--|;|/?\\*|^|^[ \\t]*(-|\\d+.))\\s*($TAGS)",
"todo-tree.general.tags": [
    "@todo",
    "TODO",
    "FIXME"
  ]

Rust

To also match standard todo!() macros:

"todo-tree.regex.regex": "((//|#|<!--|;|/\\*|^)\\s*($TAGS)|($TAGS)!.*)",
"todo-tree.regex.regexCaseSensitive": false,

If you have any TODOs in [doc comments](https://doc.rust-lang.org/reference/comments.html#doc-comments), you can change the regex to support those:

  • (for block doc comments) change the first option // to //!?
  • (for "inner-syntax") change the * option /\\* to /\\*(\\*|!)?

Add PUG, BAT, and Markdown files

  • PUG comments: //- TODO: PUG EXAMPLE (\/\/-|)
  • BAT comments: REM TODO: BAT example (REM|)
  • Markdown list: - TODO: Markdown Example (-|)
"todo-tree.regex.regex": "((\/\/|\/\/-|#|<!--|;|REM|\/\\*|^|-)\\s*($TAGS))"

or in the settings GUI:

Todo Tree: Regex: Regex: ((\/\/|\/\/-|#|<!--|;|REM|\/\*|^|-)\s*($TAGS))

VHDL (including VHDL-2008)

VHDL-93/2002 only supports line comments with --. VHDL-2008 also adds C-style block comments /* ... */. The regex below matches both, plus aligned * lines inside a block comment:

"todo-tree.regex.regex": "(--+|/\\*+|^\\s*\\*)\\s*($TAGS)"

or in the settings GUI:

Todo Tree: Regex: Regex: (--+|/\*+|^\s*\*)\s*($TAGS)

It will match

  • -- TODO: ... (VHDL standard line comment)
  • /* TODO: ... */ (VHDL-2008 block comment)
  • * TODO: ... (aligned line inside a /* ... */ block)

Note: if you only target VHDL-93/2002, you can simplify the regex to (--+)\s*($TAGS). You may also want to add hardware-specific tags such as SYNTH, SIM, TB, TIMING or ASSERT to todo-tree.general.tags.

Vim scripts

"todo-tree.regex.regex": "(\"\\s|//|#|<!--|;|/\\*|^|^[ \\t]*(-|\\d+.))\\s*($TAGS)"

or in the settings GUI:

Todo Tree: Regex: Regex: ("\s|//|#|<!--|;|/\*|^|^[ \t]*(-|\d+.))\s*($TAGS)

Visual Basic (VB)

"todo-tree.regex.regex": "('|//|#|<!--|;|/\\*|^|^[ \\t]*(-|\\d+.))\\s*($TAGS)"

or in the settigns GUI:

Todo Tree: Regex: Regex: ('|//|#|<!--|;|/\*|^|^[ \t]*(-|\d+.))\s*($TAGS)

Generic Catchall

As long as your annotations end with a : you can try: "todo-tree.regex.regex": "((\\s|^)($TAGS):)"

or in the settings GUI:

Todo Tree: Regex: Regex: ((\s|^)($TAGS):)

Multiline regexs

These get quite complex, so you can try the following to see if they work for you...

"todo-tree.regex.regex": "(?:(?://|#|<!--|;|/\\*\\*?|\\*)\\s*($TAGS)|^\\s*- \\[ \\])"
"todo-tree.regex.regex": "((//|#|;|\\*)[ ]*($TAGS)[^\\n]*)|(/\\*(\\*?\\s*)*($TAGS)(.|\\n|\\r)*?\\*/)|(<!--\\s*($TAGS)(.|\\n|\\r)*?-->)"
"todo-tree.regex.regex": "((//|#|;)[ ]*($TAGS)[^\\n]*)|(/\\*(\\*?\\s*)*($TAGS)(.|\\n|\\r)*?\\*/)|(<!--\\s*($TAGS)(.|\\n|\\r)*?-->)"
"todo-tree.regex.regex": "(//|\\*|#|<!--|;|/\\*|^|^[ \\t]*(-|\\d+.))\\s*($TAGS)"

or in the settings GUI:

Todo Tree: Regex: Regex: (?:(?://|#|<!--|;|/\*\*?|\*)\s*($TAGS)|^\s*- \[ \])

Todo Tree: Regex: Regex: ((//|#|;|\*)[ ]*($TAGS)[^\n]*)|(/\*(\*?\s*)*($TAGS)(.|\n|\r)*?\*/)|(<!--\s*($TAGS)(.|\n|\r)*?-->)

Todo Tree: Regex: Regex: ((//|#|;)[ ]*($TAGS)[^\n]*)|(/\*(\*?\s*)*($TAGS)(.|\n|\r)*?\*/)|(<!--\s*($TAGS)(.|\n|\r)*?-->)

Todo Tree: Regex: Regex: (//|\*|#|<!--|;|/\*|^|^[ \t]*(-|\d+.))\s*($TAGS)

Globs

A useful exclude globs list:

"todo-tree.filtering.excludeGlobs": [
        "**/vendor/**",
        "**/node_modules/**",
        "**/dist/**",
        "**/bower_components/**",
        "**/build/**",
        "**/.vscode/**",
        "**/.github/**",
        "**/_output/**",
        "**/*.min.*",
        "**/*.map"
    ]