Add optional label support for highlights with hover tooltip - #101
Open
IngDanielALH wants to merge 4 commits into
Open
Add optional label support for highlights with hover tooltip#101IngDanielALH wants to merge 4 commits into
IngDanielALH wants to merge 4 commits into
Conversation
- Decoration entity now supports optional label field - New command "Toggle Highlight with Label" prompts for a label; Esc cancels the whole operation - Hover tooltip renders label as Markdown (MarkdownString) on decorated text - updateHighlight now exposes "Update Label" action in its quick pick menu - Label is serialized/deserialized in savedHighlights for persistence across reloads - All existing tests updated to match new setDecorations/addDecoration signatures Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Label to commandsOnContextMenu schema Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers labeling a new highlight, cancelling the label prompt, toggling off an existing highlight without prompting, and the no-selection no-op case. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
package-lock.json isn't used by this project (it relies on yarn.lock and yarn-based scripts) and yarn.lock had drifted to resolve packages from npmjs.org instead of yarnpkg.com with no actual dependency changes — both were noise left over from local tooling, not part of the label feature. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional label to highlights, shown as a hover tooltip over the highlighted text — useful for annotating why something is marked (e.g.
transaction_id,TODO,CNBV-01) without leaving the editor.textmarker.toggleHighlightWithLabel): prompts for a label when creating a highlight; pressing Esc cancels without decorating. Available on the right-click menu (toggleable viatextmarker.commandsOnContextMenu, on by default) and via the command palette.textmarker.savedHighlights, so they survive editor reloads.Decorationgained an optionallabelfield;DecorationRegistry#issue,DecorationOperator#addDecoration, andTextEditor#setDecorationswere extended to thread it through.Why
Plain highlights are great for spotting patterns, but they don't carry any context about why a piece of text was marked. A label turns a highlight into a lightweight, inline annotation — handy for code review notes, tracking related identifiers across a file, or leaving reminders tied to specific text.
Test plan
npm test— 139 passing (135 existing + 4 new), no regressionstslint -p .— cleansrc/test/unit/commands/toggle-highlight-with-label.test.tscovers: labeling a new selection, cancelling the prompt, toggling off an existing highlight (no prompt shown), and the no-selection no-op casesetDecorations/addDecorationsignatures gained the new optionallabelparameterNotes for the maintainer
2_textmarker@N) was renumbered to fit the new command in right after Toggle Highlight; behaviour of existing entries is unchanged, only their position.textmarker.commandsOnContextMenuconfig gainedtoggleHighlightWithLabel(schema + defaulttrue), matching the pattern of the other toggleable context-menu entries.