Subject: bug#24896: JSX prop indentation after fat arrow

From: Dmitry Gutov <[email-masked]>
Date: Sun, 20 Nov 2016 00:47:20 +0200

Hi!

On 07.11.2016 11:56, Felipe Ochoa wrote:
> (Preemptive apologies if this is the wrong list/format for this comment
> -- first time filer here!)

Not at all, thanks for the report.

> I
> don't think there's a way to patch the syntax table that would let `>'
> flip between punctuation and close-parens based on context, but one
> possible fix when using js2-mode (not sure about js-mode)

I wonder what could be done in js-mode, too. A 
syntax-propertize-function rule, maybe.

> is to apply a
> "." 'syntax-table text property to the `>' when parsing a fat arrow.
>
> Unfortunately, `js-jsx-indent-line' calls `sgml-indent-line' using
> `js--as-sgml', which sets `parse-sexp-lookup-properties' to nil.
>
> Would there be any harm in setting `parse-sexp-lookup-properties' to t
> instead? As far as I can tell, js-mode and js2-mode only use
> 'syntax-table propeties for regex literals.

They also set that variable to t anyway. The only possible danger might 
come from sgml-mode, which does not do that.

I'm not sure which danger exactly, because all examples in 
test/indent/js-jsx.js seem to behave identically whether js--as-sgml 
includes the parse-sexp-lookup-properties binding or not.

Jackson, could you maybe shed some light on this?