Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Add tree component #255

Closed
idoprz opened this issue Oct 9, 2021 · 13 comments
Closed

Add tree component #255

idoprz opened this issue Oct 9, 2021 · 13 comments
Labels
component request Requests for components to be added to the Webview Toolkit

Comments

@idoprz
Copy link

idoprz commented Oct 9, 2021

Hi,

Please add tree component to the library.
I want to have a tree as part of my webview and not in a TreeView.
Use case can be a TreeView like panel with more controls like search control above the tree.

@daviddossett daviddossett added the component request Requests for components to be added to the Webview Toolkit label Oct 11, 2021
@daviddossett
Copy link
Collaborator

Thanks for raising this, @idoprz. We've received this request from other teams at Microsoft and usually recommend the native TreeView to avoid reinventing a fairly complex control. But I'm interested in learning more.

Could you tell me more about what sort of functionality you're looking for here?

cc @hawkticehurst

@shashkovdanil
Copy link

@daviddossett I need a tree component too. I can't use native treeview component, because it non-customizable (I can change only icon, text and description). I need to add different labels

image (1)

@idoprz
Copy link
Author

idoprz commented Oct 13, 2021

Hi,

Some tree use cases we have:

  1. Currently there is only primary string and secondary string format. We need to present more details, like disabled nodes, use different controls inside nodes not just button, like toggle, badge, etc'.
    1_2OzJO02gjQMSclK4Gnz4YA

  2. Search / Filter tree -> filter out search results or API list etc.
    See here example of tree in a panel which has like a "toolbar".
    image

@hawkticehurst
Copy link
Member

Thanks for the references @idoprz!

To clarify a little more based on the images you sent would it be accurate to say you're looking for a component that is a sort of hybrid between a tree view and data grid that also has search functionality?

@idoprz
Copy link
Author

idoprz commented Oct 27, 2021

You can see that near the search I also have buttons, like a toolbar.
In some cases I need capabilities similar to grid data, but maybe more flexibility on the tree will be enough. In other cases it is 100% tree but need to have more controls like the search or a toolbar.
Have in mind that after search I need to present the results. The results might not be suited to present in tree because the hierarchy might not be reflected correctly in filtered results. So adding "search" on top of TreeView is nice feature, but not sure will be enough.
We have plenty of other use cases for controls and webviews if needed.

@daviddossett
Copy link
Collaborator

Agreed that the first image would probably fall under the data grid umbrella. The key difference being that it has nesting like a tree. We'll certainly be looking to expand the data grid functionality over time—this is very helpful input 🙏

@idoprz have you considered using the Quick Pick to handle search and filtering? It's unlikely that we'll recreate the TreeView in the toolkit given its complexity and existing native support. Instead, this is a situation where we could bring the discussion to VS Code itself to enhance the native API.

This is a prototype from a while back that showcases on way of leveraging the TreeView, View, and command APIs together to filter a tree. Not perfect, but variations of this are fairly common across the extensions landspace.

CleanShot.2021-10-27.at.10.16.14-trimmed.mp4

@atanasster
Copy link

Hi,

I would love to see this added to the components, so it can be styled in accordance.

My use-case is where a tree view is used inside of a grid to display property types: https://github.com/ccontrols/instant-documentation-vscode

Currently using the fast-tree-view, and applying a few styles to make it look seamless inside of the vscode-webvoiew-ui components:

https://github.com/ccontrols/instant-documentation-vscode/blob/master/src/webview/fast-components.ts

@iddan
Copy link

iddan commented Dec 11, 2021

Hey, I would love to see this added as well.
My use case is a tree view to show custom search results.
I created a poor-mans implementation just for demonstration purposes:

Screenshot 2021-12-12 at 1 43 47

@javahacks
Copy link

A tree component was great. However I would also consider a more complex tree-table control as shown in the first use case here #255 (comment) .

Here you see what I have in mind in action. I believe there are many use cases where you have to show structured information in such a control (e.g. advanced debugger output).

@sketchbuch
Copy link

sketchbuch commented Mar 21, 2022

I would also like a tree widget, currently I need a tree similar to the file panel with a title/description and icon buttons that appear on hover like in the tree view that vscode uses so that commands can be run on the item. I also need to highlight something that is active and be able to expand/collapse all folders.

Here is an example of a tree I built myself for my web view:

Sidebar 2

@smorimoto
Copy link

Any updates on this? Right now we're embedding astexplorer as a webview, and to be honest, it looks weird when you see it in VSCode. I think it would also be useful to display the AST... 🙂

@seanpoulter-foci
Copy link

seanpoulter-foci commented Jul 18, 2023

To propose another use case, we'd like to build a UI similar to a test runner that shows a file type icon on the left and a status pass/fail/progress/unknown on the right.

We don't believe this is possible with the current TreeView API.

@hawkticehurst
Copy link
Member

Hi all,

Back with a final update: I'm very sorry to say that the toolkit is being deprecated and all active development will be coming to a close.

There was an announcement last week where you can learn more details and leave any questions or comments you may have.

Beyond that, thank you so much filing this issue and apologies for never getting around to addressing it. It means a lot that you contributed to the improvement of this project. I wish you all the best in your future VS Code extension endeavors!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component request Requests for components to be added to the Webview Toolkit
Projects
None yet
Development

No branches or pull requests

10 participants