# editor: Support rewrap in block comments \(\#34418\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/2ba25b5c940e9e2a9584001b7deb3ea783f8a259)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 2ba25b5c940e9e2a9584001b7deb3ea783f8a259

Requested commit: 2ba25b5c940e9e2a9584001b7deb3ea783f8a259

Commit: 2ba25b5c940e9e2a9584001b7deb3ea783f8a259

Tree: 520d083af4828c0d78102e312e6b08f88d95524c

Author: claytonrcarter

Committer: GitHub

## Message

````
editor: Support rewrap in block comments (#34418)

This updates `editor: rewrap` to work within doc comments, based on the
code that extends such comments on newline. I added some tests, and I've
tested it out in JS, C and PHP. (Though PHP depends on
https://github.com/zed-extensions/php/pull/40)

Closes #19794
Closes #18221

**Caveat:**
~~This will not rewrap an existing single-line block comment, such as
the one provided in #18221:~~ this will now rewrap as expected
```c
/* we can triangulate any convex polygon by picking a vertex and connecting it to the next two vertices; we first read two vertices, and then, for every subsequent vertex, we can form a triangle by connecting it to the first and previous vertex */
```
However, it will rewrap a similar comment if it is shaped like a doc
comment. In other words, this will rewrap as expected:
```c
/* 
 * we can triangulate any convex polygon by picking a vertex and connecting it to the next two vertices; we first read two vertices, and then, for every subsequent vertex, we can form a triangle by connecting it to the first and previous vertex 
 */
```

This seems like a reasonable improvement and limitation to me,
especially as a first step.

cc @smitbarmase because I think that you've been making a lot of the
`newline` and `rewrap` changes recently. (Thank you for those, by the
way!)

Release Notes:

- Added support for rewrap in block comments.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
````

## Parents

- [965dbc988fae39cc9dfdd7cdac6f38e8234b3913](https://git.cafe/gitcafe/zed/commit/965dbc988fae39cc9dfdd7cdac6f38e8234b3913?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/2ba25b5c940e9e2a9584001b7deb3ea783f8a259?format=markdown)
