• Jackson Ray Hamilton's avatar
    Propertize and font-lock JSXText and JSXExpressionContainers · 8dae7423
    Jackson Ray Hamilton authored
    This completes highlighting support for JSX, as requested in:
    - https://github.com/mooz/js2-mode/issues/140
    - https://github.com/mooz/js2-mode/issues/330
    - https://github.com/mooz/js2-mode/issues/409
    * lisp/progmodes/js.el (js--name-start-chars): Extract part of
    js--name-start-re so it can be reused in another regexp.
    (js--name-start-re): Use js--name-start-chars.
    (js-jsx--font-lock-keywords): Use new matchers.
    (js-jsx--match-text, js-jsx--match-expr): New matchers to remove
    typical JS font-locking and extend the font-locked region,
    (js-jsx--tag-re, js-jsx--self-closing-re): New regexps matching JSX.
    (js-jsx--matched-tag-type, js-jsx--matching-close-tag-pos)
    (js-jsx--enclosing-curly-pos, js-jsx--enclosing-tag-pos)
    (js-jsx--at-enclosing-tag-child-p): New functions for parsing and
    analyzing JSX.
    (js-jsx--text-range, js-jsx--syntax-propertize-tag-text): New
    functions for propertizing JSXText.
    (js-jsx--syntax-propertize-tag): Propertize JSXText children of tags.
    (js-jsx--text-properties): Remove JSXText-related text properties when
    (js-mode): Extend the syntax-propertize region with
    syntax-propertize-multiline; we are now adding the syntax-multiline
    text property to buffer ranges that are JSXText to ensure the whole
    multiline JSX construct is reidentified.
js.el 157 KB