Function: c-ts-mode--parenthesized-expression-indent-rule

c-ts-mode--parenthesized-expression-indent-rule is a byte-compiled function defined in c-ts-mode.el.gz.

Signature

(c-ts-mode--parenthesized-expression-indent-rule NODE PARENT &rest _)

Documentation

Indent rule that indents parenthesized expression.

Aligns the next line to the first sibling

return (a && b
          && c)

return ( a && b
          && c
          )

Same for if/while statements

if (a && b
      && c)

NODE, PARENT are the same as other indent rules.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-mode.el.gz
(defun c-ts-mode--parenthesized-expression-indent-rule (_node parent &rest _)
  "Indent rule that indents parenthesized expression.

Aligns the next line to the first sibling

return (a && b
          && c)

return (  a && b
          && c
          )

Same for if/while statements

if (a && b
      && c)

NODE, PARENT are the same as other indent rules."
  (when (treesit-node-match-p
         parent (rx (or "binary" "conditional") "_expression"))
    (while (and parent
                (not (treesit-node-match-p
                      parent "parenthesized_expression")))
      (setq parent (treesit-node-parent parent)))
    (when parent
      (cons (treesit-node-start
             (treesit-node-child parent 0 'named))
            0))))