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.
eb93c3b2fb/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.
This commit is contained in:
parent
2306e3cd50
commit
f987ff05fd
3 changed files with 6 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
|||
((comment) @content
|
||||
(((comment) @_jsdoc_comment
|
||||
(#match? @_jsdoc_comment "(?s)^/[*][*][^*].*[*]/$")) @content
|
||||
(#set! "language" "jsdoc"))
|
||||
|
||||
((regex) @content
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
((comment) @content
|
||||
(((comment) @_jsdoc_comment
|
||||
(#match? @_jsdoc_comment "(?s)^/[*][*][^*].*[*]/$")) @content
|
||||
(#set! "language" "jsdoc"))
|
||||
|
||||
((regex) @content
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
((comment) @content
|
||||
(((comment) @_jsdoc_comment
|
||||
(#match? @_jsdoc_comment "(?s)^/[*][*][^*].*[*]/$")) @content
|
||||
(#set! "language" "jsdoc"))
|
||||
|
||||
(((comment) @reference
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue