VS Code Extension – “Todo Tree” can make your coding easier

Highlighting Comments with Todo Tree VS Code Extension

The Todo Tree extension quickly searches your workspace for comment tags like TODO and FIXME, and displays them in a tree view in the activity bar. The view can be dragged out of the activity bar into the explorer pane (or anywhere else you would prefer it to be).

So let’s first download and enable it from the extensions.

It’s now downloaded and has default configurations. But let’s make custom ruleset.

Go to the Manage Option in VS Code.

Now Click on settings

The settings file opens.

Now we have to open the settings.json File. Click on the button at the top right corner.

Now you can paste the below code there and make your custom changes in it!

{
  "todo-tree.highlights.defaultHighlight": {
    "icon": "alert",
    "type": "text-and-comment",
    "foreground": "black",
    "background": "white",
    "opacity": 50,
    "iconColour": "blue",
    "gutterIcon": true
  },
  "todo-tree.highlights.customHighlight": {
    "TODO": {
      "icon": "check",
      "foreground": "black",
      "background": "yellow",
      "iconColour": "yellow"
    },
    "NOTE": {
      "icon": "note",
      "foreground": "white",
      "background": "cornflowerblue",
      "iconColour": "cornflowerblue"
    },
    "USEFUL": {
      "icon": "note",
      "foreground": "black",
      "background": "mediumaquamarine",
      "iconColour": "mediumaquamarine"
    },
    "COMMENT": {
      "icon": "note",
      "foreground": "white",
      "background": "gray",
      "iconColour": "gray"
    },
    "LEARN": {
      "icon": "note",
      "foreground": "white",
      "background": "hotpink",
      "iconColour": "hotpink"
    },
    "FIXME": {
      "foreground": "crimson",
      "background": "burlywood",
      "iconColour": "burlywood"
    },
    "BUG": {
      "foreground": "white",
      "background": "crimson",
      "iconColour": "crimson"
    },
    "SEE NOTES": {
      "icon": "check",
      "foreground": "white",
      "background": "teal",
      "iconColour": "teal"
    },
    "POST": {
      "icon": "check",
      "foreground": "white",
      "background": "green",
      "iconColour": "green"
    },
    "[ ]": {
      "icon": "check",
      "foreground": "black",
      "background": "white",
      "iconColour": "yellow"
    },
    "[x]": {
      "icon": "check",
      "foreground": "white",
      "background": "green",
      "iconColour": "green"
    }
  },
  "todo-tree.general.tags": [
    "BUG",
    "SEE NOTES",
    "HACK",
    "FIXME",
    "TODO",
    "NOTE",
    "POST",
    "USEFUL",
    "LEARN",
    "COMMENT",
    "[ ]",
    "[x]"
  ],
  "todo-tree.regex.regex": "(//|#|<!--|;|/\\*|^|^\\s*(-|\\d+.))\\s*($TAGS).*(\\n\\s*//\\s{2,}.*)*"
}

Here is the final result:

Every Comment comes as a object in this json file. The structure of the object is:

You can add more objects based on this structure and include the object name in:

  • Foreground and background-color can be specified using HTML/CSS colour names (e.g. "Salmon"), RGB hex values (e.g. "#80FF00"), RGB CSS style values (e.g. "rgb(255,128,0)")
  • fontWeightfontStyletextDecoration – can be used to style the highlight with standard CSS values.

Related Posts

vs code tool to lead stack overflow AI

VS Code Tool to Lead Stack Overflow’s New ‘OverflowAI’ Effort

Introducing Stack Overflow for Visual Studio Code—an innovative extension that brings the vast knowledge of Stack Overflow directly to your coding environment. Imagine seamlessly searching, browsing, and posting questions without leaving your favorite code editor. This extension makes it possible, offering a quick and efficient way to access Stack Overflow’s wealth of information. Explore features like natural language or code-based queries, sidebar or webview results, clipboard-friendly code snippets, and even interaction with questions and answers. Plus, it respects your privacy by not collecting personal data. Elevate your coding experience by integrating Stack Overflow into Visual Studio Code—it’s where coding meets collaboration. Try it today and experience a more streamlined development workflow!

Leave a Reply

Your email address will not be published. Required fields are marked *