Skip to content

Commit 57da808

Browse files
committed
Fix what an empty string is, don't render empty MarkdownString, microsoft#29076
1 parent fb83608 commit 57da808

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/vs/base/common/htmlContent.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class MarkdownString implements IMarkdownString {
1717

1818
static isEmpty(oneOrMany: IMarkdownString | IMarkdownString[]): boolean {
1919
if (MarkdownString.isMarkdownString(oneOrMany)) {
20-
return Boolean(oneOrMany.value);
20+
return !oneOrMany.value;
2121
} else if (Array.isArray(oneOrMany)) {
2222
return oneOrMany.every(MarkdownString.isEmpty);
2323
} else {
@@ -49,11 +49,11 @@ export class MarkdownString implements IMarkdownString {
4949
}
5050

5151
appendCodeblock(langId: string, code: string): this {
52-
this.value += '```';
52+
this.value += '\n```';
5353
this.value += langId;
5454
this.value += '\n';
5555
this.value += code;
56-
this.value += '```\n';
56+
this.value += '\n```\n';
5757
return this;
5858
}
5959
}

src/vs/editor/contrib/hover/browser/modesContentHover.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
310310

311311
if (!(msg instanceof ColorHover)) {
312312
msg.contents
313-
.filter(contents => !!contents)
313+
.filter(contents => !MarkdownString.isEmpty(contents))
314314
.forEach(contents => {
315315
const renderedContents = renderMarkdown(contents, {
316316
actionCallback: (content) => {

0 commit comments

Comments
 (0)