Header menu logo Fabulous.AST

Namespaces

Both namespaces and modules are used for organizing the code in a hierarchical, logical way.

Constructors

Constructors

Description

Namespace(name: string)

Creates a namespace with the specified name.

TopLevelModule(name: string)

Creates a top-level module with the specified name.

AnonymousModule()

Creates an anonymous module.

Properties

Properties

Description

toRecursive()

Makes the namespace or module recursive.

toPrivate()

Makes the namespace or module private.

toInternal()

Makes the namespace or module internal.

toPublic()

Makes the namespace or module public.

Usage

#r "../../src/Fabulous.AST/bin/Release/netstandard2.1/publish/Fantomas.Core.dll"
#r "../../src/Fabulous.AST/bin/Release/netstandard2.1/publish/Fabulous.AST.dll"
#r "../../src/Fabulous.AST/bin/Release/netstandard2.1/publish/Fantomas.Core.dll"
#r "../../src/Fabulous.AST/bin/Release/netstandard2.1/publish/Fantomas.FCS.dll"

open Fabulous.AST
open Fantomas.Core
open type Fabulous.AST.Ast

Oak() {
    Namespace("MyNamespace") { Record("Person") { Field("name", "string") } }
    TopLevelModule("MyModule") { Record("Person1") { Field("name", "string") } }
    AnonymousModule() { Record("Person2") { Field("name", "string") } }
    Namespace("MyNamespace") { NestedModule("MyModule") { Record("Person") { Field("name", "string") } } }
}
|> Gen.mkOak
|> CodeFormatter.FormatOakAsync
|> Async.RunSynchronously
|> printfn "%s"

Will output the following code:

namespace MyNamespace

type Person = { name: string } module MyModule

type Person1 = { name: string } type Person2 = { name: string } namespace MyNamespace

module MyModule = type Person = { name: string }

namespace Fabulous
namespace Fabulous.AST
namespace Fantomas
namespace Fantomas.Core
type Ast = class end
Multiple items
static member Ast.Oak: unit -> CollectionBuilder<SyntaxOak.Oak,'marker>

--------------------
module Oak from Fabulous.AST
Multiple items
static member Ast.Namespace: name: string -> CollectionBuilder<NamespaceNode,SyntaxOak.ModuleDecl>

--------------------
module Namespace from Fabulous.AST
Multiple items
static member Ast.Record: name: string -> CollectionBuilder<SyntaxOak.TypeDefnRecordNode,SyntaxOak.FieldNode>

--------------------
module Record from Fabulous.AST
Multiple items
static member Ast.Field: name: string * filedType: string -> WidgetBuilder<SyntaxOak.FieldNode>
static member Ast.Field: name: string * filedType: WidgetBuilder<SyntaxOak.Type> -> WidgetBuilder<SyntaxOak.FieldNode>
static member Ast.Field: filedType: string -> WidgetBuilder<SyntaxOak.FieldNode>
static member Ast.Field: filedType: WidgetBuilder<SyntaxOak.Type> -> WidgetBuilder<SyntaxOak.FieldNode>

--------------------
module Field from Fabulous.AST
Multiple items
static member Ast.TopLevelModule: name: string -> CollectionBuilder<TopLevelModuleNode,SyntaxOak.ModuleDecl>

--------------------
module TopLevelModule from Fabulous.AST
Multiple items
static member Ast.AnonymousModule: unit -> CollectionBuilder<AnonymousModuleNode,SyntaxOak.ModuleDecl>

--------------------
module AnonymousModule from Fabulous.AST
Multiple items
static member Ast.NestedModule: name: string -> CollectionBuilder<SyntaxOak.NestedModuleNode,SyntaxOak.ModuleDecl>

--------------------
module NestedModule from Fabulous.AST
module Gen from Fabulous.AST
<summary> It takes the root of the widget tree and create the corresponding Fantomas node, and recursively creating all children nodes </summary>
val mkOak: root: WidgetBuilder<'node> -> 'node
type CodeFormatter = static member FormatASTAsync: ast: ParsedInput -> Async<string> + 2 overloads static member FormatDocumentAsync: isSignature: bool * source: string -> Async<FormatResult> + 2 overloads static member FormatOakAsync: oak: Oak -> Async<string> + 1 overload static member FormatSelectionAsync: isSignature: bool * source: string * selection: range -> Async<string * range> + 1 overload static member GetVersion: unit -> string static member IsValidFSharpCodeAsync: isSignature: bool * source: string -> Async<bool> static member MakePosition: line: int * column: int -> pos static member MakeRange: fileName: string * startLine: int * startCol: int * endLine: int * endCol: int -> range static member ParseAsync: isSignature: bool * source: string -> Async<(ParsedInput * string list) array> static member ParseOakAsync: isSignature: bool * source: string -> Async<(Oak * string list) array> ...
static member CodeFormatter.FormatOakAsync: oak: SyntaxOak.Oak -> Async<string>
static member CodeFormatter.FormatOakAsync: oak: SyntaxOak.Oak * config: FormatConfig -> Async<string>
Multiple items
module Async from Fantomas.Core

--------------------
type Async = static member AsBeginEnd: computation: ('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit) static member AwaitEvent: event: IEvent<'Del,'T> * ?cancelAction: (unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate) static member AwaitIAsyncResult: iar: IAsyncResult * ?millisecondsTimeout: int -> Async<bool> static member AwaitTask: task: Task<'T> -> Async<'T> + 1 overload static member AwaitWaitHandle: waitHandle: WaitHandle * ?millisecondsTimeout: int -> Async<bool> static member CancelDefaultToken: unit -> unit static member Catch: computation: Async<'T> -> Async<Choice<'T,exn>> static member Choice: computations: Async<'T option> seq -> Async<'T option> static member FromBeginEnd: beginAction: (AsyncCallback * obj -> IAsyncResult) * endAction: (IAsyncResult -> 'T) * ?cancelAction: (unit -> unit) -> Async<'T> + 3 overloads static member FromContinuations: callback: (('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T> ...

--------------------
type Async<'T>
static member Async.RunSynchronously: computation: Async<'T> * ?timeout: int * ?cancellationToken: System.Threading.CancellationToken -> 'T
val printfn: format: Printf.TextWriterFormat<'T> -> 'T

Type something to start searching.