unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Marcin Borkowski <mbork@mbork.pl>
Cc: 40760@debbugs.gnu.org
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	[thread overview]
Message-ID: <87fsnkoosu.fsf@gnus.org> (raw)
In-Reply-To: <87r1wf99id.fsf@mbork.pl> (Marcin Borkowski's message of "Wed, 22 Apr 2020 11:05:08 +0200")

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





  parent reply	other threads:[~2022-03-14  9:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22  9:05 bug#40760: 27.0.50; An indentation problem with const and chaining in js-mode Marcin Borkowski
2022-03-14  5:10 ` Marcin Borkowski
2022-03-14  9:40 ` Lars Ingebrigtsen [this message]
2022-03-14 10:13   ` Marcin Borkowski
2022-03-18  1:12     ` Dmitry Gutov
2022-03-21  6:26       ` Marcin Borkowski
2022-03-23  0:46         ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsnkoosu.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=40760@debbugs.gnu.org \
    --cc=mbork@mbork.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).