# Improve JSDoc injection in comments \(\#10800\) · gitcafe/zed

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

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

Visibility: public

Requested revision: f987ff05fd2edfccf126258a17288916136cc412

Requested commit: f987ff05fd2edfccf126258a17288916136cc412

Commit: f987ff05fd2edfccf126258a17288916136cc412

Tree: eae5540385595b59c64dc56468d6557a1cb4b448

Author: José Olórtegui

Committer: GitHub

## Message

```
Improve JSDoc injection in comments (#10800)

This PR improves JSDoc injection for syntax highlighting. Now we are
only injecting JSDoc in block comments. The regex was mostly adapted
from nvim-treesitter's implementation (lua) to a rust regex.


https://github.com/nvim-treesitter/nvim-treesitter/blob/eb93c3b2fbe9ca55d70e9297d5c037880b997559/queries/ecma/injections.scm#L1-L6

**Before:**
<img width="441" alt="Screenshot 2024-04-20 at 5 51 04 AM"
src="https://github.com/zed-industries/zed/assets/20072509/8e77851d-22ad-4dc4-8e10-9ac558d3cf40">

**After:**
<img width="441" alt="Screenshot 2024-04-20 at 5 52 05 AM"
src="https://github.com/zed-industries/zed/assets/20072509/a607c219-6973-40c3-958c-44a003d008c3">

Release Notes:

- Changed detection of JSDoc to only do syntax highlighting in block
comments. Improved previous work done in #7826.
```

## Parents

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

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