Skip to content

Commit

Permalink
Fix what an empty string is, don't render empty MarkdownString, #29076
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Aug 24, 2017
1 parent fb83608 commit 57da808
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/vs/base/common/htmlContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class MarkdownString implements IMarkdownString {

static isEmpty(oneOrMany: IMarkdownString | IMarkdownString[]): boolean {
if (MarkdownString.isMarkdownString(oneOrMany)) {
return Boolean(oneOrMany.value);
return !oneOrMany.value;
} else if (Array.isArray(oneOrMany)) {
return oneOrMany.every(MarkdownString.isEmpty);
} else {
Expand Down Expand Up @@ -49,11 +49,11 @@ export class MarkdownString implements IMarkdownString {
}

appendCodeblock(langId: string, code: string): this {
this.value += '```';
this.value += '\n```';
this.value += langId;
this.value += '\n';
this.value += code;
this.value += '```\n';
this.value += '\n```\n';
return this;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/contrib/hover/browser/modesContentHover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {

if (!(msg instanceof ColorHover)) {
msg.contents
.filter(contents => !!contents)
.filter(contents => !MarkdownString.isEmpty(contents))
.forEach(contents => {
const renderedContents = renderMarkdown(contents, {
actionCallback: (content) => {
Expand Down

0 comments on commit 57da808

Please sign in to comment.