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

Allow programatically un-selecting an item in a contributed tree #48754

Open
DanTup opened this issue Apr 26, 2018 · 24 comments
Open

Allow programatically un-selecting an item in a contributed tree #48754

DanTup opened this issue Apr 26, 2018 · 24 comments
Assignees
Labels
api feature-request Request for new features or functionality tree-views Extension tree view issues

Comments

@DanTup
Copy link
Contributor

DanTup commented Apr 26, 2018

We can select items in the tree node with reveal, but we can't un-select. For an outline view that follows the users cursor, it would be good to unselect when the user moves the cursor to some empty whitespace that doesn't have a matching node.

The existing explorer treeview also does this; if you open a file that's outside of the workspace folders (or create a new untitled file) then no items are selected in the tree.

@isidorn isidorn assigned sandy081 and unassigned isidorn Apr 26, 2018
@sandy081 sandy081 added feature-request Request for new features or functionality tree-views Extension tree view issues labels Apr 26, 2018
@sandy081 sandy081 added this to the Backlog milestone Apr 26, 2018
@DanTup DanTup changed the title Allow un-selected an item in a contributed tree Allow un-selecting an item in a contributed tree Apr 26, 2018
@DanTup
Copy link
Contributor Author

DanTup commented Sep 19, 2018

@sandy081 If this isn't possible yet, do you know of any workarounds? I'm trying to keep a node selected based on where the user is, but I need to unselect it when they navigate somewhere I don't have a node for (it's really confusing to leave the last thing selected).

DanTup added a commit to Dart-Code/Dart-Code that referenced this issue Sep 19, 2018
See #1180. Blocked on microsoft/vscode#48754 though, because the selected node stays selected even when you move to another file.
@sandy081
Copy link
Member

@DanTup Sorry, there is no workaround. I will try to implement this soon.

DanTup added a commit to Dart-Code/Dart-Code that referenced this issue Jan 3, 2019
See #1180. Blocked on microsoft/vscode#48754 though, because the selected node stays selected even when you move to another file.
@DanTup
Copy link
Contributor Author

DanTup commented Jan 29, 2019

@sandy081 Is this still planned?

@sandy081
Copy link
Member

@DanTup not for January.

@DanTup
Copy link
Contributor Author

DanTup commented Feb 14, 2019

@sandy081 Any chance for Feb? :)

@sandy081
Copy link
Member

No tree features planned in Feb. Would be jumping back to them in March for sure.

@sandy081 sandy081 modified the milestones: Backlog, March 2019 Feb 18, 2019
@sandy081 sandy081 modified the milestones: March 2019, On Deck Mar 25, 2019
@DanTup
Copy link
Contributor Author

DanTup commented Jul 11, 2019

@sandy081 I don't suppose this might happen soon? I've almost gotten my Outline to a state that I'd be comfortable shipping, but it still has some rough edges like this one.

@sandy081 sandy081 added the api label Jul 12, 2019
@sandy081
Copy link
Member

Not this milestone, but will bring this up in next.

@DanTup
Copy link
Contributor Author

DanTup commented Jul 12, 2019

Thanks! 👍

@DanTup
Copy link
Contributor Author

DanTup commented Aug 20, 2019

Any news?

(sorry for all the pings, catching up on snoozed emails 😃)

@sandy081
Copy link
Member

Adding @alexr00

@sandy081 sandy081 removed their assignment Aug 10, 2020
@alexr00
Copy link
Member

alexr00 commented Nov 6, 2020

I think this works with the new tree:
recording (28)

@alexr00 alexr00 closed this as completed Nov 6, 2020
@DanTup
Copy link
Contributor Author

DanTup commented Nov 9, 2020

@alexr00 this request is to be able to do it programatically. Eg. to highlight a tree item relevant to where the current cursor position is (eg. in a test that's rendered in the tree), and then unselect it when the cursor is moved to a location where no nodes would be selected.

@DanTup DanTup changed the title Allow un-selecting an item in a contributed tree Allow programatically un-selecting an item in a contributed tree Nov 9, 2020
@alexr00 alexr00 reopened this Nov 9, 2020
@alexr00 alexr00 modified the milestones: On Deck, Backlog Candidates Nov 9, 2020
@DanTup
Copy link
Contributor Author

DanTup commented Nov 9, 2020

If it receives 20 upvotes we will move it to our backlog. If not, we will close it.

Given this isn't a feature end users see directly (it depends very much on what extensions build on it), this seems somewhat unlikely. Not doing it prevents extension authors from building certain features (for example tracking the selected test as you move around, just like the built-in Outline view does) ☹️

(I can encourage my users to come and 👍 this, though I don't know if that's spammy or frowned upon - it doesn't seem like a natural way of gauging interest)

@DanTup
Copy link
Contributor Author

DanTup commented Jan 11, 2021

🤷‍♂️

@DanTup
Copy link
Contributor Author

DanTup commented Jan 26, 2021

@alexr00 @sandy081 should we expect that this will never be implemented? 😞

There are even built-in VS Code trees that behave strangely because of it. For example, the explorer tree follows around the current active file - yet if you open a file not in the tree (for example a new file), it just remains on the last selection.

@alexr00
Copy link
Member

alexr00 commented Feb 1, 2021

@DanTup I can see why API for this would be useful, but given that only one person wants this API it's reasonable to expect that very few people would use the API. It's hard for me to justify the time required to add the API. So yes, unless we see more support for such an API, then we probably won't implement it.

@DanTup
Copy link
Contributor Author

DanTup commented Feb 1, 2021

but given that only one person wants this API it's reasonable to expect that very few people would use the API

Only one extension author wanting an API isn't necessarily the same as only one person would benefit from this API. Users don't necessarily know what APIs are required for which features. I could encourage users that want a feature that relies on this to come and 👍 this issue, but that feels a bit spammy/gaming the system. Would that be the best way to help guage interest?

I also gave an example of where VS Code itself could benefit from this API - its explorer keeps the "last" file focused when you open a new one that isn't in the tree, which seems unintentional and would need this API to fix.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 2021
@alexr00 alexr00 reopened this Apr 24, 2023
@microsoft microsoft unlocked this conversation Apr 24, 2023
@alexr00
Copy link
Member

alexr00 commented Apr 24, 2023

Re-opening to gauge further interest.

@nikitaShablevskyi
Copy link

nikitaShablevskyi commented May 5, 2023

I encountered a similar issue where I needed to clear my selection, but unfortunately, it seemed impossible. Despite my efforts to find a solution, I was unable to come up with a workaround and ultimately had no success.

@alexr00
Copy link
Member

alexr00 commented May 9, 2023

FYI in case it helps: #174811 (comment)

@whitequark
Copy link

I would like to use this feature in my extension.

@nikitaShablevskyi
Copy link

Any results on this one? I just wanna to have the same flow as we have inside Files Explorer => When we click on a file -> It opens. And even when the selection on this file is still present in Files Explorer you can reopen the file without any problems.

With the current implementation of TreeView such flow is impossible to achieve

@crhenrici
Copy link

FWIW I'd also be interested in such an API or at least have a workaround to achieve more or less the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api feature-request Request for new features or functionality tree-views Extension tree view issues
Projects
None yet
Development

No branches or pull requests

8 participants
@whitequark @DanTup @isidorn @sandy081 @crhenrici @alexr00 @nikitaShablevskyi and others