Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposals for Collapse, CollapseAll, Expand APIs #61626

Closed
wants to merge 1 commit into from

Conversation

sandy081
Copy link
Member

Implements #55879

@sandy081 sandy081 added tree-views Extension tree view issues api-proposal labels Oct 23, 2018
@sandy081 sandy081 added this to the October 2018 milestone Oct 23, 2018
@sandy081 sandy081 self-assigned this Oct 23, 2018
@sandy081 sandy081 requested a review from jrieken October 23, 2018 15:01
export function createTreeView<T>(viewId: string, options: { treeDataProvider: TreeDataProvider<T> }): TreeView2<T>;
}

export interface TreeView2<T> extends TreeView<T> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seem to like the 2 suffix but I think that's not really needed...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using the same name

Suggested change
export interface TreeView2<T> extends TreeView<T> {
export interface TreeView<T> extends TreeView<T> {

but it caused recursive compilation error. Do you have other suggestions?

/**
* Collapse all elements.
*/
collapseAll(): Thenable<void>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just another overload, like collapse()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried this but felt weird collapse does collapsing all.

* @param elementOrElements element(s) to collpase.
* @param recursive Controls if elements have to be collapsed recursively or not.
*/
collapse(elementOrElements: T | T[], recursive?: boolean): Thenable<void>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why Thenable? Is this us leaking tree implementation details?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expand is async and to be consistent I made collapse also. In fact collapse is async in the current tree impl. Not returning Thenable might cause authors to think it sync and can lead to unexpected errors.

@jrieken
Copy link
Member

jrieken commented Oct 23, 2018

@sandy081 You can just merge proposed api changes, we will discuss them in the API call, and lets have a PR when merging this to stable

@joaomoreno joaomoreno modified the milestones: October 2018, November 2018 Nov 8, 2018
@roblourens roblourens removed this from the December/January 2019 milestone Feb 1, 2019
@sandy081 sandy081 closed this Jun 5, 2020
@sandy081 sandy081 deleted the sandy081/55879 branch June 5, 2020 14:14
@github-actions github-actions bot locked and limited conversation to collaborators Jul 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-proposal tree-views Extension tree view issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants