Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Persistent HighlighterNew to Visual Studio Code? Get it now.
Persistent Highlighter

Persistent Highlighter

jsfaint

|
595 installs
| (1) | Free
A VS Code extension to highlight text persistently across files and windows.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Persistent Highlighter

A Visual Studio Code extension that lets you persistently highlight text in your code and manage those highlights as reusable rules.

Get started in Persistent Highlighter

screenshot

Features

  • Multi-Language Support: Now supports Chinese, Japanese, Korean, and other non-English text highlighting
  • Persistent Highlighting: Highlights are saved and will reappear when you reopen the file.
  • Smart Word Boundary Detection: Automatic language detection with appropriate boundary matching, including underscore-separated identifiers like hello_world.
  • Partial Symbol Selection Matching: Highlight partial selections that include underscores or punctuation, such as hello_ or hello_w.
  • Multiple Colors: Use a variety of colors to highlight different terms.
  • 25 Built-in Colors: Choose from 25 carefully selected built-in colors.
  • 18 Preset Colors: Quick access to 18 curated preset colors in the custom color picker.
  • Custom Color Support: Use any hex color code for personalized highlighting.
  • Color Selection UI: Easy-to-use color picker for both built-in and custom colors.
  • Tree View Sidebar: Manage all your highlights in a dedicated sidebar view.
  • Startup-Ready Rule List: The Highlights sidebar shows saved rules even when no file editor is active.
  • Workspace Match Navigator: Expand highlight rules in the sidebar to see current-workspace match counts and jump to exact match locations.
  • Annotation Tag Profile: Automatically synchronize high-contrast, bold highlights with distinct semantic colors for common code-note tags such as TODO:, FIXME:, NOTE:, BUG:, HACK:, WARN:, WARNING:, REVIEW:, OPTIMIZE:, XXX:, and DEPRECATED:. Built-in annotation tags always match case-sensitively and use whole-word matching.
  • Ripgrep-Accelerated Workspace Search: Uses system rg/ripgrep when available to speed up workspace match discovery, with a safe built-in VS Code scan fallback.
  • Rule Scope Control: Limit highlights to the current workspace, file, or language.
  • Per-Rule Settings: Toggle enable state, case sensitivity, and match mode for each highlight rule.
  • Regex Rule Validation: Prevents invalid regex patterns from being saved when editing existing regex rules.
  • Cross-Session Persistence: Highlights persist across VS Code sessions.
  • Case Sensitive Matching: Optional case-sensitive search for highlights.
  • Large File Optimization: Intelligent performance optimization for large files.
  • Caching System: Efficient caching mechanism for improved performance.
  • Easy to Use: Simple commands to add, remove, toggle, and manage highlights.
  • Right-Click Context Menu: Quick access to highlighting operations directly from the editor context menu.

Commands

  • Persistent Highlighter: Add Highlight: Adds a highlight to the selected text or the word under the cursor.
  • Persistent Highlighter: Add Custom Color Highlight: Adds a highlight with a custom color chosen from 25 built-in colors or a custom hex color.
  • Persistent Highlighter: Remove Highlight: Removes a highlight from the selected text or the word under the cursor.
  • Persistent Highlighter: Toggle Highlight: Toggles the highlight for the selected text or the word under the cursor.
  • Persistent Highlighter: Toggle Annotation Tag: Toggle a built-in annotation tag between enabled and disabled. Click the eye icon in the sidebar, or run from the Command Palette.
  • Persistent Highlighter: Jump to Next Highlight: Navigate to the next highlight in the current file.
  • Persistent Highlighter: Jump to Previous Highlight: Navigate to the previous highlight in the current file.
  • Persistent Highlighter: Clear All Highlights: Removes all highlights from all files.
  • Persistent Highlighter: Refresh: Refresh the highlights tree view.
  • Persistent Highlighter: Jump to Highlight: Navigate to a specific highlight in the current file.
  • Persistent Highlighter: Edit Highlight Rule: Modify the text, scope, enabled state, case sensitivity, or match mode of an existing highlight.

