Function: js--syntax-propertize-extend-region
js--syntax-propertize-extend-region is a byte-compiled function
defined in js.el.gz.
Signature
(js--syntax-propertize-extend-region START END)
Documentation
Extend the START-END region for propertization, if necessary.
For use by syntax-propertize-extend-region-functions.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
;; Adding `syntax-multiline' text properties to JSX isn’t sufficient
;; to identify multiline JSX when first typing it. For instance, if
;; the user is typing a JSXOpeningElement for the first time…
;;
;; <div
;; ^ (point)
;;
;; …and the user inserts a line break after the tag name (before the
;; JSXOpeningElement starting on that line has been unambiguously
;; identified as such), then the `syntax-propertize' region won’t be
;; extended backwards to the start of the JSXOpeningElement:
;;
;; <div ← This line wasn’t JSX when last edited.
;; attr=""> ← Despite completing the JSX, the next
;; ^ `syntax-propertize' region wouldn’t magically
;; extend back a few lines.
;;
;; Therefore, to try and recover from this scenario, parse backward
;; from “>” to try and find the start of JSXBoundaryElements, and
;; extend the `syntax-propertize' region there.
(defun js--syntax-propertize-extend-region (start end)
"Extend the START-END region for propertization, if necessary.
For use by `syntax-propertize-extend-region-functions'."
(if js-jsx-syntax (js-jsx--syntax-propertize-extend-region start end)))