Updates #84695 - api review

`appendMarkdown` is now the only way to use ThemeIcons
This commit is contained in:
Eric Amodio
2019-12-16 18:45:52 -05:00
parent 390fe6dfce
commit 231c6e7762
5 changed files with 42 additions and 72 deletions

View File

@@ -14,7 +14,7 @@ import { generateUuid } from 'vs/base/common/uuid';
import * as vscode from 'vscode';
import { FileSystemProviderErrorCode, markAsFileSystemProviderError } from 'vs/platform/files/common/files';
import { RemoteAuthorityResolverErrorCode } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { markdownUnescapeCodicons, escapeCodicons } from 'vs/base/common/codicons';
import { escapeCodicons } from 'vs/base/common/codicons';
function es5ClassCompat(target: Function): any {
///@ts-ignore
@@ -1234,17 +1234,16 @@ export class MarkdownString {
isTrusted?: boolean;
readonly supportThemeIcons?: boolean;
constructor(value?: string, { supportThemeIcons }: { supportThemeIcons?: boolean } = {}) {
constructor(value?: string, supportThemeIcons: boolean = false) {
this.value = value ?? '';
this.supportThemeIcons = supportThemeIcons ?? false;
this.supportThemeIcons = supportThemeIcons;
}
appendText(value: string): MarkdownString {
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
value = value
this.value += (this.supportThemeIcons ? escapeCodicons(value) : value)
.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&')
.replace('\n', '\n\n');
this.value += this.supportThemeIcons ? markdownUnescapeCodicons(value) : value;
return this;
}
@@ -1263,10 +1262,6 @@ export class MarkdownString {
this.value += '\n```\n';
return this;
}
static escapeThemeIcons(value: string): string {
return escapeCodicons(value);
}
}
@es5ClassCompat