feat: exclude_dir for excluding directories within vaults#822
feat: exclude_dir for excluding directories within vaults#822neuroconvergent wants to merge 11 commits into
Conversation
neo451
left a comment
There was a problem hiding this comment.
see the code comments, plus:
- there's an obsidian app counterpart that is internally called "userIgnoreFilters", so might be good to call the option "ignore_filters"
- I am not too sure about why add a new option, instead of just use gitignore's patterns, make note attaching and ripgrep also ignore them, seems cleaner, I get the appeal to declare a readable list in config, but for now I prefer less option the better
- need some tests, also fine if you prefer to not go down that rabbit hole, since we don't have proper test coverage in the search module, so just some simpler tests can do
|
|
||
| if Obsidian.opts.exclude_dir and #Obsidian.opts.exclude_dir > 0 then | ||
| for _, dir in ipairs(Obsidian.opts.exclude_dir) do | ||
| add_exclude(search_opts, dir) |
There was a problem hiding this comment.
if the option supposed to be a list of globs or just subdir names? if former, the add_exclude will not work in many cases?
There was a problem hiding this comment.
I did some testing and glob patterns do seem to work. Only exception seems to be a global path but that is the expected ripgrep behaviour.
Can you maybe give me an example where this would fail?
|
thank you for the idea and work btw :) |
|
My original idea was just to exclude entire sub-directories, but it might be better to rename the option to allow individual files. As you have already pointed out, it would fail with some glob patterns when looking so that needs to be robust. The problem with just using gitignore is that there might be files which are to be committed to git but need to be ignored from the plug-in. For example, I use a program called I can certainly add some tests, I hope a few simple tests with different kinds of options such as relative path, absolute path and glob patterns should suffice. I can't personally think of any edge cases that specifically need to be tested but do let me know if you have any in mind and I can add them. |
ef85edc to
6e5cf62
Compare
|
great work, sorry for the late response, some notes before I merge this:
|
|
These suggestions seem fair to me so I have made the changes you suggested. |
Excluding directories from workspaces (#816 )
This PR adds a config option
exclude_dir, which accepts a table of path strings to exclude certain directories from the plug-in entirely. This follows a similar logic to the current implementation of.gitignorei.e. uses glob matching for path (removes all exclusions with ! from current gitignore implementation).The config option has been tested to work as both a global option and as a workspace override.
PR Checklist
CHANGELOG.mdis updatedREADME.mdfilemake chores(for style, lint, types, and tests)