Skip to content

Commit bbe24d7

Browse files
committed
testing: vertically center test message badge
Closes microsoft#234287
1 parent d79858c commit bbe24d7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/vs/workbench/contrib/testing/browser/testingDecorations.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,8 @@ class TestMessageDecoration implements ITestDecoration {
13321332
}
13331333
}
13341334

1335+
const ERROR_CONTENT_WIDGET_HEIGHT = 20;
1336+
13351337
class TestErrorContentWidget extends Disposable implements IContentWidget {
13361338
private readonly id = generateUuid();
13371339

@@ -1360,6 +1362,18 @@ class TestErrorContentWidget extends Disposable implements IContentWidget {
13601362
) {
13611363
super();
13621364

1365+
const setMarginTop = () => {
1366+
const lineHeight = editor.getOption(EditorOption.lineHeight);
1367+
this.node.root.style.marginTop = (lineHeight - ERROR_CONTENT_WIDGET_HEIGHT) / 2 + 'px';
1368+
};
1369+
1370+
setMarginTop();
1371+
this._register(editor.onDidChangeConfiguration(e => {
1372+
if (e.hasChanged(EditorOption.lineHeight)) {
1373+
setMarginTop();
1374+
}
1375+
}));
1376+
13631377
let text: string;
13641378
if (message.expected !== undefined && message.actual !== undefined) {
13651379
text = `${truncateMiddle(message.actual, 15)} != ${truncateMiddle(message.expected, 15)}`;

0 commit comments

Comments
 (0)