Don't misindent arguments of a method call inside continuation
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Use smie-indent-virtual instead of smie-rule-parent (bug#23015). Simplify the traversal loop.
This commit is contained in:
parent
e6776f8362
commit
040362001d
2 changed files with 18 additions and 13 deletions
|
@ -629,19 +629,13 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
|
||||||
;; because when `.' is inside the line, the
|
;; because when `.' is inside the line, the
|
||||||
;; additional indentation from it looks out of place.
|
;; additional indentation from it looks out of place.
|
||||||
((smie-rule-parent-p ".")
|
((smie-rule-parent-p ".")
|
||||||
(let (smie--parent)
|
;; Traverse up the call chain until the parent is not `.',
|
||||||
(save-excursion
|
;; or `.' at indentation, or at eol.
|
||||||
;; Traverse up the parents until the parent is "." at
|
(while (and (not (ruby-smie--bosp))
|
||||||
;; indentation, or any other token.
|
(equal (nth 2 (smie-backward-sexp ".")) ".")
|
||||||
(while (and (let ((parent (smie-indent--parent)))
|
(not (ruby-smie--bosp)))
|
||||||
(goto-char (cadr parent))
|
(forward-char -1))
|
||||||
(save-excursion
|
(smie-indent-virtual))
|
||||||
(unless (integerp (car parent)) (forward-char -1))
|
|
||||||
(not (ruby-smie--bosp))))
|
|
||||||
(progn
|
|
||||||
(setq smie--parent nil)
|
|
||||||
(smie-rule-parent-p "."))))
|
|
||||||
(smie-rule-parent))))
|
|
||||||
(t (smie-rule-parent))))))
|
(t (smie-rule-parent))))))
|
||||||
(`(:after . ,(or `"(" "[" "{"))
|
(`(:after . ,(or `"(" "[" "{"))
|
||||||
;; FIXME: Shouldn't this be the default behavior of
|
;; FIXME: Shouldn't this be the default behavior of
|
||||||
|
|
|
@ -405,6 +405,17 @@ def qux
|
||||||
a.records().map(&:b).zip(
|
a.records().map(&:b).zip(
|
||||||
foo)
|
foo)
|
||||||
|
|
||||||
|
foo1 =
|
||||||
|
subject.update(
|
||||||
|
1
|
||||||
|
)
|
||||||
|
|
||||||
|
foo2 =
|
||||||
|
subject.
|
||||||
|
update(
|
||||||
|
2
|
||||||
|
)
|
||||||
|
|
||||||
# FIXME: This is not consistent with the example below it, but this
|
# FIXME: This is not consistent with the example below it, but this
|
||||||
# offset only happens if the colon is at eol, which wouldn't be often.
|
# offset only happens if the colon is at eol, which wouldn't be often.
|
||||||
# Tokenizing `bar:' as `:bar =>' would be better, but it's hard to
|
# Tokenizing `bar:' as `:bar =>' would be better, but it's hard to
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue