-
-
Notifications
You must be signed in to change notification settings - Fork 618
refactor(#2829): multi instance nvim-tree.explorer.sorters #2835
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
Conversation
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.
This is just fantastic! Thank you for leading the charge here.
This one will be the pattern for other such tasks!
Thank you, @alex-courtis I'm glad you liked it. I'm just really excited about this functionality and happy to help. |
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.
Looking really good... except for the presets.
auto refresh OK
sort = {
sorter = "name",
folders_first = true,
files_first = false,
},
filesystem_watchers = {
enable = true,
},
manual refresh OK
sort = {
sorter = "name",
folders_first = true,
files_first = false,
},
filesystem_watchers = {
enable = false,
},
file/folder comb OK
sort = {
sorter = "name",
folders_first = false,
files_first = false,
},
filesystem_watchers = {
enable = false,
},
sort = {
sorter = "name",
folders_first = false,
files_first = true,
},
filesystem_watchers = {
enable = false,
},
sort = {
sorter = "name",
folders_first = true,
files_first = true,
},
filesystem_watchers = {
enable = false,
},
function OK
sort = {
sorter = function(nodes)
table.sort(nodes, function(a, b)
return #a.name < #b.name
end)
end,
folders_first = true,
files_first = false,
},
filesystem_watchers = {
enable = true,
},
extension NO, similar for other presets
sort = {
sorter = "extension",
folders_first = true,
files_first = false,
},
filesystem_watchers = {
enable = true,
},
E5108: Error executing lua: .../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:46: attempt to index local 'cfg' (a nil value)
stack traceback:
.../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:46: in function 'folders_or_files_first'
.../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:198: in function 'comparator'
.../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:74: in function 'merge'
.../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:110: in function 'split_merge'
.../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:108: in function 'split_merge'
.../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:108: in function 'split_merge'
.../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:108: in function 'split_merge'
.../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:108: in function 'split_merge'
.../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:108: in function 'split_merge'
.../packer/start/raaymax/lua/nvim-tree/explorer/sorters.lua:160: in function 'sort'
.../packer/start/raaymax/lua/nvim-tree/explorer/explore.lua:83: in function 'explore'
...ack/packer/start/raaymax/lua/nvim-tree/explorer/init.lua:52: in function '_load'
...ack/packer/start/raaymax/lua/nvim-tree/explorer/init.lua:43: in function 'new'
...nd/site/pack/packer/start/raaymax/lua/nvim-tree/core.lua:20: in function 'init'
.../nd/site/pack/packer/start/raaymax/lua/nvim-tree/lib.lua:261: in function 'open'
...packer/start/raaymax/lua/nvim-tree/actions/tree/open.lua:32: in function 'open'
@@ -36,6 +37,7 @@ function Explorer.new(path) | |||
absolute_path = path, | |||
nodes = {}, | |||
open = true, | |||
sorters = Sorters:new(M.config), |
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.
That worked out rather nicely.
Apologies for the delayed review; I'm only able to work on nvim-tree on weekends (AEST). |
@alex-courtis accidental close? |
Oh crap, thank you. No more |
I fixed issue you mentioned. |
88a50c0
to
0ad7258
Compare
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.
Just fantastic...
All test + all presets tested OK.
Implementation for #2829
fixes #2829