-
-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(#2654): filters.custom may be a function #2655
Changes from 7 commits
b754082
e942899
be1e6e4
d65092d
0e46599
1304c03
89653f3
7978157
7339881
0e880dc
2e4a1d1
5e416f3
b447d69
38ded48
8363ac5
c4b4aae
1e054f3
340c581
8385e89
e771143
c3336b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,8 +87,14 @@ local function custom(path) | |
-- filter custom regexes | ||
local relpath = utils.path_relative(path, vim.loop.cwd()) | ||
for pat, _ in pairs(M.ignore_list) do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With some hacking
I was able to pass the custom function through, however it's never executed as I reckon you'll need to directly call the custom function outside of this loop. |
||
if vim.fn.match(relpath, pat) ~= -1 or vim.fn.match(basename, pat) ~= -1 then | ||
return true | ||
if type(pat) == "function" then | ||
if pat(path) then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's give the user all the information here to allow creation of any sort of filter. We can use Yes, that's a performance hit, however only for users that use a custom filter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to get the node from the path, at the stage the filter is ran? I am not very familiar with this codebase, so apologies if I am misunderstanding something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will often be null; we just have to test for that and ignore it. |
||
return true | ||
end | ||
else | ||
if vim.fn.match(relpath, pat) ~= -1 or vim.fn.match(basename, pat) ~= -1 then | ||
return true | ||
end | ||
end | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be added to
ACCEPTED_TYPES