diff --git a/src/vs/workbench/api/common/extHostTreeViews.ts b/src/vs/workbench/api/common/extHostTreeViews.ts index b9cf54fb746116a94096f81e8bd6fbfefeb6dc38..8621743e70652d1cd875314a56dc6dc1f1870d66 100644 --- a/src/vs/workbench/api/common/extHostTreeViews.ts +++ b/src/vs/workbench/api/common/extHostTreeViews.ts @@ -13,7 +13,7 @@ import { ExtHostTreeViewsShape, MainThreadTreeViewsShape } from './extHost.proto import { ITreeItem, TreeViewItemHandleArg, ITreeItemLabel, IRevealOptions } from 'vs/workbench/common/views'; import { ExtHostCommands, CommandsConverter } from 'vs/workbench/api/common/extHostCommands'; import { asPromise } from 'vs/base/common/async'; -import { TreeItemCollapsibleState, ThemeIcon } from 'vs/workbench/api/common/extHostTypes'; +import { TreeItemCollapsibleState, ThemeIcon, MarkdownString as MarkdownStringType } from 'vs/workbench/api/common/extHostTypes'; import { isUndefinedOrNull, isString } from 'vs/base/common/types'; import { equals, coalesce } from 'vs/base/common/arrays'; import { ILogService } from 'vs/platform/log/common/log'; @@ -24,10 +24,6 @@ import { IMarkdownString } from 'vs/base/common/htmlContent'; type TreeItemHandle = string; -function isMarkdownString(value: any): value is vscode.MarkdownString { - return (value !== undefined) && value.appendCodeblock && value.appendMarkdown && value.appendText && (value.value !== undefined); -} - function toTreeItemLabel(label: any, extension: IExtensionDescription): ITreeItemLabel | undefined { if (isString(label)) { return { label }; @@ -531,7 +527,7 @@ class ExtHostTreeView extends Disposable { } private getTooltip(tooltip?: string | vscode.MarkdownString): string | IMarkdownString | undefined { - if (isMarkdownString(tooltip)) { + if (MarkdownStringType.isMarkdownString(tooltip)) { checkProposedApiEnabled(this.extension); return MarkdownString.from(tooltip); } diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 80e6800171e5251d56b979356e338f4d8a1b696e..e6a5897675f4ed99e9952da9a7ed61b81837b0a4 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -1271,6 +1271,13 @@ export class MarkdownString { this.value += '\n```\n'; return this; } + + static isMarkdownString(thing: any): thing is vscode.MarkdownString { + if (thing instanceof MarkdownString) { + return true; + } + return (thing !== undefined) && thing.appendCodeblock && thing.appendMarkdown && thing.appendText && (thing.value !== undefined); + } } @es5ClassCompat