Function: js-ts--syntax-propertize

js-ts--syntax-propertize is a byte-compiled function defined in js.el.gz.

Signature

(js-ts--syntax-propertize BEG END)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js-ts--syntax-propertize (beg end)
  (let ((captures (treesit-query-capture 'javascript js-ts--s-p-query beg end)))
    (pcase-dolist (`(,name . ,node) captures)
      (let* ((ns (treesit-node-start node))
             (ne (treesit-node-end node))
             (syntax (pcase-exhaustive name
                       ('regexp
                        (decf ns)
                        (incf ne)
                        (string-to-syntax "\"/"))
                       ('jsx
                        (string-to-syntax "|")))))
        (put-text-property ns (1+ ns) 'syntax-table syntax)
        (put-text-property (1- ne) ne 'syntax-table syntax)))))