File tree 3 files changed +29
-2
lines changed
3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -2925,7 +2925,7 @@ let genBinding (b: BindingNode) (ctx: Context) : Context =
2925
2925
+> afterLetKeyword
2926
2926
+> sepSpace
2927
2927
+> genFunctionName
2928
- +> indent
2928
+ +> experimentalDoubleIndent
2929
2929
+> sepNln
2930
2930
+> genParameters
2931
2931
+> onlyIf nlnOnSeparateLine sepNln
@@ -2934,7 +2934,7 @@ let genBinding (b: BindingNode) (ctx: Context) : Context =
2934
2934
sepNln +> genSingleTextNode b.Equals
2935
2935
else
2936
2936
sepSpace +> genSingleTextNode b.Equals)
2937
- +> unindent
2937
+ +> experimentalDoubleUnindent
2938
2938
+> onlyIf hasTriviaAfterLeadingKeyword unindent)
2939
2939
ctx
2940
2940
Original file line number Diff line number Diff line change @@ -391,6 +391,24 @@ let indent (ctx: Context) =
391
391
let unindent ( ctx : Context ) =
392
392
writerEvent ( UnIndentBy ctx.Config.IndentSize) ctx
393
393
394
+ let experimentalDoubleIndent ( ctx : Context ) =
395
+ let indentSize =
396
+ if not ctx.Config.ExperimentalDoubleIndentParameters then
397
+ ctx.Config.IndentSize
398
+ else
399
+ 2 * ctx.Config.IndentSize
400
+
401
+ writerEvent ( IndentBy indentSize) ctx
402
+
403
+ let experimentalDoubleUnindent ( ctx : Context ) =
404
+ let indentSize =
405
+ if not ctx.Config.ExperimentalDoubleIndentParameters then
406
+ ctx.Config.IndentSize
407
+ else
408
+ 2 * ctx.Config.IndentSize
409
+
410
+ writerEvent ( UnIndentBy indentSize) ctx
411
+
394
412
/// Apply function f at an absolute indent level (use with care)
395
413
let atIndentLevel alsoSetIndent level ( f : Context -> Context ) ( ctx : Context ) =
396
414
if level < 0 then
Original file line number Diff line number Diff line change @@ -78,6 +78,15 @@ val lastWriteEventIsNewline: ctx: Context -> bool
78
78
val indent : ctx : Context -> Context
79
79
/// Unindent one more level based on configuration
80
80
val unindent : ctx : Context -> Context
81
+
82
+ /// Add double indent if ExperimentalDoubleIndentParameters is active
83
+ /// Otherwise , add single indent
84
+ val experimentalDoubleIndent : ctx : Context -> Context
85
+
86
+ /// Add double unindent if ExperimentalDoubleIndentParameters is active
87
+ /// Otherwise , add single unindent
88
+ val experimentalDoubleUnindent : ctx : Context -> Context
89
+
81
90
// /// Apply function f at an absolute indent level ( use with care )
82
91
val atIndentLevel : alsoSetIndent : bool -> level : int -> f : ( Context -> Context ) -> ctx : Context -> Context
83
92
// /// Set minimal indentation ( `atColumn` ) at current column position - next newline will be indented on `max indent atColumn`
You can’t perform that action at this time.
0 commit comments