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

Support opening a folder with goto_file #7906

Closed
cbr9 opened this issue Aug 10, 2023 · 1 comment · Fixed by #7909
Closed

Support opening a folder with goto_file #7906

cbr9 opened this issue Aug 10, 2023 · 1 comment · Fixed by #7909

Comments

@cbr9
Copy link
Contributor

cbr9 commented Aug 10, 2023

When the selection points to a folder and the user uses goto_file (gf), the editor will raise an error.

I would propose that it opens a file picker with the elements of the folder, similar to when you launch helix by passing it a folder name.

Thoughts?

(I could work on a PR, with some guidance)

@woojiq
Copy link
Contributor

woojiq commented Aug 11, 2023

Sounds logical for me. Though I didn't get into situations where I might need it. Probably I just don't write a lot of raw text.
If you want to start this PR, you need to start looking for the code here:

fn goto_file(cx: &mut Context) {
goto_file_impl(cx, Action::Replace);

And here the error occurs:
if let Err(e) = cx.editor.open(&PathBuf::from(p), action) {
cx.editor.set_error(format!("Open file failed: {:?}", e));
}

To find out how to "display a picker" you can look at impl of commands like "Open file picker".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants