Add extra text property to fix issue with js2-mode integration
* 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.
Showing with 13 additions and 4 deletions