diff options
| author | Dmitry Gutov | 2013-12-08 18:08:45 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2013-12-08 18:08:45 +0200 |
| commit | 47e59c666a7599863725a04b6ed3f74ba01824b3 (patch) | |
| tree | 2843998028019d76fa883bddc8055dc3e0cb792d /test | |
| parent | 36291308801eefe5c04280c32d4b247bf7aa984e (diff) | |
| download | emacs-47e59c666a7599863725a04b6ed3f74ba01824b3.tar.gz emacs-47e59c666a7599863725a04b6ed3f74ba01824b3.zip | |
Port indentation code from js2-mode to js-mode
* lisp/progmodes/js.el (js-auto-indent-flag): Remove, was unused.
(js-switch-indent-offset): New option.
(js--proper-indentation): Use it. And handle the case when
"default" is actually a key in an object literal.
(js--same-line): New function.
(js--multi-line-declaration-indentation): Use it.
(js--indent-in-array-comp, js--array-comp-indentation): New
functions.
(js--proper-indentation): Use them, to handle array comprehension
continuations.
Diffstat (limited to 'test')
| -rw-r--r-- | test/indent/js.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/indent/js.js b/test/indent/js.js new file mode 100644 index 00000000000..d4167da3e96 --- /dev/null +++ b/test/indent/js.js | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | var a = 1; | ||
| 2 | b = 2; | ||
| 3 | |||
| 4 | let c = 1, | ||
| 5 | d = 2; | ||
| 6 | |||
| 7 | var e = 100500, | ||
| 8 | + 1; | ||
| 9 | |||
| 10 | var f = bar('/protocols/') | ||
| 11 | baz(); | ||
| 12 | |||
| 13 | var h = 100500 | ||
| 14 | 1; | ||
| 15 | |||
| 16 | const i = 1, | ||
| 17 | j = 2; | ||
| 18 | |||
| 19 | var k = 1, | ||
| 20 | l = [ | ||
| 21 | 1, 2, | ||
| 22 | 3, 4 | ||
| 23 | ], | ||
| 24 | m = 5; | ||
| 25 | |||
| 26 | var n = function() { | ||
| 27 | return 7; | ||
| 28 | }, | ||
| 29 | o = 8; | ||
| 30 | |||
| 31 | foo(bar, function() { | ||
| 32 | return 2; | ||
| 33 | }); | ||
| 34 | |||
| 35 | switch (b) { | ||
| 36 | case "a": | ||
| 37 | 2; | ||
| 38 | default: | ||
| 39 | 3; | ||
| 40 | } | ||
| 41 | |||
| 42 | var ; | ||
| 43 | |||
| 44 | var evens = [e for each (e in range(0, 21)) | ||
| 45 | if (ed % 2 == 0)]; | ||