helix
helix copied to clipboard
Add file picker dialogue when opening a directory with :o
This pull requests closes #2558.
The behavior of :o is modified such that when opening a directory, the file picker pane is opened on the chosen directory rather than returning an error.

The behavior with opening multiple directories might need a bit of tuning. :open .git .github pushes a picker for .git and then .github, so pickers end up in reverse order. It could also make sense to fail the command when more than one path is a directory, although I kinda like the multiple pickers. What do others think about the behavior?
The behavior with opening multiple directories might need a bit of tuning.
:open .git .githubpushes a picker for.gitand then.github, so pickers end up in reverse order. It could also make sense to fail the command when more than one path is a directory, although I kinda like the multiple pickers. What do others think about the behavior?
I think if I can reverse the order of the picker appearance, it's solid. I agree that multiple pickers is a good thing to have, generally.
Would it make sense to display the name of the directory e.g. in the status line when you have the picker open? Just to make it a bit more visually obvious which directory you are looking at.
I suppose it can be displayed in the command line area with editor.set_status().
I don't know if there's a way to use editor.set_status due to the constraints on the function. The closest I can get is something like this:

which I am not sure how to go about resolving @sudormrfbin @zen3ger
I'm not sure this is a good idea allocation-wise but set_status can take a String so you can use path.to_string_lossy().to_string()
It looks like the cx.editor.set_status statuses overwrite each other when there are multiple directories in a row. Maybe we could have the file picker write a status message when it opens saying something like "Picking files from {dir}"?
@the-mikedavis If I am understanding you correctly, it seems that there is a lot of constraints on the callback that make this difficult. Did your suggestion mean implementing the status change as part of the callback, or is there a piece I'm missing?
Thanks for the help :)
Hmm yeah I think it's not possible currently or easy to change to have one callback create the next like I'm thinking. I think it's probably fine to ignore set_statusing for the pickers for now and we can revisit it later / leave it as a TODO
This seems fine to me after the set_status is removed. :+1:
I removed the editor.set_status call.