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

File in editor not selected in project tree if folder expanded after file already open #3404

Closed
redmunds opened this issue Apr 10, 2013 · 5 comments

Comments

@redmunds
Copy link
Contributor

This issue was split off from pull #3398. Not sure if this is an Issue or a Feature Request:

  1. Run Find in Files such that the results contain a file that is in a collapsed folder, and also not in the working set
  2. Select that file in Find in Files results panel
  3. Verify that file is correctly shown in editor and there's no visible selection in file tree or working set
  4. Manually expand folder that contains the file in editor

Result:
Folder expands, but file is not visibly selected

Expected:
File in editor to be selected in file tree once it becomes exposed

@njx
Copy link

njx commented Apr 18, 2013

Reviewed. To me, low priority.

@peterflynn
Copy link
Member

This works in the general case because of specific code we wrote that listens for "open_node.jstree" and calls _forceSelection(..., _lastSelected); to ensure that any newly-revealed child node that matches the current file get highlighted as selected. But the problem is that _lastSelected is stored as a DOM node, so we can't set it to anything meaningful when the current document does not exist in the tree yet (because its folder has never been expanded since launch -- i.e. this bug's repro case). See the if (!nodeFound) case in _documentSelectionFocusChange() for where we bail on this.

We could also take this opportunity to do some code cleanup -- it seems like we could just check against DocumentManager.getCurrentDocument() instead of manually storing & maintaining our own "last selected" state.
I think _lastSelected has gotten overloaded a bit anyway -- it looks like it was originally used only to revert the selection back to a truly previous file when opening the clicked item fails due to I/O error. Maybe restoring it to that limited use would be best...

@njx njx removed their assignment Jul 12, 2014
@pthiess pthiess mentioned this issue Aug 17, 2014
30 tasks
@dangoor
Copy link
Contributor

dangoor commented Sep 17, 2014

I just confirmed that this will be fixed when #8788 is complete.

@dangoor
Copy link
Contributor

dangoor commented Oct 1, 2014

FBNC @redmunds

@dangoor dangoor added this to the Release 0.44 milestone Oct 1, 2014
@redmunds
Copy link
Contributor Author

redmunds commented Oct 1, 2014

Confirmed. Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants