unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Sam DeSota <me@samdesota.com>, 23492@debbugs.gnu.org
Subject: bug#23492: 24.5; JS spread operator breaks indentatiton
Date: Tue, 10 May 2016 00:34:54 +0300	[thread overview]
Message-ID: <2fcc97dc-e086-252f-59eb-9684e226b12f@yandex.ru> (raw)
In-Reply-To: <CAGacGUOH2rzKgbP2Fip1wZFvqDNuUVfKN+8TQtSEsZCN1VxGFw@mail.gmail.com>

On 05/09/2016 05:50 AM, Sam DeSota wrote:
>
> Using the ES spread operator at the begining of a line causes the
> indentation level to go up, as if it were a chained property access.
>
> ```
> {
>   test: true,
>     ...spread // Indentation should be back one
> }
> ```

Thanks for the report.

Eli, do you think this will be okay to fix in emacs-25?

The patch is below:

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 48eb3e7..f024d39 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1744,7 +1744,7 @@ js--declaration-keyword-re
    "Regular expression matching variable declaration keywords.")

  (defconst js--indent-operator-re
-  (concat "[-+*/%<>&^|?:.]\\([^-+*/]\\|$\\)\\|!?=\\|"
+  (concat "[-+*/%<>&^|?:.]\\([^-+*/.]\\|$\\)\\|!?=\\|"
            (js--regexp-opt-symbol '("in" "instanceof")))
    "Regexp matching operators that affect indentation of continued 
expressions.")

diff --git a/test/indent/js.js b/test/indent/js.js
index 23fae17..b40d47b 100644
--- a/test/indent/js.js
+++ b/test/indent/js.js
@@ -103,6 +103,12 @@ Foobar
      console.log(num);
    });

+var z = [
+  ...iterableObj,
+  4,
+  5
+]
+
  var arr = [
    -1, 2,
    -3, 4 +






  reply	other threads:[~2016-05-09 21:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4EB8157C-7955-4A17-A5A1-CDBA84D7B1C8@samdesota.com>
2016-05-09  2:50 ` bug#23492: 24.5; JS spread operator breaks indentatiton Sam DeSota
2016-05-09 21:34   ` Dmitry Gutov [this message]
2016-05-10 15:53     ` Eli Zaretskii
2016-05-10 23:29       ` 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=2fcc97dc-e086-252f-59eb-9684e226b12f@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=23492@debbugs.gnu.org \
    --cc=me@samdesota.com \
    /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).