Auto Reveal Active file in Tree


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)?


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?


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


It should happen automatically already:

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


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:

among other things that may be giving this effect.


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).


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.


Looks like there is a plugin for this


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: