Skip to content

Conversation

@maxdeviant
Copy link
Member

This PR improves the editor::Rewrap command when working with comments that were not all at the same indentation level.

We now use a heuristic of finding the most common indentation level for each line, using the deepest indent in the event of a tie.

It also removes an .unwrap() that would previously lead to a panic in this case. Instead of unwrapping we now log an error to the logs and skip rewrapping for that selection.

Release Notes:

  • Improved the behavior of editor: rewrap when working with a selection that contained comments at different indentation levels.

@maxdeviant maxdeviant self-assigned this Sep 20, 2024
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Sep 20, 2024
@maxdeviant maxdeviant merged commit 759646e into main Sep 20, 2024
@maxdeviant maxdeviant deleted the marshall/fix-rewrap-panic branch September 20, 2024 15:45
@maxdeviant
Copy link
Member Author

/cherry-pick v0.154.x

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Sep 20, 2024
…dentation levels (#18146)

This PR improves the `editor::Rewrap` command when working with comments
that were not all at the same indentation level.

We now use a heuristic of finding the most common indentation level for
each line, using the deepest indent in the event of a tie.

It also removes an `.unwrap()` that would previously lead to a panic in
this case. Instead of unwrapping we now log an error to the logs and
skip rewrapping for that selection.

Release Notes:

- Improved the behavior of `editor: rewrap` when working with a
selection that contained comments at different indentation levels.
maxdeviant added a commit that referenced this pull request Sep 20, 2024
…dentation levels (cherry-pick #18146) (#18147)

Cherry-picked editor: Improve rewrapping when working with comments at
different indentation levels (#18146)

This PR improves the `editor::Rewrap` command when working with comments
that were not all at the same indentation level.

We now use a heuristic of finding the most common indentation level for
each line, using the deepest indent in the event of a tie.

It also removes an `.unwrap()` that would previously lead to a panic in
this case. Instead of unwrapping we now log an error to the logs and
skip rewrapping for that selection.

Release Notes:

- Improved the behavior of `editor: rewrap` when working with a
selection that contained comments at different indentation levels.

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
noaccOS pushed a commit to noaccOS/zed that referenced this pull request Oct 19, 2024
…dentation levels (zed-industries#18146)

This PR improves the `editor::Rewrap` command when working with comments
that were not all at the same indentation level.

We now use a heuristic of finding the most common indentation level for
each line, using the deepest indent in the event of a tie.

It also removes an `.unwrap()` that would previously lead to a panic in
this case. Instead of unwrapping we now log an error to the logs and
skip rewrapping for that selection.

Release Notes:

- Improved the behavior of `editor: rewrap` when working with a
selection that contained comments at different indentation levels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants