diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index ea64b766b66..7bc2d682391 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -47,27 +47,26 @@ declare module 'vscode' { getChildren(element?: T): ProviderResult; } - export interface TreeItem { + export class TreeItem { /** * A human-readable string describing this item */ - readonly label: string; + label: string; /** * The icon path for the tree item */ - readonly iconPath?: string | Uri | { light: string | Uri; dark: string | Uri }; + iconPath?: string | Uri | { light: string | Uri; dark: string | Uri }; /** - * The [command](#Command) which should be run when the tree item - * is selected. This command is called with the model representing this item as first argument. + * The [command](#Command) which should be run when the tree item is selected. */ - readonly command?: Command; + command?: Command; /** * [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item. */ - readonly collapsibleState?: TreeItemCollapsibleState; + collapsibleState?: TreeItemCollapsibleState; /** * Context value of the tree item. This can be used to contribute item specific actions in the tree. @@ -87,7 +86,13 @@ declare module 'vscode' { * ``` * This will show action `extension.deleteFolder` only for items with `contextValue` is `folder`. */ - readonly contextValue?: string; + contextValue?: string; + + /** + * @param label A human-readable string describing this item + * @param collapsibleState [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item. Default is [TreeItemCollapsibleState.None](#TreeItemCollapsibleState.None) + */ + constructor(label: string, collapsibleState?: TreeItemCollapsibleState); } /** diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 0d14189f2a5..a859a1369fe 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -535,6 +535,7 @@ export function createApiFactory( WorkspaceEdit: extHostTypes.WorkspaceEdit, ProgressLocation: extHostTypes.ProgressLocation, TreeItemCollapsibleState: extHostTypes.TreeItemCollapsibleState, + TreeItem: extHostTypes.TreeItem, ThemeColor: extHostTypes.ThemeColor, // functions TaskRevealKind: extHostTypes.TaskRevealKind, diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index ef7f35e2a7e..e2967887266 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -1297,6 +1297,17 @@ export enum ProgressLocation { Window = 10, } +export class TreeItem { + + iconPath?: string | Uri | { light: string | Uri; dark: string | Uri }; + command?: vscode.Command; + contextValue?: string; + + constructor(public label: string, public collapsibleState: vscode.TreeItemCollapsibleState = TreeItemCollapsibleState.None) { + } + +} + export enum TreeItemCollapsibleState { None = 0, Collapsed = 1,