Place anchors within comments or strings to place bookmarks within the context of your code. Anchors can be used to track TODOs, write Notes, create foldable section, or to build a simple navigation, making it easier to navigate large files.
Anchors can be viewed for the current file, or throughout the entire workspace, using an easy to use sidebar.
Comment Anchors provides many configuration options, allowing you to tailor this extension to your personal workflow, and increase productivity. Check below for a complete list of featured!
The changelog can be found here
- Place anchors in any file for any language
- Anchors can be viewed in the anchor list in the activity bar
- Anchor names, colors, highlight colors, and much more can be customized (See below for examples)
- Click an anchor in the anchor list to scroll it into view
- Quickly toggle tag visiblity with commands
- View anchors across your entire workspace
- Scope anchors to be visible in your entire workspace, or just the current file
- Create foldable sections using region anchors
The default settings come with anchors for the following tags:
- ANCHOR - Used to indicate a section in your file
- TODO - An item that is awaiting completion
- FIXME - An item that requires a bugfix
- STUB - Used for generated default snippets
- NOTE - An important note for a specific code section
- REVIEW - An item that needs additional review
- SECTION - Used to define a region (See 'Hierarchical anchors')
In order to make an anchor, simply place the tag name in a comment, with an additional anchor message behind it. The anchor will be automatically detected and added to the Anchor List in the activity sidebar.
All anchor types have their own icon, highlight color, and background color, and more, which can all be customized in the settings. Anchor tags can be added and removed, and can share the same icon or color.
In case you want to disable one or more default tags, simply set the
enabled property to
false (See configuration section).
Besides displaying anchors found in the current file, the sidebar also displays a list of
tags it found across all files in your workspace. These anchors are displayed per file, and can
be used as quick navigation.
The visibility of anchor tags in the workspace list can be altered using the 'scope' property on each tag (See configuration section).
Since workspace anchors are usually scanned at startup, this can increase load time for projects containing many
files and folders. In this case you can enable lazy loading mode, which will require an additional manual trigger to start the scan.
Lazy workspace loading can be enabled in the settings (See configuration section).
Region Anchors allow you to group relevant Comment Anchors together in regions, which can be
folded in both the sidebar and the editor. These anchors act nearly identical to regular anchors,
however they require an "end tag" to be specified, which is simply a tag of the same type, prefixed with an exclamation symbol.
In order to mark a tag as Region Tag, set the
isRegion property to
true in the tags configuration (See configuration section).
A default region tag is provided, called "SECTION"
Comment Anchors supports a vast range of tag customization options. All tags can be modified, including the default tags. This allows you to define tags useful for your workflow.
See the configuration section for a complete list of tag properties.
Comment Anchors can be autocompleted by IntelliSense. Simply start typing an anchor name, or the text "Anchor". This will prompt you with a list of anchors to insert.
> List configured anchor tags
Displays all configured tags in a preview tab, useful for when you are creating your own tags.
> Toggle the visibility of comment anchors
Toggles the visibibility of comment anchors (Duh!). Note that his command will update your settings in order to toggle the visibility.
commentAnchors.parseDelay to alter the delay in milliseconds between when you stop with typing and when the anchor parser starts. Increasing this value can result in better performance. (Default 200)
commentAnchors.scrollPosition to alter where to position the anchor when scrolled to (Default top)
commentAnchors.tagHighlights.enabled to set whether tags are highlighted. (Default true)
commentAnchors.workspace.enabled to activate workspace wide anchor scanning. This will list out all files containing comment anchors in the "Workspace Anchors" view. (Default true)
commentAnchors.workspace.lazyLoad to delay the loading of workspace anchors until a manual confirmation is given. It is discouraged
to disable this setting for large workspaces. (Default true)
commentAnchors.workspace.maxFiles to change how many workspace files will be indexed and displayed in the workspace anchors list. (Default 50)
commentAnchors.workspace.matchFiles to define which files are scanned by Comment Anchors. This setting can be used to greatly increase performance in your projects, as by default most files are scanned.
commentAnchors.workspace.excludeFiles to define which files are excluded from being scanned by Comment Anchors. This setting can be used to greatly increase performance in your projects, as by default only few directories are excluded.
commentAnchors.tags.provideAutoCompletion to enable autocompletion support for anchor tags. (Default true)
commentAnchors.tags.displayInSidebar to set whether tags are included in the sidebar list. (Default true)
commentAnchors.tags.displayInGutter to set whether gutter icons are shown. (Default true)
commentAnchors.tags.displayInRuler to set whether icons are represented by colored bars in the scrollbar ruler. (Default true)
commentAnchors.tags.displayLineNumber to set whether line numbers are displayed in the sidebar (Default true)
commentAnchors.tags.rulerStyle to set the appearance in the overview ruler (Default "center")
commentAnchors.tags.sortMethod to set the method used to sort anchors by in the sidebar list. Set this to "line" to sort by line number (Default), or "type" to sort by tag type.
commentAnchors.tags.separators to set the list of accepted separators
" - "
commentAnchors.tags.list to configure the anchor tags. Below is a list of properties each tag can have.
- tag - Specifies the name of the tag
- scope - The scope of a tag. Specifying "file" will only make these visible in the 'File Anchors' list
- iconColor - The color used for the icon
- highlightColor - The color used for highlighting the tag
- backgroundColor - The color used as tag background
- styleComment - Boolean indicating whether to style the entire comment, or just the tag
- borderStyle - Style to be applied to the tag border (See https://www.w3schools.com/cssref/pr_border.asp)
- borderRadius - The curvature radius of the border (Requires borderStyle)
- isBold - Whether to apply bold formatting to the tag
- isItalic - Whether to apply italicized formatting to the tag
- isRegion - Mark this anchor as a region anchor
- enabled - Allows the disabling of default (and custom) tags
You can use the
enabled property to disable one or more default tags like so:
Comment Anchors provides an array of different icon colors you can use for your anchors. Since these icons have to be made upfront, they cannot be generated from your tag color. This table should help you find the right color to use for each icon.
You can use these colors as value for the
highlightColor property on tags, to make the highlight color fit with the icon color.
Found a problem or missing feature in Comment Anchors?
Issues and suggestions can be submitted in the GitHub repository here
If you prefer more direct help, you can join the Exodius Studios Discord where you can find most developers of this extension.
Comment Anchor scans your entire workspace for tags. This can cause bad performance when your
workspace contains many files, such as dependency directories and logfiles. It is therefore advised to alter the
excludeFiles settings to limit the amount of directories and files scanned.
If you'd rather disable workspace anchors all together, you can disable these in the settings.
You can contribute to comment-anchors by forking the GitHub repository and submitting pull requests.