zed
zed copied to clipboard
Add multiline comment crease for buffer row
This is the second step of "Solution proposal for folding multiline comments with no indentation":
- Modify the function
crease_for_buffer_rowinDisplaySnapshotto handle multiline comments.editor::foldandeditor::fold_allwill 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:
- 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.
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
Since using the same branch name wouldn't make sense with the new approach, I am closing this PR.