You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow programmatically selecting a TreeItem in custom views #30288
I've been trying to mimick the files.autoReveal behavior of the regular explorer in the Dependency Explorer of the Haxe extension. I can expand the necessary nodes just fine, but I don't think there's any way to scroll to the correct position in the view + highlight the node programmatically right now.
From what I can tell, the currently planned enhancements won't help with this (#27823). Could a function for selecting a node be added to API? I think a lot of other extensions would benefit from this as well, Code Outline comes to mind.
Reacted by Eric Amodio, Sandeep Somavarapu, Jeremy Philippe, Alessandro Fragnani, Sipho, Sebastien Lebreton, cavehill, Patrick Trant, Julien Roncaglia, Yukai Huang and 2 more
Yes, this API would be very useful for code view/navigation extensions. I have an extension with a custom view and it is frequently requested to highlight the node that represents where they are in the file.
Reacted by Eric Amodio, Julien Roncaglia and cavehill
I am working on a proposed API for this which will be available for authors to try out in this iteration and the plan to make it available in main API is in next milestone.
In that case, both are needed to mimic the files.autoReveal behavior, as files are also highlighted in the regular file explorer when using that setting.
Yes, there are many Tree APIs in the market and they might share some common things and differ in other. We have our own set of protocols to follow before coming up with an API.
Naming is always tough. We do multiple rounds of feedback and come up with proper name. In this case the extension author wants to reveal a node to the user which makes it obvious to call it reveal. On the other hand expand does not tell about showing to the user.
Eric Amodio (@eamodio) Re gitkraken/vscode-gitlens#275 If I understand correctly, you want the nodes to be auto expanded when view loads them? If so, Is not the collapsibleState property on TreeItem doing it?
Reveal API is different that it allows you to show a node at any time.
will this be making the Feb cut? (seems unlikely at this point)?
It is part of proposed API for Feb release and becomes public for March release.
Sandeep Somavarapu (@sandy081) the view will already be loaded and not expanded. I want to be able to have a command to select and expand the item (sometimes 1 level others all descendants).
A command (from the palette or keyboard shortcut) that just focuses the GitLens/GitLens Results views (so any previous selection would be preserved)
A command (from a quickpick or keyboard shortcut) that would select a branch, and maybe expand it 1 level, or a commit — basically jumping into the GitLens explorer
A command on a node that would expand it and all its children for both the GitLens and GitLens Results views
A command when you execute it on a node in the GitLens explorer, would select and expand a node in the GitLens Results view
And those are just a few off the top of my head. I want to make jumping into and around the GitLens views more seamless.
Reacted by Sandeep Somavarapu and Julien Roncaglia
Activity
sailro commentedon Oct 21, 2017
This is a huge limitation, it would be so great to have such a basic feature when working with custom tree views
pltrant commentedon Jan 28, 2018
Yes, this API would be very useful for code view/navigation extensions. I have an extension with a custom view and it is frequently requested to highlight the node that represents where they are in the file.
mike-lischke commentedon Feb 6, 2018
This FR could be tracked by #27823. I have (multi) selection per code in my feature wishlist there.
sandy081 commentedon Feb 14, 2018
Jens Fischer (@Gama11) Patrick Trant (@pltrant) Can I assume is this request is to have an API to
revealan item in the tree? Or do you also needselectas a separate API?sandy081 commentedon Feb 14, 2018
I am working on a proposed API for this which will be available for authors to try out in this iteration and the plan to make it available in main API is in next milestone.
Gama11 commentedon Feb 14, 2018
If
revealimpliesselect, that seems good enough to me.sandy081 commentedon Feb 14, 2018
revealandselectare two independent actions.reveal- Reveals the item in the tree view.select- Selects the item in the tree. Select will not show the item if it is not visible.Gama11 commentedon Feb 14, 2018
In that case, both are needed to mimic the
files.autoRevealbehavior, as files are also highlighted in the regular file explorer when using that setting.24 remaining items
eamodio commentedon Mar 1, 2018
Sandeep Somavarapu (@sandy081) will this be making the Feb cut? (seems unlikely at this point)
sandy081 commentedon Mar 2, 2018
Mike Lischke (@mike-lischke) Sorry for late reply. I was bit busy this week with our release stuff.
Yes, there are many Tree APIs in the market and they might share some common things and differ in other. We have our own set of protocols to follow before coming up with an API.
Naming is always tough. We do multiple rounds of feedback and come up with proper name. In this case the extension author wants to reveal a node to the user which makes it obvious to call it
reveal. On the other handexpanddoes not tell about showing to the user.propertiesvsmethodsand other arguments of yours boils down to the design approach. Our design is pull model that extensions provide to the system, data sources and rendering (like label) providers and system asks for the data and render the view. This is one of the familiar designs for Tree implementation for eg., eclipse JFace Tree view has the similar API: https://www.eclipse.org/articles/Article-TreeViewer/TreeViewerArticle.htmsandy081 commentedon Mar 2, 2018
Eric Amodio (@eamodio) Re gitkraken/vscode-gitlens#275 If I understand correctly, you want the nodes to be auto expanded when view loads them? If so, Is not the
collapsibleStateproperty onTreeItemdoing it?Reveal API is different that it allows you to show a node at any time.
It is part of
proposedAPI for Feb release and becomes public for March release.Try it out and provide feedback.
eamodio commentedon Mar 2, 2018
Sandeep Somavarapu (@sandy081) the view will already be loaded and not expanded. I want to be able to have a command to select and expand the item (sometimes 1 level others all descendants).
sandy081 commentedon Mar 2, 2018
Eric Amodio (@eamodio) Ah ok. So what is the context when this command is invoked in your case?
eamodio commentedon Mar 2, 2018
There are multiple scenarios.
And those are just a few off the top of my head. I want to make jumping into and around the GitLens views more seamless.
sandy081 commentedon Mar 19, 2018
Current status: Under discussion about how to expose views in the API - #45994
sandy081 commentedon Mar 27, 2018
Verify that you can use the new
TreeView.revealAPI without having to run the extension in proposed API mode.