Skip to content

Adopt GlyphMarginWidgets #185814

Open
Open

Description

@joyceerhl

Part of #179725

We now support creating glyph margin widgets, allowing you to attach click handlers to glyph margin decorations:

/**
* 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:

/**
* 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:

LMK if you have any questions, thanks!

Activity

  1. changed the title [-]Adopt `GlyphMarginWidgets`[/-] [+]Adopt `GlyphMarginWidget`s[/+] on Jun 21, 2023
  2. connor4312 commented on Jun 27, 2023

    @connor4312
    Member

    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.

  3. voigtito commented on Sep 29, 2023

    @voigtito

    Hi, any news on this? 😃

  4. added
    feature-request
    on Dec 4, 2023
  5. added this to the Backlog milestone on Dec 5, 2023
  6. connor4312 commented on Dec 11, 2024

    @connor4312
    Member

    Joyce Er (@joyceerhl) do you think this is still worthwhile to keep open?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

editor-widgetsfeature-request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions