• Jackson Ray Hamilton's avatar
    Add extra text property to fix issue with js2-mode integration · 382a508e
    Jackson Ray Hamilton authored
    * lisp/progmodes/js.el (js-jsx--put-syntax-table): New function for
    consistently ensuring smooth js2-mode integration.  js2-mode sets
    syntax-table temporarily while parsing buffers—seemingly to recover
    from parsing interruptions—and then it later clears syntax-table
    blindly.  When integrating with js-mode, this means that unterminated
    string quotes are re-broken in JSX (i.e., they become strings again,
    often stringifying large regions of the buffer which should not be
    strings).  We try to treat quotes in JSXText as non-strings by setting
    syntax-table to a non-“string quote” syntax class, but that stops
    working if we lose the property.  On the js2-mode end, by scanning for
    this second js-jsx-syntax-table property, we can recover the
    syntax-table property there.
    (js-jsx--text-range, js-jsx--syntax-propertize-tag): Use
    js-jsx--put-syntax-table for above reason.
    (js-jsx--text-properties): Clear the js-jsx-syntax-table property too.
    382a508e
js.el 171 KB