zed icon indicating copy to clipboard operation
zed copied to clipboard

Add multiline comment crease for buffer row

Open Daquisu opened this issue 9 months ago • 1 comments

This is the second step of "Solution proposal for folding multiline comments with no indentation":

  1. Modify the function crease_for_buffer_row in DisplaySnapshot to handle multiline comments. editor::fold and editor::fold_all will handle multiline comments after this change. To my knowledge, editor::unfold, editor::unfold_all, and the unfold indicator in the gutter will already work after folding, but there will be no fold indicator.

Indeed, this worked as expected, as demonstrated in the manual test video below.

https://github.com/user-attachments/assets/996a3b15-82b1-4155-9e6d-4f117fa543f6

The next step will be:

  1. Modify the function render_crease_toggle in Editor to detect multiline comments. This will make the fold indicator appear.

Release Notes:

  • Added support for folding multiline comments in JavaScript, TSX, and TypeScript.

Daquisu avatar May 26 '25 19:05 Daquisu

I marked the PR as a draft while I update the code.

I will use tree-sitter instead of manipulating strings directly, as discussed in #31395

Daquisu avatar May 27 '25 15:05 Daquisu

Since using the same branch name wouldn't make sense with the new approach, I am closing this PR.

Daquisu avatar May 30 '25 05:05 Daquisu