mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
Updates #84695 - api review
`appendMarkdown` is now the only way to use ThemeIcons
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user