GNU bug report logs -
#23492
24.5; JS spread operator breaks indentatiton
Previous Next
Reported by: Sam DeSota <me <at> samdesota.com>
Date: Mon, 9 May 2016 17:19:02 UTC
Severity: normal
Found in version 24.5
Fixed in version 25.1
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 23492 <at> debbugs.gnu.org (full text, mbox):
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 +
This bug report was last modified 9 years and 69 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.