Skip to content

Using the Todo Tree Extension with Code Tags in ML/AI Projects

Overview

The Todo Tree extension for VS Code helps you visualize and manage your code tags effectively. When combined with the previously discussed code tag extensions, this tool can greatly enhance your ability to track and organize TODO comments and other code tags in your machine learning or AI projects.

Why Use the Todo Tree Extension?

The Todo Tree extension provides a powerful way to:

  • Visualize Code Tags: See all TODO comments and other custom tags in a convenient tree view.
  • Navigate Quickly: Jump to specific tags in your code directly from the tree view.
  • Manage Tasks Efficiently: Keep track of what needs to be done, what issues exist, and other important notes directly within your codebase.

Configuring Todo Tree with Code Tags

To integrate the Todo Tree extension with your existing code tags setup, follow these steps:

  1. Install the Todo Tree Extension: If you haven't already, install the Todo Tree extension from the VS Code Marketplace.

    Open VS Code, go to the Extensions view (Ctrl+Shift+X), and search for "Todo Tree". Click "Install".
    
  2. Configure Todo Tree: Update your .vscode/settings.json file to include the relevant tags and settings for the Todo Tree extension.

    // #############################
    // ### Todo Tree ###
    // #############################
    "todo-tree.tree.showScanModeButton": true,
    "todo-tree.tree.showCountsInTree": true,
    "todo-tree.general.tags": [
        "BUG:",
        "NOBUG:",
        "RFE:",
        "IDEA:",
        "???:",
        "!!!:",
        "PORT:",
        "CAVEAT:",
        "FAQ:",
        "GLOSS:",
        "SEE:",
        "TODOC:",
        "CRED:",
        "STAT:",
        "RVD:",
        "NOTE:",
        "HACK:",
        "TODO:"
    ],
    "todo-tree.regex.regex": "((//|#|<!--|;|/\\*|^)\\s*($TAGS)|^\\s*- \\[ \\])",
    "todo-tree.regex.regexCaseSensitive": false,
    "todo-tree.general.tagGroups": {
        "Bugs": ["BUG:", "NOBUG:"],
        "Enhancements": ["RFE:", "IDEA:"],
        "Questions": ["???:", "FAQ:", "SEE:"],
        "Important": ["!!!:", "CAVEAT:", "NOTE:"],
        "Other": ["PORT:", "GLOSS:", "TODOC:", "CRED:", "STAT:", "RVD:", "HACK:", "TODO:"]
    }
    
  3. File Inclusion and Exclusion: Make sure the Todo Tree extension includes and excludes the appropriate files by adding these settings to your .vscode/settings.json file.

    "todohighlight.include": [
        "**/*.js",
        "**/*.jsx",
        "**/*.ts",
        "**/*.tsx",
        "**/*.html",
        "**/*.php",
        "**/*.css",
        "**/*.scss",
        "**/*.py"
    ],
    "todohighlight.exclude": [
        "**/node_modules/**",
        "**/bower_components/**",
        "**/dist/**",
        "**/build/**",
        "**/.vscode/**",
        "**/.github/**",
        "**/_output/**",
        "**/*.min.*",
        "**/*.map",
        "**/.next/**"
    ],
    "todohighlight.defaultStyle": {},
    
  4. Using Todo Tree: Once configured, you can use the Todo Tree extension to view and manage your code tags:

    • Open Todo Tree: Open the Todo Tree view by clicking on the Todo Tree icon in the Activity Bar on the side of VS Code.
    • View Tags: You will see a tree structure listing all your tags under their respective groups.
    • Navigate to Tags: Click on any tag in the tree to jump to its location in your code.

Example Usage

Before Adding Tags

# This function calculates the sum of two numbers
def add(a, b):
    return a + b

# TODO: Add error handling for non-numeric inputs

After Adding Tags

# This function calculates the sum of two numbers
def add(a, b):
    return a + b

# TODO: Add error handling for non-numeric inputs
# BUG: Fix the issue with negative numbers
# IDEA: Optimize this function for large datasets
# NOTE: This function is part of the core module

Visualizing Tags with Todo Tree

Here is an example of how the Todo Tree extension helps visualize code tags within VS Code:

Todo Tree Example

In this screenshot, you can see how various tags are highlighted and organized in a tree structure. This allows you to quickly identify and navigate to specific tags within your codebase.

Conclusion

Using the Todo Tree extension in conjunction with your custom code tags setup allows for efficient management of tasks, bugs, ideas, and notes within your codebase. This setup helps ensure that important items are not overlooked and that your project remains well-organized and maintainable.

For more detailed information and advanced configuration options, refer to the Todo Tree extension documentation.