Function: tsx-ts--syntax-propertize-captures
tsx-ts--syntax-propertize-captures is a byte-compiled function defined
in typescript-ts-mode.el.gz.
Signature
(tsx-ts--syntax-propertize-captures CAPTURES)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/typescript-ts-mode.el.gz
(defun tsx-ts--syntax-propertize-captures (captures)
(pcase-dolist (`(,name . ,node) captures)
(let ((ns (treesit-node-start node))
(ne (treesit-node-end node)))
(pcase-exhaustive name
('regexp
(let ((syntax (string-to-syntax "\"/")))
(decf ns)
(incf ne)
(put-text-property ns (1+ ns) 'syntax-table syntax)
(put-text-property (1- ne) ne 'syntax-table syntax)))
;; We put punctuation syntax on all the balanced pair
;; characters so they don't mess up syntax-ppss. We can't put
;; string syntax on the whole thing because a) it doesn't work
;; if the text is one character long, and b) it interferes
;; forward/backward-sexp.
('jsx
(save-excursion
(goto-char ns)
(while (re-search-forward (rx (or "{" "}" "[" "]"
"(" ")" "<" ">"))
ne t)
(put-text-property
(match-beginning 0) (match-end 0)
'syntax-table (string-to-syntax
(cond
((equal (match-string 0) "<") "(<")
((equal (match-string 0) ">") ")>")
(t ".")))))))))))