Skip to content

Commit

Permalink
Update scripts to v5.2 release. (#2735)
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf authored Jan 19, 2023
1 parent 8e7ded9 commit ceed9fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
5 changes: 2 additions & 3 deletions docs/docs/end-users/Configuration.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ formatCode
(19, 20, 21) |]
"""
{ FormatConfig.Default with
MultilineBlockBracketsOnSameColumn = true }
MultilineBracketStyle = Aligned }
(*** include-it ***)

(**
Expand Down Expand Up @@ -784,8 +784,7 @@ type PostalAddress =
Zip: string }
"""
{ FormatConfig.Default with
MultilineBlockBracketsOnSameColumn = true
ExperimentalStroustrupStyle = true }
MultilineBracketStyle = MultilineBracketStyle.ExperimentalStroustrup }
(*** include-it ***)

(**
Expand Down
15 changes: 12 additions & 3 deletions docs/docs/end-users/GeneratingCode.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ let implementationSyntaxTree =
Range.Zero,
DebugPointAtBinding.Yes Range.Zero,
{ EqualsRange = Some Range.Zero
InlineKeyword = None
LeadingKeyword = SynLeadingKeyword.Let Range.Zero }
) ],
Range.Zero
Expand All @@ -79,7 +80,8 @@ let implementationSyntaxTree =
) ],
(false, false),
{ ConditionalDirectives = []
CodeComments = [] }
CodeComments = [] },
Set.empty
)
)

Expand Down Expand Up @@ -170,15 +172,22 @@ let mkCodeFromExpression (e: SynExpr) : string =
) ],
(false, false),
{ ConditionalDirectives = []
CodeComments = [] }
CodeComments = [] },
Set.empty
)
)
|> CodeFormatter.FormatASTAsync
|> Async.RunSynchronously

let numberExpr = SynExpr.Const(SynConst.Int32(7), Range.Zero)
let wrappedNumber = SynExpr.Paren(numberExpr, Range.Zero, None, Range.Zero)
mkCodeFromExpression wrappedNumber

try
mkCodeFromExpression wrappedNumber
with _ex ->
// Fantomas.Core will make assumptions about certain constructs.
// Just because you can instantiate the AST, does not mean it will be lead to valid code.
"Code could not be transformed internally"
(*** include-it ***)

(**
Expand Down

0 comments on commit ceed9fc

Please sign in to comment.