GNU bug report logs - #24896
JSX prop indentation after fat arrow

Previous Next

Package: emacs;

Reported by: Felipe Ochoa <felipe.nospam.ochoa <at> gmail.com>

Date: Mon, 7 Nov 2016 16:35:02 UTC

Severity: minor

Merged with 26001, 30225, 32158

Found in versions 26.1, 27.0.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 24896 <at> debbugs.gnu.org (full text, mbox):

From: Jackson Ray Hamilton <jackson <at> jacksonrayhamilton.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>,
 Felipe Ochoa <felipe.nospam.ochoa <at> gmail.com>, 24896 <at> debbugs.gnu.org
Subject: Re: bug#24896: JSX prop indentation after fat arrow
Date: Mon, 21 Nov 2016 21:48:45 -0800
Hi guys,

Sorry that I cannot provide a definitive answer for the purpose of that
line of code - I probably should have provided a more detailed comment
or committed in smaller hunks - but I'll make a guess informed by the
way I usually think, and thus probably thought, when I wrote that.

When figuring out how to get `sgml-indent-line' to behave correctly, and
upon discovering that I needed to use `with-syntax-table', I probably
read the manual entry on syntax tables and discovered the existence of
`parse-sexp-lookup-properties', and as a (redundant) safety measure
tried to emulate the sgml-mode environment as closely as possible.

If the tests still pass then let's try enabling it.

Jackson

On 11/19/2016 02:47 PM, Dmitry Gutov wrote:
> 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?




This bug report was last modified 5 years and 352 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.