-
-
Notifications
You must be signed in to change notification settings - Fork 626
feat: Mixin Sorter (#1565) Self Solved #1566
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
Changes from 2 commits
5e48681
481dbb2
e5e8b40
c34b7d2
10ac41d
138a0ac
ece7127
7492886
d4f72d2
d921a20
fda6d4c
26e4066
dfbfec6
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 |
---|---|---|
|
@@ -73,6 +73,9 @@ function M.merge_sort(t, comparator) | |
end | ||
|
||
split_merge(t, 1, #t, comparator) | ||
if M.after_sort 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. Do we need to run the comparator and split_merge first? We should call the user's after_sort instead of M.merge_sort. 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. OMZ,,, I miss understood.. 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.
We would need to try it. Please try 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. i will try this too |
||
M.after_sort(t) | ||
end | ||
end | ||
|
||
local function node_comparator_name_ignorecase_or_not(a, b, ignorecase) | ||
|
@@ -150,7 +153,11 @@ end | |
|
||
function M.setup(opts) | ||
M.sort_by = opts.sort_by | ||
if M.sort_by == "modification_time" then | ||
M.after_sort = opts.after_sort | ||
|
||
if M.sort_by and type(M.sort_by) == "function" then | ||
M.node_comparator = M.sort_by | ||
elseif M.sort_by == "modification_time" then | ||
M.node_comparator = M.node_comparator_modification_time | ||
elseif M.sort_by == "case_sensitive" then | ||
M.node_comparator = M.node_comparator_name_case_sensisive | ||
|
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.
Why do we need this? Is it because mixin sort cannot be achieved via a comparator?