zed icon indicating copy to clipboard operation
zed copied to clipboard

Add `block_comment` to JS, TSX, and TS

Open Daquisu opened this issue 9 months ago • 1 comments

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

  1. Add block_comment in the config.toml for the languages javascript, typescript, tsx. These are simple languages for this feature, and I am already familiar with them.

The next step will be:

  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.

Release Notes:

  • Added block_comment to JavaScript, TSX, and Typescript.

Daquisu avatar May 25 '25 23:05 Daquisu

Edit: I dug into the GH Action code and solved the errors below by using cargo nextest run --workspace --no-fail-fast. I will keep the text below in case it can help someone in the future.

All tests pass locally.

Details about the issue I was running into

After cloning the repo and running cargo test --workspace, I got a few test errors even with no code changes. If I comment the first error, I get multiple doc errors.

 ---- terminal_tool::tests::test_working_directory stdout ----

thread 'terminal_tool::tests::test_working_directory' panicked at crates/zlog/src/zlog.rs:14:28:
Logger should not be initialized twice: SetLoggerError(())

Doc error example:

error: cannot find derive macro `Documented` in this scope
 --> crates/component/src/component.rs:231:10
  |
4 | #[derive(Documented)]
  |          ^^^^^^^^^^

error[E0599]: no associated item named `DOCS` found for struct `MyComponent` in the current scope
 --> crates/component/src/component.rs:236:20
  |
5 | struct MyComponent;
  | ------------------ associated item `DOCS` not found for this struct
...
9 |         Some(Self::DOCS)
  |                    ^^^^ associated item not found in `MyComponent`

error: aborting due to 2 previous errors

cargo test --workspace -p language buffer_tests passes on all tests. I will keep working on fixing these local issues.

Daquisu avatar May 25 '25 23:05 Daquisu

The issue you ran into should be fixed by #31436. Your next step sounds good. If you get stuck feel free to put up your work as a draft PR and ask for help!

probably-neb avatar May 26 '25 15:05 probably-neb