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

Render both debug frame indicator and breakpoint #180448

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,21 @@ export class GlyphMarginOverlay extends DedupOverlay {
if (decorations.length === 0) {
continue;
}
decorations.sort((a, b) => {
// Sort decorations to render in descending order by zIndex
return b.zIndex - a.zIndex;
});
decorations.sort((a, b) => b.zIndex - a.zIndex);
// Render winning decorations with the same zIndex together
const winningDecoration: RenderedDecoration = decorations[0];
const winningDecorationClassNames = [winningDecoration.className];
for (let i = 1; i < decorations.length; i += 1) {
const decoration = decorations[i];
if (decoration.zIndex !== winningDecoration.zIndex) {
break;
}
winningDecorationClassNames.push(decoration.className);
}
const left = (this._glyphMarginLeft + (lane - 1) * this._lineHeight).toString();
css += (
'<div class="cgmr codicon '
+ winningDecoration.className // TODO@joyceerhl Implement overflow for remaining decorations
+ winningDecorationClassNames.join(' ') // TODO@joyceerhl Implement overflow for remaining decorations
+ common
+ 'left:' + left + 'px;"></div>'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Constants } from 'vs/base/common/uint';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { Range } from 'vs/editor/common/core/range';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { IModelDecorationOptions, IModelDeltaDecoration, OverviewRulerLane, TrackedRangeStickiness } from 'vs/editor/common/model';
import { GlyphMarginLane, IModelDecorationOptions, IModelDeltaDecoration, OverviewRulerLane, TrackedRangeStickiness } from 'vs/editor/common/model';
import { localize } from 'vs/nls';
import { ILogService } from 'vs/platform/log/common/log';
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
Expand All @@ -29,6 +29,8 @@ const stickiness = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges;
const TOP_STACK_FRAME_MARGIN: IModelDecorationOptions = {
description: 'top-stack-frame-margin',
glyphMarginClassName: ThemeIcon.asClassName(debugStackframe),
glyphMargin: { position: GlyphMarginLane.Right },
zIndex: 9999,
Copy link
Contributor Author

@joyceerhl joyceerhl Apr 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The glyph margin and editor don't know anything about debug decorations vs non-debug decorations--all they know about is the specified zIndex and position. To ensure that the debug frame indicator continues to render together with the breakpoint decoration, we need both options to match the breakpoint decorations options, which is where these values come from:

return {
description: 'breakpoint-decoration',
glyphMargin: { position: GlyphMarginLane.Right },
glyphMarginClassName: ThemeIcon.asClassName(icon),
glyphMarginHoverMessage,
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
before: renderInline ? {
content: noBreakWhitespace,
inlineClassName: `debug-breakpoint-placeholder`,
inlineClassNameAffectsLetterSpacing: true
} : undefined,
overviewRuler: overviewRulerDecoration,
zIndex: 9999
};

stickiness,
overviewRuler: {
position: OverviewRulerLane.Full,
Expand All @@ -38,6 +40,8 @@ const TOP_STACK_FRAME_MARGIN: IModelDecorationOptions = {
const FOCUSED_STACK_FRAME_MARGIN: IModelDecorationOptions = {
description: 'focused-stack-frame-margin',
glyphMarginClassName: ThemeIcon.asClassName(debugStackframeFocused),
glyphMargin: { position: GlyphMarginLane.Right },
zIndex: 9999,
stickiness,
overviewRuler: {
position: OverviewRulerLane.Full,
Expand Down