albert
albert copied to clipboard
[files] Excluding certain folders
Why?
Right now the files extension allows you to add folders to index. However, it's common for modern developing tools to have huge folders such as 'node_modules' or 'venv' or 'vendor' which pollute the search. It would be great if we could add a list of excluded folders (maybe in the form of regex, maybe in the form of exact match) so that the indexer wouldn't go inside them.
How?
I don't exactly know how the indexer is built, but it shouldn't be too hard to check that the current folder name is not a "blacklisted folder name" before recursing into indexing it.
Read the docs or simply Google ".albertignore"
After reading about .albertignore (the doc linked https://albertlauncher.github.io/docs/extensions/files/ doesn't work anymore) I cannot get it to ignore every subfolder (no matter the nesting) with some name. That would be very useful as right now I have to manually add a .albertignore (or add a line to an existing .albertignore) while the ideal way would be having a root .albertignore who would ignore all node_modules (no matter how deeply nested they are in the folder structure).
see https://github.com/albertlauncher/plugins/tree/master/files
Sure a single line node_modules should work. Note beginning with a slash makes the path relative to the root. /node_modules ignores only $ROOTPATH/node_modules and ignores the nested dir. Correct me if im wrong. Them this is a bug.
I think this is indeed a bug. Placing a .albertignore file with content node_modules (no /s or *s) in a directory with many nested node_modules still indexes folders and files within them. Refreshing the index via the "Start Scan" button or restarting Albert doesn't seem to update it either.
also i'm able to reproduce this issue, if there is too many nesting for a wildcard it fails.
This seems to be the function/recursive call that handles the ignored paths. It looks like localIgnoreEntries is passed to the child nodes, too, so I'm not sure why nested file ignores aren't working (though I'm not very familiar with C++, so I'm likely missing something if the problem is indeed in this function :eyes:)
I have the same problem. For example, adding a file into the parent for excluding node_modules.
Still, I see searching inside the children for node_modules
This is really important to fix..
This worked for me:
- Delete
~/.cache/albert/org.albert.extension.files/fileindex.json(should probably close Albert first) - Create
.albertignorein the home directory and add the following:/**/node_modules/**