mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-26 18:27:38 +01:00
Adopts injected text for breakpoint space decoration.
This commit is contained in:
@@ -73,6 +73,8 @@ export function createBreakpointDecorations(model: ITextModel, breakpoints: Read
|
||||
return result;
|
||||
}
|
||||
|
||||
const noBreakWhitespace = '\xa0';
|
||||
|
||||
function getBreakpointDecorationOptions(model: ITextModel, breakpoint: IBreakpoint, state: State, breakpointsActivated: boolean, showBreakpointsInOverviewRuler: boolean): IModelDecorationOptions {
|
||||
const { icon, message } = getBreakpointMessageAndIcon(state, breakpointsActivated, breakpoint, undefined);
|
||||
let glyphMarginHoverMessage: MarkdownString | undefined;
|
||||
@@ -100,7 +102,11 @@ function getBreakpointDecorationOptions(model: ITextModel, breakpoint: IBreakpoi
|
||||
glyphMarginClassName: ThemeIcon.asClassName(icon),
|
||||
glyphMarginHoverMessage,
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
beforeContentClassName: renderInline ? `debug-breakpoint-placeholder` : undefined,
|
||||
before: renderInline ? {
|
||||
content: noBreakWhitespace,
|
||||
inlineClassName: `debug-breakpoint-placeholder`,
|
||||
inlineClassNameAffectsLetterSpacing: true
|
||||
} : undefined,
|
||||
overviewRuler: overviewRulerDecoration
|
||||
};
|
||||
}
|
||||
@@ -133,7 +139,11 @@ async function createCandidateDecorations(model: ITextModel, breakpointDecoratio
|
||||
options: {
|
||||
description: 'breakpoint-placeholder-decoration',
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
beforeContentClassName: breakpointAtPosition ? undefined : `debug-breakpoint-placeholder`
|
||||
before: breakpointAtPosition ? undefined : {
|
||||
content: noBreakWhitespace,
|
||||
inlineClassName: `debug-breakpoint-placeholder`,
|
||||
inlineClassNameAffectsLetterSpacing: true
|
||||
},
|
||||
},
|
||||
breakpoint: breakpointAtPosition ? breakpointAtPosition.breakpoint : undefined
|
||||
});
|
||||
@@ -466,7 +476,7 @@ export class BreakpointEditorContribution implements IBreakpointEditorContributi
|
||||
this.breakpointDecorations = decorationIds.map((decorationId, index) => {
|
||||
let inlineWidget: InlineBreakpointWidget | undefined = undefined;
|
||||
const breakpoint = breakpoints[index];
|
||||
if (desiredBreakpointDecorations[index].options.beforeContentClassName) {
|
||||
if (desiredBreakpointDecorations[index].options.before) {
|
||||
const contextMenuActions = () => this.getContextMenuActions([breakpoint], activeCodeEditor.getModel().uri, breakpoint.lineNumber, breakpoint.column);
|
||||
inlineWidget = new InlineBreakpointWidget(activeCodeEditor, decorationId, desiredBreakpointDecorations[index].options.glyphMarginClassName, breakpoint, this.debugService, this.contextMenuService, contextMenuActions);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,13 @@
|
||||
left: -8px !important;
|
||||
}
|
||||
|
||||
.monaco-editor .debug-breakpoint-placeholder::before,
|
||||
.monaco-editor .debug-breakpoint-placeholder {
|
||||
width: 0.9em;
|
||||
display: inline-flex;
|
||||
vertical-align: middle;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.monaco-editor .debug-top-stack-frame-column::before {
|
||||
content: ' ';
|
||||
width: 0.9em;
|
||||
|
||||
@@ -358,7 +358,7 @@ suite('Debug - Breakpoints', () => {
|
||||
assert.deepStrictEqual(decorations[1].range, new Range(2, 4, 2, 5));
|
||||
assert.deepStrictEqual(decorations[2].range, new Range(3, 5, 3, 6));
|
||||
assert.strictEqual(decorations[0].options.beforeContentClassName, undefined);
|
||||
assert.strictEqual(decorations[1].options.beforeContentClassName, `debug-breakpoint-placeholder`);
|
||||
assert.strictEqual(decorations[1].options.before?.inlineClassName, `debug-breakpoint-placeholder`);
|
||||
assert.strictEqual(decorations[0].options.overviewRuler?.position, OverviewRulerLane.Left);
|
||||
const expected = new MarkdownString().appendCodeblock(languageId, 'Expression condition: x > 5');
|
||||
assert.deepStrictEqual(decorations[0].options.glyphMarginHoverMessage, expected);
|
||||
|
||||
Reference in New Issue
Block a user