1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-09 15:50:21 +00:00
emacs/test/manual/indent/js-chain.js
Tom Tromey 502390822f Add chained indentation to js-mode
Bug#20896
* lisp/progmodes/js.el (js-chain-indent): New variable.
(js--skip-term-backward, js--skip-terms-backward)
(js--chained-expression-p): New functions.
(js--proper-indentation): Call js--chained-expression-p.
* test/manual/indent/js-chain.js: New file.
* test/manual/indent/js.js: Add (non-)chained indentation test.
2017-01-13 12:38:36 -07:00

30 lines
551 B
JavaScript

// Normal chaining.
let x = svg.mumble()
.zzz;
// Chaining with an intervening line comment.
let x = svg.mumble() // line comment
.zzz;
// Chaining with multiple dots.
let x = svg.selectAll().something()
.zzz;
// Nested chaining.
let x = svg.selectAll(d3.svg.something()
.zzz);
// Nothing to chain to.
let x = svg()
.zzz;
// Nothing to chain to.
let x = svg().mumble.x() + 73
.zzz;
// Local Variables:
// indent-tabs-mode: nil
// js-chain-indent: t
// js-indent-level: 2
// End: