summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorDaniel Ebert2023-12-03 18:47:01 +0000
committerBlaž Hrastnik2023-12-15 06:59:54 +0000
commit33d85606cf36da074d91db498d12233ab4978509 (patch)
tree495c575cf9790b43b38c3aa63dae278978bbd6b4 /runtime
parent723a132bdfdacaabc888e48b1c378cd76e7ba84d (diff)
Add alignment indent queries for binary & ternary expressions in C.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/c/indents.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/queries/c/indents.scm b/runtime/queries/c/indents.scm
index 0e97ed2b..877b6670 100644
--- a/runtime/queries/c/indents.scm
+++ b/runtime/queries/c/indents.scm
@@ -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