@@ -9,19 +9,31 @@ type CodeFormatter =
99 static member ParseAsync ( isSignature , source ) : Async <( ParsedInput * string list ) array > =
1010 CodeFormatterImpl.getSourceText source |> CodeFormatterImpl.parse isSignature
1111
12- static member FormatASTAsync ( ast : ParsedInput , ? source , ? config ) : Async < FormatResult > =
13- let sourceText = Option.map CodeFormatterImpl.getSourceText source
14- let config = Option.defaultValue FormatConfig.Default config
12+ static member FormatASTAsync ( ast : ParsedInput ) : Async < FormatResult > =
13+ CodeFormatterImpl.formatAST ast None FormatConfig.Default None |> async.Return
14+
15+ static member FormatASTAsync ( ast : ParsedInput , config ) : Async < FormatResult > =
16+ CodeFormatterImpl.formatAST ast None config None |> async.Return
17+
18+ static member FormatASTAsync ( ast : ParsedInput , source ) : Async < FormatResult > =
19+ let sourceText = Some( CodeFormatterImpl.getSourceText source)
20+
21+ CodeFormatterImpl.formatAST ast sourceText FormatConfig.Default None
22+ |> async.Return
1523
24+ static member FormatASTAsync ( ast : ParsedInput , source , config ) : Async < FormatResult > =
25+ let sourceText = Some( CodeFormatterImpl.getSourceText source)
1626 CodeFormatterImpl.formatAST ast sourceText config None |> async.Return
1727
1828 static member FormatDocumentAsync ( isSignature , source , ? config , ? cursor : Position ) =
1929 let config = Option.defaultValue FormatConfig.Default config
2030 CodeFormatterImpl.formatDocument config isSignature ( CodeFormatterImpl.getSourceText source) cursor
2131
22- static member FormatSelectionAsync ( isSignature , source , selection , config ) =
23- let config = Option.defaultValue FormatConfig.Default config
32+ static member FormatSelectionAsync ( isSignature , source , selection ) =
33+ CodeFormatterImpl.getSourceText source
34+ |> Selection.formatSelection FormatConfig.Default isSignature selection
2435
36+ static member FormatSelectionAsync ( isSignature , source , selection , config ) =
2537 CodeFormatterImpl.getSourceText source
2638 |> Selection.formatSelection config isSignature selection
2739
@@ -35,7 +47,6 @@ type CodeFormatter =
3547
3648 static member MakePosition ( line , column ) = Position.mkPos line column
3749
38- [<Experimental " Only for local development" >]
3950 static member ParseOakAsync ( isSignature : bool , source : string ) : Async <( Oak * string list ) array > =
4051 async {
4152 let sourceText = CodeFormatterImpl.getSourceText source
0 commit comments