Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt GlyphMarginWidgets #185814

Open
1 of 3 tasks
joyceerhl opened this issue Jun 21, 2023 · 3 comments
Open
1 of 3 tasks

Adopt GlyphMarginWidgets #185814

joyceerhl opened this issue Jun 21, 2023 · 3 comments
Assignees
Labels
editor-widgets feature-request Request for new features or functionality
Milestone

Comments

@joyceerhl
Copy link
Collaborator

joyceerhl commented Jun 21, 2023

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!

@joyceerhl joyceerhl changed the title Adopt GlyphMarginWidgets Adopt GlyphMarginWidgets Jun 21, 2023
@connor4312
Copy link
Member

connor4312 commented 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
Copy link

Hi, any news on this? 😃

@connor4312
Copy link
Member

@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
Labels
editor-widgets feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

5 participants