Auto Reveal Active file in Tree


#1

Is it possible to have Atom automatically reveal the active file in the tree view (instead of manually using the tree-view:reveal-active-file command)?


#2

What do you mean by reveal the active file in the tree-view? Do you mean highlight the one that you have selected like this?


#3

Yes. The tree-view:reveal-active-file command does this but I’d like it to happen automatically whenever I select a file.


#4

It should happen automatically already:

Maybe you have a package interfering? Does it work in safe mode?


#5

I suspect it is just a theme issue. The active item has the additional class selected on it. The default Atom Dark UI has the following in it:

https://github.com/lee-dohm/atom-dark-ui/blob/master/stylesheets/tree-view.less#L6-L11

among other things that may be giving this effect.


#6

Interesting, I had to restart Atom. Your simple example works now but if the file is in a collapsed tree node or off screen it will not be shown.

tree-view:reveal-active-file handles both cases correctly (expands collapsed nodes and scrolls to the right position).


#7

Good point. For that, you would probably have to write a package that checks to see if the active tab has changed and reveal the active file.


#9

Looks like there is a plugin for this https://atom.io/packages/auto-reveal-in-sidebar


#10

It seems that tree-view (which is a core package) now has this functionality added. (which has also broken the packages that implemented this before). Here’s an easy way to get it working: