Don't misindent computed property generator methods
* lisp/progmodes/js.el (js--looking-at-operator-p): Don't misindent computed property generator methods (https://github.com/mooz/js2-mode/issues/317).
This commit is contained in:
parent
792311228d
commit
dc9d837d02
2 changed files with 12 additions and 6 deletions
|
@ -1758,12 +1758,13 @@ This performs fontification according to `js--class-styles'."
|
||||||
(eq (char-after) ??))))
|
(eq (char-after) ??))))
|
||||||
(not (and
|
(not (and
|
||||||
(eq (char-after) ?*)
|
(eq (char-after) ?*)
|
||||||
(looking-at (concat "\\* *" js--name-re " *("))
|
;; Generator method (possibly using computed property).
|
||||||
|
(looking-at (concat "\\* *\\(?:\\[\\|" js--name-re " *(\\)"))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (1- (match-end 0)))
|
(js--backward-syntactic-ws)
|
||||||
(let (forward-sexp-function) (forward-sexp))
|
;; We might misindent some expressions that would
|
||||||
(js--forward-syntactic-ws)
|
;; return NaN anyway. Shouldn't be a problem.
|
||||||
(eq (char-after) ?{)))))))
|
(memq (char-before) '(?, ?} ?{))))))))
|
||||||
|
|
||||||
(defun js--continued-expression-p ()
|
(defun js--continued-expression-p ()
|
||||||
"Return non-nil if the current line continues an expression."
|
"Return non-nil if the current line continues an expression."
|
||||||
|
|
|
@ -72,7 +72,12 @@ baz(`http://foo.bar/${tee}`)
|
||||||
class A {
|
class A {
|
||||||
* x() {
|
* x() {
|
||||||
return 1
|
return 1
|
||||||
* 2;
|
* a(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
*[Symbol.iterator]() {
|
||||||
|
yield "Foo";
|
||||||
|
yield "Bar";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue