lightweight current-file anchor navigator
Lightweight current-file anchor navigator for VS Code.
Hash Anchor only scans the file currently opened in the active editor.
It does NOT:
- scan the workspace
- scan all project files
- scan VS Code's Open Editors list
The extension only reads:
vscode.window.activeTextEditor.document
Features
- Current-file-only anchor navigation
- Sidebar anchor list
- Quick Pick anchor list
- Multi-language anchor support
- Configurable parsing modes
- Large semi-transparent anchor decorations
- Lightweight and fast
- No workspace indexing
Supported Anchor Styles
Hash Anchor supports multiple comment styles.
Examples:
//#anchor render
#anchor init
--#anchor player
<!-- #anchor ui -->
/* #anchor theme */
Empty anchors are also supported:
//#anchor
<!-- #anchor -->
Unnamed anchors will display as:
(line X)
Parsing Rules
Anchors are only matched when the line begins with:
- optional whitespace
- comment prefix or anchor token
#anchor
Examples:
//#anchor valid
//#anchor valid
<!-- #anchor valid -->
These will NOT match:
let a = 0; //#anchor invalid
<div> <!-- #anchor invalid -->
Modes
Auto Mode (default)
Tries:
- language-based parsing
- pattern-based parsing
- bare
#anchor
Language Mode
Uses configured language-specific anchor formats.
Example:
"javascript": "//#anchor ${1:}"
Pattern Mode
Matches generic comment-like prefixes before #anchor.
Useful for unknown or extension-provided languages.
Commands
Open Current File Anchor List
Command:
hashAnchor.lister.keybind
Opens a Quick Pick list of anchors from the current file.
Refresh Anchors
Command:
hashAnchor.refresh
Refreshes the anchor list and decorations.
Keybindings
No default keybinding is registered.
Example:
{
"key": "ctrl+alt+a",
"command": "hashAnchor.lister.keybind"
}
Configuration
Parsing Mode
"hashAnchor.mode": "auto"
Available values:
autolanguagepattern
Pattern Prefix Limit
"hashAnchor.pattern.maxPrefixLength": 4
Limits how many non-whitespace characters are allowed before #anchor in pattern mode.
Range:
1 - 16
Example
//#anchor init
function initialize() {
}
<!-- #anchor ui -->
<div class="container"></div>
#anchor setup
def setup():
pass
Screenshots
Auto-complete support for #anchor markers.
Navigate between anchors quickly using the sidebar and quick picker.