ruby-ts-mode: Indentation fixes
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--align-keywords): Fix for 'def' (which was misread as 'method' in the check). (ruby-ts--indent-rules): Indent the curly block closer the same way as the 'do ... end' closer.
This commit is contained in:
parent
9b24417dda
commit
94e330243e
1 changed files with 6 additions and 3 deletions
|
@ -355,8 +355,11 @@ Otherwise return start of PRED."
|
||||||
(lambda (node parent bol &rest rest)
|
(lambda (node parent bol &rest rest)
|
||||||
(let* ((pred-node (funcall pred node parent bol rest))
|
(let* ((pred-node (funcall pred node parent bol rest))
|
||||||
(temp (treesit-node-start pred-node))
|
(temp (treesit-node-start pred-node))
|
||||||
(keyword (treesit-node-type pred-node))
|
(type (treesit-node-type pred-node))
|
||||||
(bol (ruby-smie--indent-to-stmt-p keyword)))
|
(bol (ruby-smie--indent-to-stmt-p
|
||||||
|
(if (equal type "method")
|
||||||
|
"def"
|
||||||
|
type))))
|
||||||
(when temp
|
(when temp
|
||||||
(if bol
|
(if bol
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
@ -736,7 +739,7 @@ i.e. expr of def foo(args) = expr is returned."
|
||||||
((match "end" "do_block") parent-bol 0)
|
((match "end" "do_block") parent-bol 0)
|
||||||
((n-p-gp "block_body" "block" nil) parent-bol ruby-indent-level)
|
((n-p-gp "block_body" "block" nil) parent-bol ruby-indent-level)
|
||||||
((n-p-gp nil "block_body" "block") (ruby-ts--bol ruby-ts--grand-parent-node) ruby-indent-level)
|
((n-p-gp nil "block_body" "block") (ruby-ts--bol ruby-ts--grand-parent-node) ruby-indent-level)
|
||||||
((match "}" "block") (ruby-ts--bol ruby-ts--grand-parent-node) 0)
|
((match "}" "block") parent-bol 0)
|
||||||
|
|
||||||
;; Chained strings
|
;; Chained strings
|
||||||
((match "string" "chained_string") first-sibling 0)
|
((match "string" "chained_string") first-sibling 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue