ZIm/crates/languages/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
..
bash bash: Fix bracket autoclose behavior (#29817) 2025-05-05 10:02:27 -04:00
c editor: Add astrick on new line in multiline comment for Go, Rust, C, and C++ (#30808) 2025-05-16 15:30:04 +05:30
cpp editor: Add astrick on new line in multiline comment for Go, Rust, C, and C++ (#30808) 2025-05-16 15:30:04 +05:30
css Add completion_query_characters in language (#27175) 2025-03-20 16:45:35 +05:30
diff Improve diff syntax highlighting queries (#21740) 2024-12-12 15:18:36 -08:00
gitcommit Fix syntax highlighting of git commit messages (#26988) 2025-03-18 18:18:56 +00:00
go editor: Add astrick on new line in multiline comment for Go, Rust, C, and C++ (#30808) 2025-05-16 15:30:04 +05:30
gomod Add "tool" support to go.mod (#22995) 2025-01-15 17:44:28 +02:00
gowork File context for assistant panel (#9712) 2024-03-29 13:55:01 -07:00
javascript editor: Improve JSDoc extend comment on newline to follow convention (#30800) 2025-05-16 12:42:11 +05:30
jsdoc Add language icons to the language selector (#21298) 2024-12-02 15:01:09 -03:00
json Add completion_query_characters in language (#27175) 2025-03-20 16:45:35 +05:30
jsonc Treat bun.lock as JSONC (#27359) 2025-03-24 09:46:23 -04:00
markdown Add completion_query_characters in language (#27175) 2025-03-20 16:45:35 +05:30
markdown-inline Hide Markdown-Inline language from users with a new 'hidden' flag on language configs (#17104) 2024-08-29 11:23:33 -07:00
python editor: Add python indentation tests (#30902) 2025-05-18 07:29:25 +05:30
regex Improve Regex highlighting (#28183) 2025-04-18 12:44:13 -04:00
rust editor: Add astrick on new line in multiline comment for Go, Rust, C, and C++ (#30808) 2025-05-16 15:30:04 +05:30
tsx editor: Improve JSDoc extend comment on newline to follow convention (#30800) 2025-05-16 12:42:11 +05:30
typescript editor: Improve JSDoc extend comment on newline to follow convention (#30800) 2025-05-16 12:42:11 +05:30
yaml vim: Update anyquotes and anybrackets to behave like mini.ai plugin (#24167) 2025-02-17 14:55:48 -07:00
bash.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
c.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
css.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
go.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
json.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
lib.rs Revert "Revert "python: Enable subroot detection for pylsp and pyright (#27364)" (#29658)" (#30810) 2025-05-16 07:05:33 -04:00
python.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
rust.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
tailwind.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
typescript.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
vtsls.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
yaml.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00