ZIm/crates/vim/src
Kirill Bulatov 16366cf9f2
Use anyhow more idiomatically (#31052)
https://github.com/zed-industries/zed/issues/30972 brought up another
case where our context is not enough to track the actual source of the
issue: we get a general top-level error without inner error.

The reason for this was `.ok_or_else(|| anyhow!("failed to read HEAD
SHA"))?; ` on the top level.

The PR finally reworks the way we use anyhow to reduce such issues (or
at least make it simpler to bubble them up later in a fix).
On top of that, uses a few more anyhow methods for better readability.

* `.ok_or_else(|| anyhow!("..."))`, `map_err` and other similar error
conversion/option reporting cases are replaced with `context` and
`with_context` calls
* in addition to that, various `anyhow!("failed to do ...")` are
stripped with `.context("Doing ...")` messages instead to remove the
parasitic `failed to` text
* `anyhow::ensure!` is used instead of `if ... { return Err(...); }`
calls
* `anyhow::bail!` is used instead of `return Err(anyhow!(...));`

Release Notes:

- N/A
2025-05-20 23:06:07 +00:00
..
digraph Add Vim digraphs (#14887) 2024-07-28 22:44:32 -06:00
normal vim: Fix incorrect escaping parenthesis of replacement string (#29555) 2025-04-29 19:55:02 -06:00
test vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
change_list.rs Add a way to navigate between changes (#28891) 2025-04-16 14:09:17 -06:00
command.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
digraph.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
helix.rs Temporarily disable helix tests (#28279) 2025-04-07 21:50:35 +00:00
indent.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
insert.rs Honor default_mode in NormalBefore (#29518) 2025-04-28 08:51:06 -06:00
mode_indicator.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
motion.rs vim: Add g M motion to go to the middle of a line (#30227) 2025-05-16 21:21:30 +00:00
normal.rs vim: Fix r enter indentation (#29838) 2025-05-05 16:57:32 +01:00
object.rs vim: Create anyquotes, anybrackets, miniquotes, and minibrackets text objects (#26748) 2025-04-29 22:09:27 +00:00
replace.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
rewrap.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
state.rs fix(vim): Store up to the 9th numbered register instead of 7th (#29986) 2025-05-06 11:17:45 +01:00
surrounds.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
test.rs editor: Refactor EditorMode::Full (#28546) 2025-04-10 23:22:27 +00:00
vim.rs editor: Add minimap (#26893) 2025-05-07 23:11:09 +03:00
visual.rs Fix panic in vim selection restoration (#29251) 2025-04-22 22:28:13 -06:00