Skip to content
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

Add file picker dialogue when opening a directory with :o #2707

Merged
merged 14 commits into from
Dec 23, 2022

Conversation

weakphish
Copy link
Contributor

@weakphish weakphish commented Jun 8, 2022

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.

Jun-08-2022 02-36-03

@the-mikedavis
Copy link
Member

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?

@weakphish
Copy link
Contributor Author

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?

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.

weakphish and others added 2 commits June 9, 2022 13:31
@zen3ger
Copy link
Contributor

zen3ger commented Jun 14, 2022

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.

@sudormrfbin
Copy link
Member

I suppose it can be displayed in the command line area with editor.set_status().

@weakphish
Copy link
Contributor Author

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:
Screen Shot 2022-07-31 at 19 28 18

which I am not sure how to go about resolving @sudormrfbin @zen3ger

@the-mikedavis
Copy link
Member

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()

@the-mikedavis
Copy link
Member

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}"?

@kirawi kirawi added A-helix-term Area: Helix term improvements S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 13, 2022
@weakphish
Copy link
Contributor Author

@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 :)

@the-mikedavis
Copy link
Member

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

@dead10ck
Copy link
Member

This seems fine to me after the set_status is removed. 👍

@weakphish
Copy link
Contributor Author

I removed the editor.set_status call.

Copy link
Member

@dead10ck dead10ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this looks good to me

@dead10ck dead10ck added S-waiting-on-review Status: Awaiting review from a maintainer. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Open file picker at typed directory
6 participants