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

Code action Create module crashes helix if the folder for the module to be created does not exist #1773

Closed
korken89 opened this issue Mar 8, 2022 · 0 comments · Fixed by #1775
Labels
A-language-server Area: Language server client C-bug Category: This is a bug

Comments

@korken89
Copy link
Contributor

korken89 commented Mar 8, 2022

When running the code action Create module, helix crashes if the module file wants to be created in a folder that does not exist.

Reproduction steps

# Start a Rust project.
cargo new --lib bug

src/lib.rs contents:

mod error;

src/error.rs contents:

mod running_create_module_code_action_on_me_will_crash_helix;

Run the code action Create module on the module above. When it sees that the error folder does not exist (it wants to create src/error/running_create_module_code_action_on_me_will_crash_helix.rs) helix will crash with:

thread 'main' panicked at 'called 'Result::unwrap()' on an 'Err' value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', helix-term/src/commands/lsp.rs:408:60
note: run with 'RUST_BACKTRACE=1' environment variable to display a backtrace

Expected outcome

helix should first create the folder, and then the file.

Environment

  • Platform: Linux
  • Terminal emulator: Alacritty
  • Helix version: v0.5.0-833-gf1e90ac2
~/.cache/helix/helix.log
2022-03-08T16:13:05.245 helix_lsp::transport [ERROR] err <- "[ERROR rust_analyzer::reload] failed to switch build data: rust-analyzer failed to run build scripts:\n"
2022-03-08T16:13:05.245 helix_lsp::transport [ERROR] err <- "error: could not compile `device-driver` due to 2 previous errors; 1 warning emitted\n"
2022-03-08T16:13:05.245 helix_lsp::transport [ERROR] err <- "\n"
2022-03-08T16:13:05.245 helix_lsp::transport [ERROR] err <- "\n"
2022-03-08T16:13:06.289 helix_lsp::transport [ERROR] err <- "[ERROR rust_analyzer::reload] failed to switch build data: rust-analyzer failed to run build scripts:\n"
2022-03-08T16:13:06.289 helix_lsp::transport [ERROR] err <- "error: could not compile `device-driver` due to 2 previous errors; 1 warning emitted\n"
2022-03-08T16:13:06.289 helix_lsp::transport [ERROR] err <- "\n"
2022-03-08T16:13:06.289 helix_lsp::transport [ERROR] err <- "\n"

@korken89 korken89 added the C-bug Category: This is a bug label Mar 8, 2022
@sudormrfbin sudormrfbin added the A-language-server Area: Language server client label Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants