[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23492: 24.5; JS spread operator breaks indentatiton
From: |
Dmitry Gutov |
Subject: |
bug#23492: 24.5; JS spread operator breaks indentatiton |
Date: |
Tue, 10 May 2016 00:34:54 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1 |
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 +