bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#40760: 27.0.50; An indentation problem with const and chaining in js


From: Lars Ingebrigtsen
Subject: bug#40760: 27.0.50; An indentation problem with const and chaining in js-mode
Date: Mon, 14 Mar 2022 10:40:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

> When declaring a const variable which is assigned a value of a long,
> chained expression, the default indentation is wrong (compared to a let
> declaration):
>
> let a = /regex/
>     .test('regex hello');
>
> const a = /regex/
>       .test('regex hello');

I think this is the intended indentation?  That is, they indent to where
the "a" is.

Marcin Borkowski <mbork@mbork.pl> writes:

> This is the temporary solution I employed:
>
> (setq js--declaration-keyword-re "\\<\\(let\\|var\\)\\>")
>
> I would suggest turning this variable into a user option.

This isn't just used for indentation, so altering this const will lead
to other breakages (and so it shouldn't be customiseable, either).

It looks to me like everything here is working as intended (but you're
free to prefer other indentation methods if you want, of course), but I
don't think there's much to do on the Emacs side here.  Anybody else
got an opinion? 

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]