Installation

  1. Open Visual Studio Code.
  2. Go to the Extensions view (Ctrl+Shift+X).
  3. Search for "Persistent Highlighter" and click "Install".
  4. Reload Visual Studio Code.

Usage

Basic Usage

  1. Select the text you want to highlight or place the cursor on a word.
  2. Open the command palette (Ctrl+Shift+P).
  3. Run one of the Persistent Highlighter commands.

Custom Color Usage

  1. Select the text you want to highlight.
  2. Run Persistent Highlighter: Add Custom Color Highlight.
  3. Choose from 18 preset colors or select "Custom Color".
  4. If choosing custom color, enter a hex color code (e.g., #FF5733).
  5. The highlight will be applied with your chosen color.

Preset Colors: Coral, Turquoise, Sky Blue, Mint, Light Yellow, Plum, Seafoam, Golden, Lavender, Light Blue, Apricot, Light Green, Salmon, Light Purple, Pale Green, Peach, Pale Blue, Rose

Keyboard Shortcuts

  • Shift+F1: Toggle highlight

Right-Click Context Menu

You can now access highlighting operations directly from the editor's right-click context menu:

  1. Right-click on selected text or a word in the editor
  2. Choose from the available highlighting options:
    • Add Highlight: Add a highlight with default color
    • Remove Highlight: Remove existing highlight
    • Toggle Highlight: Toggle highlight on/off
    • Add Custom Color Highlight: Add highlight with custom color

Note: Context menu can be configured in VS Code settings:

  • persistent-highlighter.enableContextMenu: Enable/disable context menu (default: true)
  • persistent-highlighter.contextMenuCollapsed: Show as submenu or direct items (default: false)

Sidebar Management

  1. Open the Explorer sidebar (Ctrl+Shift+E).
  2. Find the "Highlights" section at the bottom.
  3. Use the tree view to:
    • See highlight rules with active-file and current-workspace match counts
    • Expand a rule to list current-workspace match locations
    • Click a match location to open the file and reveal the exact range
    • Edit highlight rules
    • Remove individual highlights
    • Clear all highlights at once

When VS Code starts with no file editor active, the Highlights sidebar still shows your saved rules so you can manage them immediately. In this state, rule descriptions omit active-file counts and show workspace match counts when a workspace is available. Expanding a rule still lists clickable workspace match locations.

Workspace Match Navigator

The sidebar shows both active-file and current-workspace match counts for each rule. Expand a rule to list matching locations across the current workspace, then select a location to open the file and reveal the exact range.

If no editor is active, the sidebar uses the first workspace folder as the workspace context and shows workspace counts without an active-file count.

For best performance, Persistent Highlighter uses the system rg/ripgrep command when it is available. rg is only used to find candidate files quickly; final match ranges are still computed by the extension so existing whole-word, substring, CJK, underscore, and annotation tag matching behavior stays consistent.

Workspace searches skip common binary and non-directly-editable file types, such as PDF, Office documents, archives, media, executables, fonts, and database files. Plain .svg files remain searchable, while compressed .svgz files are skipped.

If rg is missing, times out, errors, or cannot be used for the current workspace or rule type, the extension automatically falls back to the built-in VS Code scan path.

The extension does not install or bundle ripgrep. Install it yourself for faster workspace match discovery:

  • macOS: brew install ripgrep
  • Windows: winget install BurntSushi.ripgrep.MSVC
  • Linux: use your package manager, for example sudo apt install ripgrep

Annotation Tag Profile

The extension automatically creates and synchronizes bold, high-contrast local highlight rules for common code-note tags on activation:

TODO:, FIXME:, NOTE:, BUG:, HACK:, WARN:, WARNING:, REVIEW:, OPTIMIZE:, XXX:, and DEPRECATED:.

Changes to persistent-highlighter.annotationTags are synchronized automatically. Sync creates missing rules, upgrades existing bare built-in annotation rules such as NOTE to NOTE:, re-enables existing equivalent rules when needed, assigns built-in tags distinct high-contrast colors, and does not create duplicates. Extra tags from persistent-highlighter.annotationTags keep the exact configured text and use a deterministic fallback color from the annotation palette.

Use the persistent-highlighter.annotationEnabled setting (default: true) to temporarily hide all annotation tag highlights without deleting their rules. When disabled, annotation rules are hidden from both the editor and the sidebar tree. Rules persist and reappear automatically when the setting is re-enabled.

Each built-in annotation tag can also be toggled individually via the persistent-highlighter.annotationTagStates setting. Click the eye icon ($(eye)) in the sidebar next to any annotation tag to disable it, or click again ($(eye-closed)) to re-enable. Disabled tags remain visible in the sidebar with a disabled icon and description so you can always re-enable them. The global annotationEnabled setting still takes priority over per-tag state — when annotation is globally disabled, per-tag settings are ignored.

Built-in annotation tags always use case-sensitive, whole-word matching, independent of persistent-highlighter.caseSensitive and any stale stored rule fields. For example, built-in TODO: matches TODO: but not todo:. Custom annotation tags keep their configured text and current per-rule matching behavior.

Rule Editing

Use Persistent Highlighter: Edit Highlight Rule from the Command Palette, or click the edit action in the Highlights view, to configure an existing rule:

  1. Select a stored highlight rule.
  2. Choose the setting you want to update.
  3. Apply one of the supported changes:
    • Edit the stored text
    • Switch scope between Global, Current Workspace, Current File, and Current Language
    • Enable or disable the rule without deleting it
    • Toggle case-sensitive matching
    • Change match mode between Whole Word, Substring, and Regex

When a rule is already using Regex mode, editing its text validates the new pattern before saving. Invalid patterns are rejected instead of being stored as broken rules.

Configuration

The extension provides several configuration options to customize behavior:

Search Settings

  • persistent-highlighter.caseSensitive: Enable case-sensitive matching for regular highlights (default: false). Built-in annotation tags are always case-sensitive.

Annotation Tag Settings

  • persistent-highlighter.annotationEnabled: Enable or disable annotation tag highlighting without deleting rules (default: true)
  • persistent-highlighter.annotationTags: Additional annotation tags to automatically synchronize with the built-in annotation tag profile (default: [])
  • persistent-highlighter.annotationTagStates: Per-tag state for built-in annotation tags (default: {}). Key is the tag identity (e.g. TODO, FIXME), value is "enabled" or "disabled". Tags not in the object default to enabled. Global annotationEnabled takes priority.

Context Menu Settings

  • persistent-highlighter.enableContextMenu: Enable right-click context menu for highlighting (default: true)
  • persistent-highlighter.contextMenuCollapsed: Collapse context menu submenus by default (default: false)

To modify these settings, go to VS Code Settings and search for "Persistent Highlighter".

Preset Color Palette

The extension offers 18 carefully selected preset colors:

  • Coral (#FF6B6B)
  • Turquoise (#4ECDC4)
  • Sky Blue (#45B7D1)
  • Mint (#96CEB4)
  • Light Yellow (#FFEAA7)
  • Plum (#DDA0DD)
  • Seafoam (#98D8C8)
  • Golden (#F7DC6F)
  • Lavender (#BB8FCE)
  • Light Blue (#85C1E9)
  • Apricot (#F8C471)
  • Light Green (#82E0AA)
  • Salmon (#F1948A)
  • Light Purple (#D7BDE2)
  • Pale Green (#A9DFBF)
  • Peach (#FAD7A0)
  • Pale Blue (#AED6F1)
  • Rose (#F5B7B1)

Recent Updates

Version 0.4.1

  • Security: Reject dangerous regex patterns (nested quantifiers / repeated alternation) that could freeze the editor, plus a per-scan execution budget as a second line of defense

  • Bug Fixes:

    • Highlight rule IDs no longer collide for different-cased texts (Foo vs foo); legacy stored IDs are migrated automatically
    • Removing/editing a custom-color rule no longer wrongly disposes decoration types for longer texts with the same prefix (foo vs foobar)
    • Toggling a disabled rule now re-enables it instead of silently deleting it (annotation tags restore via their tag state)
    • Removing a highlight with a selection that includes leading/trailing whitespace (e.g. full-line selection) now works
    • Custom colors are rejected for annotation tags instead of being silently ignored
    • Clear All Highlights no longer claims "all cleared" when only annotation tags remain
    • Custom-color decorations are properly released when toggled off
    • Sidebar refresh is debounced to avoid spawning ripgrep on every keystroke
    • Workspace match counts now cover all folders in multi-root workspaces when no editor is active
    • Zero-width regex matches at the end of text are no longer dropped
  • Cleanup: Removed dead code (#highlightCache, findWholeWord) and their tests

  • Testing:

    • Added regression tests for all of the above
    • Test suite now passes with 109 tests
  • Code Refactoring:

    • Extracted AnnotationTagManager from HighlightManager for single-responsibility separation
    • Added IDecoratorManager interface to decouple decorator logic from decoration type management
    • Cleaned up dead code and unused configuration
    • Simplified code patterns and added type guards for better runtime safety
  • Testing:

    • Added tests for annotation tag toggle, highlight term utils, and decorator manager
    • Updated test mocks and assertions for new interfaces
    • Test suite now passes with 132 tests (up from 108)

Version 0.3.4

  • Per-Tag Annotation Toggle:
    • Added persistent-highlighter.annotationTagStates setting for individual tag enable/disable
    • Click the eye icon in the sidebar to toggle any annotation tag on or off
    • Disabled tags remain visible in the sidebar with an eye-closed icon, always accessible for re-enable
    • Global annotationEnabled still takes priority over per-tag settings
    • Removed "removed" state — the toggle is purely on/off, no destructive operations
  • Clear All Highlights now preserves annotation tags instead of deleting them
  • Testing:
    • Test suite now passes with 108 tests

Version 0.3.3

  • Annotation Toggle:
    • Added persistent-highlighter.annotationEnabled setting (default: true) to temporarily hide all annotation tag highlights without deleting rules
    • When disabled, annotation rules are hidden from both the editor and the sidebar tree
    • Rules persist and reappear automatically when re-enabled
  • Testing:
    • Added regression coverage for annotation toggle behavior in tree view and manager
    • Test suite now passes with 108 tests

Version 0.3.2

  • Annotation Tag Matching:
    • Built-in annotation tags now always use case-sensitive matching, so TODO: does not match todo:
    • Built-in annotation tags now always use whole-word matching, including during editor scans and workspace match navigation
    • Stored built-in annotation rules with stale case sensitivity or match mode fields are normalized back to the built-in behavior
    • Custom annotation tags from persistent-highlighter.annotationTags keep their configured text and per-rule matching behavior
  • Testing:
    • Added regression coverage for built-in annotation tag normalization, editor matching, and workspace search behavior
    • Test suite now passes with 106 tests

Version 0.3.1

  • Highlights Sidebar Startup State:
    • Shows saved highlight rules even when no file editor is active
    • Keeps rule management actions available from the sidebar immediately after startup
    • Shows workspace match counts without displaying 0 in file when there is no active editor
    • Keeps expandable workspace match locations clickable without requiring an active editor first
  • Testing:
    • Added regression coverage for no-active-editor sidebar rule rendering and command wiring
    • Test suite now passes with 97 tests

Version 0.3.0

  • Workspace Match Navigator:
    • Added current-workspace match counts in the Highlights sidebar
    • Added expandable match location rows that open files and reveal exact ranges
    • Uses system rg when available to speed up workspace candidate discovery, with a safe VS Code scan fallback
    • Skips common binary and non-directly-editable file types during workspace searches
  • Annotation Tag Profile:
    • Automatically synchronizes common code-note tags on activation and configuration changes
    • Built-in tags match the trailing colon, such as TODO: and NOTE:
    • Built-in annotation tags use distinct bold, high-contrast semantic colors
    • Custom tags from persistent-highlighter.annotationTags keep their exact configured text
  • Testing:
    • Added coverage for workspace match navigation, annotation tag synchronization, distinct tag colors, colon-suffixed built-ins, and rg fallback behavior
    • Test suite now passes with 97 tests

Version 0.2.1

  • Underscore Selection Fix:
    • Partial selections containing underscores, such as hello_, hello_w, and hello_wo, now highlight correctly inside identifiers like hello_world
    • Alphanumeric word matching treats underscores as boundaries, so hello and world still match inside hello_world
  • Testing:
    • Added regression coverage for underscore boundary matching
    • Test suite now passes with 75 tests

Version 0.2.0

  • Scoped Highlight Rules:
    • Added per-rule scope control for Global, Current Workspace, Current File, and Current Language
    • Sidebar entries now display scope and match mode so you can understand rule behavior at a glance
  • Rule Management Improvements:
    • Added Persistent Highlighter: Edit Highlight Rule
    • Each rule can now toggle enabled state, case sensitivity, and match mode independently
    • Invalid regex edits are now blocked before they can be persisted
  • Testing and Type Safety:
    • Added regression coverage for regex rule editing
    • Tightened test mocks and removed the remaining non-null assertion in DecoratorManager
    • Test suite now passes with 73 tests

Version 0.1.0

  • Major Code Quality Improvements:
    • Applied Clean Code principles throughout the entire codebase
    • Eliminated approximately 75 lines of duplicate code through method extraction
    • Reduced total code by 15 lines while improving maintainability
    • Extracted MAX_REGEX_MATCHES constant to eliminate magic numbers
    • Removed duplicate isTermInFile method, now using shared EditorUtils implementation
    • Extracted executeRegexWithSafety method to eliminate duplicate regex matching logic
    • Unified color key generation logic in DecoratorManager
    • Extracted getCommandConfig method to separate command configuration from registration
    • Extracted getColorPickerOptions method to separate color options from picker logic
    • Removed redundant HighlightTerm interface, now using HighlightedTerm from types
  • TypeScript Modernization:
    • Upgraded TypeScript target from ES2020 to ES2023
    • Used TypeScript private fields (#) syntax for better encapsulation in HighlightManager
    • Simplified code with optional chaining and nullish coalescing operators
    • Replaced manual loops with findLast for cleaner, more efficient code
    • Improved type safety with at() method for array access
  • Test Coverage:
    • All 68 tests passing at release time
    • Added MockDecorationType class for testing decoration lifecycle
    • Improved test error handling for VS Code decoration types
    • Enhanced test reliability with proper mock implementations
  • Performance Optimizations:
    • Improved regex matching with centralized safety checks
    • Better memory management with proper resource disposal
    • Optimized decoration type creation and caching
  • Documentation:
    • Updated README with comprehensive version history
    • Enhanced architecture documentation with new class details
    • Documented Clean Code principles application

Version 0.0.17

  • Bug Fixes - Memory Management:
    • Fixed memory leak in HighlightManager by adding proper dispose() method
    • Fixed event listener memory leak in HighlightsTreeProvider
    • Ensured all decoration types are properly released on extension deactivation
  • Bug Fixes - Race Conditions:
    • Added document version checking in updateDecorations() to prevent race conditions
    • Improved handling of concurrent document modifications
  • Bug Fixes - Type Safety:
    • Added null checks for customColor properties to prevent runtime crashes
    • Improved getCustomColorKey() to return string | null with proper validation
    • Enhanced input validation in validateActiveEditor() with document existence check
  • Bug Fixes - Infinite Loop Prevention:
    • Added match count limits for regex operations to prevent infinite loops
    • Improved lastIndex handling for zero-width matches
    • Added safety checks for regex operations in all matching loops
  • Unit Testing Enhancements:
    • Added comprehensive tests for dispose() methods
    • Added tests for type safety and null handling
    • Added tests for infinite loop prevention
    • Added tests for edge cases in input validation
    • Added tests for event listener cleanup

Version 0.0.16

  • Unit Testing Infrastructure: Added comprehensive unit testing framework with Mocha and VS Code Test Electron
  • Enhanced Unicode Text Processing: Implemented Unicode-aware text comparison using localeCompare for better international character support
  • Memory Management: Added decorator cleanup logic in removeHighlight and clearAllHighlights to prevent memory leaks
  • Improved Regex Support: Enhanced createHighlightRegex with Unicode property escapes (\p{L}) and fallback support
  • Bug Fixes:
    • Fixed jumpToHighlight range calculation using proper start/end positions
    • Improved case-insensitive comparison for non-English text
    • Added input validation in createHighlightRegex function
  • Build System: Suppressed Node.js deprecation warnings during packaging with cross-env
  • Code Quality: Exported core classes and functions for better testability and modular design

Version 0.0.15

  • Code Refactoring and Cleanup: Streamlined codebase architecture for better maintainability and performance
  • Enhanced Build Scripts: Updated build process with rimraf dependency for cleaner compilation
  • Improved File Structure: Optimized .vscodeignore and project file organization
  • Development Environment: Enhanced development workflow and build automation
  • Performance Optimizations: Internal code improvements for better extension performance

Version 0.0.14

  • Fixed Highlight Display After Selection: Resolved issue where highlights would not properly display after text selection operations
  • Improved Toggle Behavior: Enhanced highlight toggle functionality to prioritize removing highlights over adding new ones for better user experience
  • Code Quality Improvements: Fixed linting issues and improved overall code maintainability
  • Better User Feedback: Improved interaction feedback for highlight operations

Version 0.0.13

  • Fixed Highlight Display Issues: Resolved critical problems with highlight positioning after file modifications, including issues when adding spaces or making small text changes
  • Simplified Update Logic: Removed complex incremental update algorithm that was causing highlight misalignment, replaced with reliable full-document updates
  • Enhanced Stability: Eliminated race conditions and offset calculation errors that were causing highlights to shift incorrectly after text edits
  • Code Cleanup: Removed redundant updateDecorationsIncremental method for cleaner, more maintainable codebase
  • Improved User Experience: Highlights now remain correctly positioned regardless of text modifications, edits, or insertions
  • Better Performance: Streamlined update process reduces computational overhead while maintaining accuracy

Version 0.0.12

  • Multi-Language Support: Now supports highlighting non-English text including Chinese, Japanese, Korean, and other Unicode characters
  • Improved Word Boundary Detection: Enhanced regex pattern matching for better accuracy with mixed-language content
  • Smart Boundary Recognition: Automatically detects text language and applies appropriate boundary matching
  • Backward Compatibility: English text highlighting continues to work exactly as before

Version 0.0.11

  • Right-Click Context Menu: Add context menu support for quick highlighting operations
  • Context Menu Configuration: Add settings to enable/disable and customize context menu behavior
  • Improved User Experience: Direct access to highlighting features from editor context menu
  • Submenu Support: Optional collapsed submenu mode for cleaner context menu organization

Version 0.0.9

  • Update version to 0.0.9: Keep project version up to date
  • Fix invalid highlight text provided issue: Prevents adding empty or whitespace-only highlights
  • Remove redundant clearAllFromTreeCommand: Streamlined command list for clarity
  • Update gitignore and vscodeignore: Keep project files clean and optimized

Version 0.0.7

  • Jump to Next/Previous Highlight: Add new command for navigation between highlights
  • Cyclic Navigation: Highlights cycle through the file when reaching end/beginning
  • Case-sensitive Support: Navigation respects the case-sensitive configuration setting
  • Improved User Experience: Seamless highlight navigation with appropriate warning messages

Version 0.0.6

  • Fixed greedy matching issue: Highlights now use whole-word matching with proper word boundaries
  • Improved search accuracy: Enhanced jumpToHighlight function to use whole-word matching
  • Better text matching: Fixed issue where partial word matches were incorrectly highlighted
  • Performance maintained: All optimizations and caching systems remain intact

Version 0.0.5

  • Added intelligent caching system for improved performance
  • Implemented large file optimization with configurable chunk processing
  • Added case-sensitive matching option
  • Enhanced custom color picker with 18 preset colors
  • Improved sidebar tree view with better highlight management
  • Added incremental document change processing

Development

Prerequisites

  • Node.js (version 16 or higher)
  • Visual Studio Code
  • TypeScript
  • Optional: ripgrep (rg) for faster workspace match scanning (brew install ripgrep, winget install BurntSushi.ripgrep.MSVC, or your Linux package manager)

Development Setup

# Clone the repository
git clone https://github.com/jsfaint/persistent-highlighter.git
cd persistent-highlighter

# Install dependencies
npm install

# Compile TypeScript
npm run compile

# Run in development mode (watch)
npm run watch

# Run linting
npm run lint

# Run unit tests
npm run test

# Compile test code
npm run compile:test

# Watch mode for test code
npm run watch:test

# Clean build output
npm run clean

# Package extension
npm run package

Architecture

The extension uses a comprehensive architecture with:

  • HighlightManager class: Central manager for all highlighting operations with caching support and TypeScript private fields
  • HighlightsTreeProvider class: Manages the sidebar tree view for highlight management with proper event listener cleanup
  • DecoratorManager class: Handles all text decoration creation, application, and disposal with unified color key generation
  • EditorUtils class: Provides shared utility functions for editor operations, including regex matching with safety checks
  • WorkspaceMatchUtils class: Scans the current workspace for match locations, using system rg as a fast candidate-file path when available and falling back to VS Code file scanning when it is unavailable or unsuitable
  • RegexCache class: Singleton pattern for caching regex expressions with FIFO eviction policy and lastIndex reset
  • ColorUtils class: Handles color conversion and validation operations
  • Unit Testing: Comprehensive test suite using Mocha framework with VS Code Test Electron (97 passing tests)
  • VS Code API integration: Uses TextEditorDecorationType for rendering highlights
  • State persistence: Uses globalState to store highlights across sessions
  • Event-driven updates: Listens to document changes, active editor changes, and configuration changes
  • Performance optimization: Intelligent caching, large file handling, rg-first workspace candidate scanning, and regex safety limits (MAX_REGEX_MATCHES)
  • Custom color management: Dynamic decoration type creation for custom colors with proper disposal
  • Annotation tag management: Automatically synchronized bold, high-contrast code-note rules with distinct semantic colors
  • Memory management: Automatic decorator cleanup and proper resource disposal
  • Unicode support: Advanced text comparison using localeCompare for international characters
  • Code quality: Follows Clean Code principles with minimal code duplication and clear separation of concerns
  • Modern TypeScript: Uses ES2023 features and private field syntax for better encapsulation

License

This project is open source. Please see the LICENSE file for details.

Contributing

Welcome to submit Issues and Pull Requests!

Links

  • VS Code Marketplace: Persistent Highlighter
  • GitHub Repository: jsfaint/persistent-highlighter
  • Issue Reporting: GitHub Issues

⭐ If this extension helps you, please consider giving us a five-star rating on the VS Code Marketplace!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft