提交 b785be4c 编写于 作者: A Alex Ross

Finalize TreeItemLabel API

Fixes #61579
上级 5758f6fc
......@@ -8727,7 +8727,7 @@ declare module 'vscode' {
/**
* A human-readable string describing this item. When `falsy`, it is derived from [resourceUri](#TreeItem.resourceUri).
*/
label?: string;
label?: string | TreeItemLabel;
/**
* Optional id for the tree item that has to be unique across tree. The id is used to preserve the selection and expansion state of the tree item.
......@@ -8830,6 +8830,23 @@ declare module 'vscode' {
Expanded = 2
}
/**
* Label describing the [Tree item](#TreeItem)
*/
export interface TreeItemLabel {
/**
* A human-readable string describing the [Tree item](#TreeItem).
*/
label: string;
/**
* Ranges in the label to highlight. A range is defined as a tuple of two number where the
* first is the inclusive start index and the second the exclusive end index
*/
highlights?: [number, number][];
}
/**
* Value-object describing what options a terminal should use.
*/
......
......@@ -998,23 +998,6 @@ declare module 'vscode' {
//#endregion
//#region Tree View: https://github.com/microsoft/vscode/issues/61313
/**
* Label describing the [Tree item](#TreeItem)
*/
export interface TreeItemLabel {
/**
* A human-readable string describing the [Tree item](#TreeItem).
*/
label: string;
/**
* Ranges in the label to highlight. A range is defined as a tuple of two number where the
* first is the inclusive start index and the second the exclusive end index
*/
highlights?: [number, number][];
}
// https://github.com/microsoft/vscode/issues/100741
export interface TreeDataProvider<T> {
......@@ -1022,11 +1005,6 @@ declare module 'vscode' {
}
export class TreeItem2 extends TreeItem {
/**
* Label describing this item. When `falsy`, it is derived from [resourceUri](#TreeItem.resourceUri).
*/
label?: string | TreeItemLabel | /* for compilation */ any;
/**
* Content to be shown when you hover over the tree item.
*/
......
......@@ -33,7 +33,6 @@ function toTreeItemLabel(label: any, extension: IExtensionDescription): ITreeIte
if (label
&& typeof label === 'object'
&& typeof label.label === 'string') {
checkProposedApiEnabled(extension);
let highlights: [number, number][] | undefined = undefined;
if (Array.isArray(label.highlights)) {
highlights = (<[number, number][]>label.highlights).filter((highlight => highlight.length === 2 && typeof highlight[0] === 'number' && typeof highlight[1] === 'number'));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册