Skip to content

Commit

Permalink
Add directory name to :cd errors
Browse files Browse the repository at this point in the history
For example `:cd README.md` would say "Not a directory" but would not
print the directory name. Now the error message includes some context
about the operation and requested directory.
  • Loading branch information
the-mikedavis authored and rmburg committed Jan 20, 2025
1 parent d152729 commit 4360634
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,12 @@ fn change_current_directory(
None => Cow::Owned(home_dir()?),
};

cx.editor.set_cwd(&dir)?;
cx.editor.set_cwd(&dir).map_err(|err| {
anyhow!(
"Could not change working directory to '{}': {err}",
dir.display()
)
})?;

cx.editor.set_status(format!(
"Current working directory is now {}",
Expand Down

0 comments on commit 4360634

Please sign in to comment.