js-mode: Don't indent inside a multiline string literal
* lisp/progmodes/js.el (js-indent-line): Do nothing when bol is inside a string (https://github.com/mooz/js2-mode/issues/227).
This commit is contained in:
parent
839decd9ec
commit
f2fbd4b712
3 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
2015-04-03 Dmitry Gutov <dgutov@yandex.ru>
|
||||
|
||||
* progmodes/js.el (js-indent-line): Do nothing when bol is inside
|
||||
a string (https://github.com/mooz/js2-mode/issues/227).
|
||||
|
||||
2015-04-02 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* abbrev.el (define-abbrev-table): Treat a non-string "docstring" as
|
||||
|
|
|
@ -2002,7 +2002,8 @@ indentation is aligned to that column."
|
|||
(let* ((parse-status
|
||||
(save-excursion (syntax-ppss (point-at-bol))))
|
||||
(offset (- (point) (save-excursion (back-to-indentation) (point)))))
|
||||
(indent-line-to (js--proper-indentation parse-status))
|
||||
(unless (nth 3 parse-status)
|
||||
(indent-line-to (js--proper-indentation parse-status)))
|
||||
(when (> offset 0) (forward-char offset))))
|
||||
|
||||
;;; Filling
|
||||
|
|
|
@ -64,6 +64,11 @@ b +=
|
|||
baz(`http://foo.bar/${tee}`)
|
||||
.qux();
|
||||
|
||||
`multiline string
|
||||
contents
|
||||
are kept
|
||||
unchanged!`
|
||||
|
||||
// Local Variables:
|
||||
// indent-tabs-mode: nil
|
||||
// js-indent-level: 2
|
||||
|
|
Loading…
Add table
Reference in a new issue