Problem
Currently, patterns like TODO: are highlighted anywhere they appear in a file, including:
- String literals:
const msg = "TODO: fix this later"
- Variable names:
const TODO_CONFIG = {}
- URLs or other content
This can create visual noise and false positives.
Proposed Solution
Use VS Code's DocumentSemanticTokensProvider or TokenInformation API to determine if a match is within a comment before applying the decoration.
Alternatively, use a simple heuristic: only highlight if the pattern appears after a comment prefix (//, #, /*, --, etc.) on the same line.
Trade-offs
- Semantic tokens: More accurate, but depends on language support and may have performance implications
- Heuristic: Simpler and faster, but may miss some edge cases (e.g., multi-line comments)
Problem
Currently, patterns like
TODO:are highlighted anywhere they appear in a file, including:const msg = "TODO: fix this later"const TODO_CONFIG = {}This can create visual noise and false positives.
Proposed Solution
Use VS Code's DocumentSemanticTokensProvider or TokenInformation API to determine if a match is within a comment before applying the decoration.
Alternatively, use a simple heuristic: only highlight if the pattern appears after a comment prefix (
//,#,/*,--, etc.) on the same line.Trade-offs