Repository navigation
Open
Labels
Milestone
Description
Part of #179725
We now support creating glyph margin widgets, allowing you to attach click handlers to glyph margin decorations:
vscode/src/vs/editor/browser/editorBrowser.ts
Lines 254 to 270 in 343c389
| /** | |
| * A glyph margin widget renders in the editor glyph margin. | |
| */ | |
| export interface IGlyphMarginWidget { | |
| /** | |
| * Get a unique identifier of the glyph widget. | |
| */ | |
| getId(): string; | |
| /** | |
| * Get the dom node of the glyph widget. | |
| */ | |
| getDomNode(): HTMLElement; | |
| /** | |
| * Get the placement of the glyph widget. | |
| */ | |
| getPosition(): IGlyphMarginWidgetPosition; | |
| } |
This should allow you to handle click events for your specific decoration, preventing issues like this: #180789
Your component will need to manage these widgets manually via these methods:
vscode/src/vs/editor/browser/editorBrowser.ts
Lines 1033 to 1045 in 343c389
| /** | |
| * Add a glyph margin widget. Widgets must have unique ids, otherwise they will be overwritten. | |
| */ | |
| addGlyphMarginWidget(widget: IGlyphMarginWidget): void; | |
| /** | |
| * Layout/Reposition a glyph margin widget. This is a ping to the editor to call widget.getPosition() | |
| * and update appropriately. | |
| */ | |
| layoutGlyphMarginWidget(widget: IGlyphMarginWidget): void; | |
| /** | |
| * Remove a glyph margin widget. | |
| */ | |
| removeGlyphMarginWidget(widget: IGlyphMarginWidget): void; |
Please consider adopting for the following decoration types:
- Diff revert arrow Henning Dieterichs (@hediet)
- Test decorations Connor Peet (@connor4312)
- Breakpoint decorations roblourens
LMK if you have any questions, thanks!
Reacted by Alessandro Fragnani
Activity
[-]Adopt `GlyphMarginWidgets`[/-][+]Adopt `GlyphMarginWidget`s[/+]connor4312 commentedon Jun 27, 2023
A behavior that both testing and breakpoint depends on is decorations' behavior of automatically adjusting their position when the text is changed, and they introspect it with
model.getDecorationRange.Currently (testing #186210) it looks like glyphs stay at a static position and ignore editor content changes, and there doesn't seem to be similar introspection available.voigtito commentedon Sep 29, 2023
Hi, any news on this? 😃
connor4312 commentedon Dec 11, 2024
Joyce Er (@joyceerhl) do you think this is still worthwhile to keep open?