Add block_comment to JS, TSX, and TS (#31400)

This is the first step of ["Solution proposal for folding multiline
comments with no
indentation"](https://github.com/zed-industries/zed/discussions/31395):

> 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:

> 2. 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:

- N/A
This commit is contained in:
Vinicius Akira 2025-05-26 11:53:22 -04:00 committed by GitHub
parent 10af3c7e58
commit 29f0762b6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 0 deletions

View file

@ -4,6 +4,7 @@ path_suffixes = ["js", "jsx", "mjs", "cjs"]
# [/ ] is so we match "env node" or "/node" but not "ts-node"
first_line_pattern = '^#!.*\b(?:[/ ]node|deno run.*--ext[= ]js)\b'
line_comments = ["// "]
block_comment = ["/*", "*/"]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -2,6 +2,7 @@ name = "TSX"
grammar = "tsx"
path_suffixes = ["tsx"]
line_comments = ["// "]
block_comment = ["/*", "*/"]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },

View file

@ -3,6 +3,7 @@ grammar = "typescript"
path_suffixes = ["ts", "cts", "d.cts", "d.mts", "mts"]
first_line_pattern = '^#!.*\b(?:deno run|ts-node|bun|tsx)\b'
line_comments = ["// "]
block_comment = ["/*", "*/"]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },