Skip to content

Commit

Permalink
Add alignment indent queries for binary & ternary expressions in C.
Browse files Browse the repository at this point in the history
  • Loading branch information
Triton171 authored and mtoohey31 committed Jun 2, 2024
1 parent f7e68cc commit 9abc75c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions runtime/queries/c/indents.scm
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@
(argument_list
. (_) @anchor
(#set! "scope" "tail")) @align
; These are a bit opinionated since some people just indent binary/ternary expressions spanning multiple lines.
; Since they are only triggered when a newline is inserted into an already complete binary/ternary expression,
; this should happen rarely, so it is not a big deal either way.
; Additionally, adding these queries has the advantage of preventing such continuation lines from being used
; as the baseline when the `hybrid` indent heuristic is used (which is desirable since their indentation is so inconsistent).
(binary_expression
(#set! "scope" "tail")) @anchor @align
(conditional_expression
"?" @anchor
(#set! "scope" "tail")) @align

0 comments on commit 9abc75c

Please sign in to comment.