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

Expose the collapsible state of the tree item #30535

Closed
chrmarti opened this issue Jul 12, 2017 · 13 comments
Closed

Expose the collapsible state of the tree item #30535

chrmarti opened this issue Jul 12, 2017 · 13 comments
Assignees
Labels
feature-request Request for new features or functionality on-testplan tree-views Extension tree view issues
Milestone

Comments

@chrmarti
Copy link
Contributor

That would allow the TreeDataProvider to preserve the collapsibleState on updates.

@chrmarti chrmarti added the tree-views Extension tree view issues label Jul 12, 2017
@sandy081 sandy081 added the feature-request Request for new features or functionality label Jul 13, 2017
@sandy081 sandy081 added this to the Backlog milestone Jul 13, 2017
@weinand
Copy link
Contributor

weinand commented Jul 20, 2017

For me it would even be sufficient to preserve the expand/collapse state that the user has changed. So the TreeItem.collapsibleState would be only used for the initial state.

@chrisdias
Copy link
Member

This would let me run an expensive refresh operation in the docker extension only when the parent node is expanded. right now it runs even if the parent node is collapsed because I can't see the state of the node.

@eamodio
Copy link
Contributor

eamodio commented Sep 24, 2017

Same for me with GitLens. Though ideally I'd want an state change event so that I could hook/unhook other handlers (file system watchers) only if needed.

@hbenl
Copy link

hbenl commented Oct 31, 2017

+1
Right now it is impossible to preserve the visible state on updates (which can be very annoying for the user). Even when I'm reusing the old TreeItems, their state is replaced with the initial collapsibleState.

@weinand
Copy link
Contributor

weinand commented Nov 29, 2017

I'm bumping the severity of this since it makes the tree very difficult to use for users.
In addition this is a bug not a feature request.

@weinand weinand added bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority and removed feature-request Request for new features or functionality labels Nov 29, 2017
@sandy081 sandy081 modified the milestones: Backlog, November 2017 Nov 30, 2017
@GordonSmith
Copy link

GordonSmith commented Nov 30, 2017

@weinand If you also made label + collapsibleState refresh their UI when they are written to, then it would allow a simple way to refresh a single node.

Or support: tree._onDidChangeTreeData.fire(<T>); to trigger a refresh of single node?

@sandy081
Copy link
Member

sandy081 commented Dec 3, 2017

Looks like this issue contains multiple requests

  1. Expose collapsible state of Tree item (Original request)
  2. Preserve the collapsible state of the Tree item on updates - Retain the tree expansion state after tree refresh #39505
  3. Firing onDidChangeTreeData event on a node should also refresh itself - Firing TreeDataProvider.onDidChangeTreeData(item) doesn't fully update the item #34789

Instead of hijacking this for multiple issues, I have created issues for each.

Coming back to this issue, IMO, this is a feature request to expose the view state of the Tree. Issue #39505 is a bug and tagged important.

Please let me know if this feature is still needed after fixing issues #39505 and #34789. If so, please provide the use cases. Otherwise, I would prefer to close it.

@weinand FYI

@sandy081 sandy081 added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority labels Dec 3, 2017
@sandy081 sandy081 modified the milestones: November 2017, Backlog Dec 3, 2017
@sandy081 sandy081 changed the title Update TreeItem.collapsibleState when user changes that Expose the collapsible state of the tree item Dec 3, 2017
@sandy081
Copy link
Member

As I do not see any scenarios to support this request after other fixes/enhancements done to custom view, I am inclined to close this.

If there is still need of it, please reopen it with the supporting use cases.

Thanks.

@sandy081 sandy081 removed this from the Backlog milestone Feb 14, 2018
@eamodio
Copy link
Contributor

eamodio commented Feb 14, 2018

I would vote to re-open this. GitLens has certain nodes that when expanded, start file watchers and other event hooks, but currently I have no way to undo them if the node is collapsed. These leads to wasted performance, battery, etc

@chrisdias
Copy link
Member

The Docker extension has Images and Containers nodes. When expanded, I poll Docker for status updates (start, stopped, creation date/time). This is expensive and when the Images or Containers nodes are collapsed, I would like to get an event and be able to test the state so I can stop polling.

@chrisdias chrisdias reopened this Feb 14, 2018
@sandy081
Copy link
Member

@eamodio @chrmarti Your use cases makes sense to me.

@sandy081
Copy link
Member

Added following events in the Treeview

/**
 * Event that is fired when an element is expanded
 */
readonly onDidExpandElement: Event<T>;

/**
 * Event that is fired when an element is collapsed
 */
readonly onDidCollapseElement: Event<T>;

@sandy081
Copy link
Member

All, please note that there is a slight change done to the events

export interface TreeViewExpansionEvent<T> {

	/**
	 * Element that is expanded or collapsed.
	 */
	element: T;

}

/**
 * Event that is fired when an element is expanded
 */
readonly onDidExpandElement: Event<TreeViewExpansionEvent<T>>;

/**
 * Event that is fired when an element is collapsed
 */
readonly onDidCollapseElement: Event<TreeViewExpansionEvent<T>>;

@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality on-testplan tree-views Extension tree view issues
Projects
None yet
Development

No branches or pull requests

7 participants