Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceerhl committed Jun 13, 2023
1 parent a1a890f commit fda41b8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 0 additions & 4 deletions src/vs/editor/browser/editorBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,6 @@ export interface IOverlayWidget {
* A glyph margin widget renders in the editor glyph margin.
*/
export interface IGlyphMarginWidget {
/**
* The class name to apply to the glyph widget.
*/
className: string;
/**
* Get a unique identifier of the glyph widget.
*/
Expand Down
12 changes: 9 additions & 3 deletions src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import 'vs/css!./glyphMargin';
import { DynamicViewOverlay } from 'vs/editor/browser/view/dynamicViewOverlay';
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
import { Range } from 'vs/editor/common/core/range';
import { IGlyphMarginWidget, IGlyphMarginWidgetPosition } from 'vs/editor/browser/editorBrowser';
import { ViewPart } from 'vs/editor/browser/view/viewPart';
import { ViewContext } from 'vs/editor/common/viewModel/viewContext';
Expand Down Expand Up @@ -262,7 +263,9 @@ export class GlyphMarginWidgets extends ViewPart {

public setWidgetPosition(widget: IGlyphMarginWidget, preference: IGlyphMarginWidgetPosition): boolean {
const myWidget = this._widgets[widget.getId()];
if (myWidget.preference === preference) {
if (myWidget.preference.lane === preference.lane
&& myWidget.preference.zIndex === preference.zIndex
&& Range.equalsRange(myWidget.preference.range, preference.range)) {
return false;
}

Expand Down Expand Up @@ -301,7 +304,7 @@ export class GlyphMarginWidgets extends ViewPart {
const widgets = Object.values(this._widgets);
for (let i = 0, len = widgets.length; i < len; i++) {
const w = widgets[i];
const glyphMarginClassName = w.widget.className;
const glyphMarginClassName = w.widget.getDomNode().className;
if (glyphMarginClassName) {
r[rLen++] = new DecorationToRender(w.preference.range.startLineNumber, w.preference.range.endLineNumber, glyphMarginClassName, w.preference.zIndex, w.preference.lane, w.domNode);
}
Expand Down Expand Up @@ -438,7 +441,10 @@ export class GlyphMarginWidgets extends ViewPart {
}

private _renderWidget(ctx: RestrictedRenderingContext, renderedWidget: GlyphMarginWidget): void {
renderedWidget.domNode.setClassName(`cgmr codicon ${renderedWidget.className}`);
const className = renderedWidget.className.includes('cgmr codicon ')
? renderedWidget.className
: `cgmr codicon ${renderedWidget.className}`;
renderedWidget.domNode.setClassName(className);
renderedWidget.domNode.setLeft(renderedWidget.left);
renderedWidget.domNode.setWidth(renderedWidget.width);
renderedWidget.domNode.setHeight(this._lineHeight);
Expand Down
4 changes: 0 additions & 4 deletions src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5383,10 +5383,6 @@ declare namespace monaco.editor {
* A glyph margin widget renders in the editor glyph margin.
*/
export interface IGlyphMarginWidget {
/**
* The class name to apply to the glyph widget.
*/
className: string;
/**
* Get a unique identifier of the glyph widget.
*/
Expand Down

0 comments on commit fda41b8

Please sign in to comment.