Mastering the Comment Anchors Extension in Visual Studio Code

Mastering the Comment Anchors Extension in Visual Studio Code

In the ever-evolving world of software development, keeping your code well-organized and easy to navigate is crucial. One powerful tool to help you achieve this is the Comment Anchors extension in Visual Studio Code (VS Code). This extension allows you to create and manage comment anchors within your code, making it easier to navigate and understand complex projects. In this article, we'll explore how to use the Comment Anchors extension to enhance your coding workflow.

What is Comment Anchors?

Comment Anchors is a VS Code extension that lets you add special markers in your comments, which can then be easily navigated through an integrated panel. These markers help in organizing your code by providing quick access points to important sections or TODOs. This is especially useful in large projects where finding specific pieces of code can be challenging.


To install Comment Anchors in VS Code, follow these steps:

  1. Open VS Code: Launch your Visual Studio Code editor.

  2. Access Extensions: Click on the Extensions view icon on the Sidebar or press Ctrl+Shift+X.

  3. Search for Comment Anchors: Type "Comment Anchors" in the search bar.

  4. Install: Click on the Install button for the Comment Anchors extension by Exodius Studios.

Once installed, you’re ready to start using Comment Anchors to streamline your coding experience.

Basic Usage

Adding Comment Anchors

To add a comment anchor, you simply add a comment in your code with a specific prefix. The most common prefixes are ANCHOR, TODO, FIXME, NOTE, and SECTION. Here’s how you can add these anchors:

// ANCHOR: Imports
import React from 'react';
import { useState } from 'react';

// TODO: Implement dark mode toggle feature
function App() {
  const [count, setCount] = useState(0);

  // FIXME: Resolve issue with negative counter values
  function handleIncrement() {
    setCount(prevCount => prevCount + 1);

  // STUB: Default decrement handler
  function handleDecrement() {
    // TODO: Implement decrement logic

  return (
      {/* NOTE: Button increments the counter */}
      <button onClick={handleIncrement}>Increment</button>

      {/* REVIEW: Ensure counter doesn't display negative values */}
      <p>Counter: {count}</p>

      {/* SECTION: Decrement Button */}
      <button onClick={handleDecrement}>Decrement</button>

export default App;

Each of these prefixes creates a navigable anchor that you can access later.

Viewing and Navigating Anchors

To view and navigate your comment anchors:

  1. Open the Comment Anchors Panel: Go to the Activity Bar and click on the Comment Anchors icon. Alternatively, you can press Ctrl+Shift+P and type "Comment Anchors: Focus Comment Anchors View".

  2. Explore Your Anchors: The panel will display all the anchors in your project, grouped by file. You can click on any anchor to jump directly to that part of the code.

Customizing Comment Anchors

You can customize the appearance and behavior of your comment anchors through the settings:

  1. Open Settings: Press Ctrl+, to open the Settings.

  2. Search for Comment Anchors: Type "Comment Anchors" in the search bar.

  3. Adjust Settings: Here, you can modify various settings such as the types of anchors, their color, and their visibility.

For example, you can change the colors for different anchor types to make them stand out more or less, depending on your preference.

Advanced Features

Custom Anchor Types

You can define your own anchor types if the default ones don’t meet your needs. To do this:

  1. Open Settings JSON: Click on the Open Settings (JSON) icon in the top right corner of the settings page.

  2. Add Custom Types: Add custom anchor types in the JSON file under the commentAnchors.tags array.

"commentAnchors.tags": [
        "name": "HIGHLIGHT",
        "icon": "🌟",
        "color": "#FFD700"
        "name": "IMPORTANT",
        "icon": "⚠️",
        "color": "#FF4500"

These custom types will now be recognized as comment anchors in your code.

Filtering Anchors

You can filter comment anchors by type or by keyword. This is particularly useful when you want to focus on specific types of comments, like TODOs or FIXMEs. Use the search box in the Comment Anchors panel to filter anchors.

Synchronizing Anchors

The extension also allows synchronization of comment anchors across multiple files. This means you can have a unified view of all important comments across your entire project, making it easier to keep track of tasks and important notes.


The Comment Anchors extension is a powerful tool that can significantly improve your productivity in Visual Studio Code. By allowing you to mark and navigate important comments throughout your codebase, it helps keep your projects organized and manageable. Whether you are working on a large project with multiple contributors or a solo venture, Comment Anchors provides a seamless way to keep track of your code.

Install Comment Anchors today and start experiencing a more efficient way to manage and navigate your code!

This guide should give you a solid foundation for using the Comment Anchors extension in VS Code. Happy coding!

Did you find this article valuable?

Support Alain Iglesias by becoming a sponsor. Any amount is appreciated!