Atom: Auto hides tree view on startup

Created on 29 Dec 2016  路  14Comments  路  Source: file-icons/atom

I've updated to the latest file-icons (2.0.1) and strangely my tree view is hidden on startup.
I've disabled every package and it works, if I enable file-icons it will be hidden again. Very annoying since I use tree view all the time.

bug consumers

All 14 comments

On it.

Thanks for the quick response :) The latest version that works correctly is 1.7.25.

Could you please tell me your tree-view settings? :)

You can copy the current settings by running this in devtools:

copy(atom.config.get("tree-view"));

Sure, here it is.

{
  "hideIgnoredNames": true,
  "hideVcsIgnoredFiles": true,
  "squashDirectoryNames": false,
  "showOnRightSide": false,
  "sortFoldersBeforeFiles": true,
  "autoReveal": false,
  "focusOnReveal": true,
  "alwaysOpenExisting": false
}

K枚szi! I'll look into this soon. =)

Okay, I still have no idea why this is happening, but this seems to do the trick:

diff --git a/lib/consumers/tree-view.js b/lib/consumers/tree-view.js
index 543970e..e144d5f 100644
--- a/lib/consumers/tree-view.js
+++ b/lib/consumers/tree-view.js
@@ -18,7 +18,18 @@ class TreeView{
        this.disposables.add(
            atom.packages.onDidActivatePackage(_=> this.checkPanes()),
            atom.packages.onDidDeactivatePackage(_=> this.checkPanes()),
-           atom.packages.onDidActivateInitialPackages(_=> this.checkPanes()),
+           atom.packages.onDidActivateInitialPackages(() => {
+               
+               // [#472] HACK: Show the tree-view if it's not visible at startup.
+               const state = atom.packages.packageStates["tree-view"];
+               if((!state || state.attached) && !this.visible){
+                   const workspace = atom.views.getView(atom.workspace);
+                   setImmediate(() => atom.commands.dispatch(workspace, "tree-view:show"));
+                   console.log("Fixed!");
+               }
+               
+               this.checkPanes();
+           }),

            this.onDidAttach(_=> {
                this.entryElements = this.element[0].getElementsByClassName("entry");

Could you please test this to see if it works? :) The file to edit is lib/consumers/tree-view.js in the installed package's directory.

Actually, it looks like I'll be pushing out another patch release soon enough, so you'll be able to confirm then if this works or not. =)

@MrBlaise I've cut another patch... please let me know if you're still experiencing this, okay? Thank you!

@Alhadis Sadly the problem isn't fixed for me :/
I've tried it out on windows 10 and it works (it worked with 2.0.1 as well). But on Ubuntu 16.04 the problem is still present.

I have no way to test Ubuntu. :( I'm guessing it's an OS-specific matter...

I'll try and look into it later, but right now, Nuclide is top priority.

@MrBlaise I've submitted a PR to Atom's tree-view that proposes a more integrated solution (which I know they'll reject, since they'd probably want to keep their core code "pure").

Try cloning my branch locally and linking it with apm link (remember to run apm install in the cloned directory, too). See if that fixes this issue. =)

@Alhadis I was just going to do what you suggested, when I saw you released another patch 2.0.3 I've updated to that and now the tree view appears properly. I don't know what changed but it seems like it solved my problem as well :)

HAHA, I axed usage of Atom's default icon API. It was just dead weight. Didn't expect it would actually solve any issues... what does that tell ya, eh?

Yes I saw your PR to the atom repo regarding this API, I'm interested in their response :) Keep up the good work and thanks for this amazing package.

Was this page helpful?
0 / 5 - 0 ratings