leny / atom-tree-ignore

Use a .atomignore file to hide files & folder in tree view
MIT License
41 stars 13 forks source link

Navigating tree with keyboard still passes through hidden files #25

Open jackmott opened 8 years ago

jackmott commented 8 years ago

Environment:

AlphaFrontStatic/scripts/*.js

Bug

When navigating down through the list of files in a folder by pressing the up and down arrow keys, the selection will pass through the ignored files, such that a folder full of .ts and .js files, where .js files are ignored, makes it such that you have to double tap the down arrow key to move from one file to the next.

jacquescrocker commented 8 years ago

From the Fuzzy Finder docs:

This package uses both the core.ignoredNames and fuzzy-finder.ignoredNames config settings to filter out files and folders that will not be shown. Both of those config settings are interpreted as arrays of minimatch glob patterns.

Wonder how hard it would be for atom-tree-ignore to edit this setting.

jacquescrocker commented 8 years ago

Sooo... turns out this is not hard. i can edit it via the atom chrome inspector trivially, and it changes the ignore for both the treeview and fuzzy-finder automatically.

Unless I'm missing something really obvious, most of the code in tree-ignore.js that does the hiding and showing via css element .tree-ignore-element is useless. Since once you set core.ignoredNames, everything hides automatically.

I'm editing the package now to try to hack in support for changing this config. This is my first time editing anything on atom so it'll probably be a shit show. But let's see if it works :)

jackmott commented 8 years ago

Good luck! Thanks for taking it on.

jacquescrocker commented 8 years ago

Well... i got it working. But there's a big flaw in my plan. Setting core.ignoredNames seems to set it globally, on all projects

jacquescrocker commented 8 years ago

Seems like Atom needs some internal upgrades before .atomignore is going to really be usable by anyone. Damn shame

You can try the fork for yourself here: https://github.com/jacquescrocker/atom-ignore

leny commented 8 years ago

Its a big problem from atom and config, the fact that the config is global and can't really be changed on project-basis.

I've tryed to make a package for that, atom-local-config, but, due to the core behavior of Atom regarding config, it's very random. You can dig into this plugin to see.

Th problem has been discussed on Atom's forums, I don't know if it is on their shortlist.

jacquescrocker commented 8 years ago

hmm, i got an idea from #27

what if we just monkey patched the atom core api method repo.isPathIgnored()

we'd check the local path first, and then fallback to the default functionality

repos are already scoped to the project you are already on, so that would make it work.

// this will break your local project until reload, be careful :)
repo = atom.project.getRepositories()[0]
repo.isPathIgnored = function(path){ console.log("Atom -- can eat my atom: "+path); return true; }

and watch the insanity

jacquescrocker commented 8 years ago

Looks like fuzzy-finder does some aggressive caching, so even with the monkey patch, it doesn't pick things up right away.

Related to this horrible issue which bites me in the ass almost every day :( https://github.com/atom/fuzzy-finder/issues/168

leny commented 8 years ago

Feel free to dig... I'll be quite busy for the next days to do code on this package, but can merge and publish if you find something useful.

jacquescrocker commented 8 years ago

Cool, it works! I got it functional here: https://github.com/jacquescrocker/atom-ignore

WoLfulus commented 8 years ago

+1