ZIm/crates/language/src
Marshall Bowers d17c6b392e
Add allow_rewrap setting to control editor::Rewrap behavior for a given language (#25173)
This PR adds a new `allow_rewrap` setting to control how
`editor::Rewrap` behaves for a given language.

This is a language setting, so it can either be configured globally or
within the context of an individual language.

For example:

```json
{
  "allow_rewrap": "in_selections",
  "languages": {
    "Typst": {
      "allow_rewrap": "anywhere"
    }
  }
}
```

There are three different values:

- `in_comment`: Only perform rewrapping within comments.
- `in_selections`: Only perform rewrapping within the current
selection(s).
- `anywhere`: Allow rewrapping anywhere.

The global default is `in_comment`, as it is the most conservative
option and allows rewrapping comments without risking breaking other
syntax.

The `Markdown` and `Plain Text` languages default to `anywhere`, which
mirrors the previous behavior for those language that was hard-coded
into the rewrap implementation.

This setting does not have any effect in Vim mode, as Vim mode already
allowed rewrapping anywhere.

Closes https://github.com/zed-industries/zed/issues/24242.

Release Notes:

- Added an `allow_rewrap` setting to control the `editor::Rewrap`
behavior for a given language.
2025-02-19 16:37:39 +00:00
..
syntax_map Bump Tree-sitter for bug fixes affecting YAML parser loaded via WASM (#25054) 2025-02-17 21:29:27 -08:00
buffer.rs Remove language::markdown (#25136) 2025-02-19 08:55:36 -07:00
buffer_tests.rs Bump Tree-sitter for bug fixes affecting YAML parser loaded via WASM (#25054) 2025-02-17 21:29:27 -08:00
diagnostic_set.rs zeta: Send up diagnostics with prediction requests (#24384) 2025-02-06 18:07:26 +00:00
highlight_map.rs Docs for indent_size_for_line and co 2024-01-09 20:50:34 +01:00
language.rs Remove language::markdown (#25136) 2025-02-19 08:55:36 -07:00
language_registry.rs cx.background_executor().spawn(...) -> cx.background_spawn(...) (#25103) 2025-02-18 20:30:33 +00:00
language_settings.rs Add allow_rewrap setting to control editor::Rewrap behavior for a given language (#25173) 2025-02-19 16:37:39 +00:00
outline.rs Fix panic when outline items have no name (#24574) 2025-02-10 18:50:26 +00:00
proto.rs Fix #24081 - lsp diagnostic code type conversion (#24347) 2025-02-05 21:23:46 -06:00
syntax_map.rs Revert "file_finder: Remove common segments of long paths in search results (#25049)" (#25163) 2025-02-19 15:32:29 +00:00
task_context.rs Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
toolchain.rs Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00