Header menu logo fantomas

CodeFormatter Type

Static members

Static member Description

CodeFormatter.FormatASTAsync(ast, source)

Full Usage: CodeFormatter.FormatASTAsync(ast, source)

Parameters:
Returns: Async<string>

Format an abstract syntax tree with the original source for trivia processing

ast : ParsedInput
source : string
Returns: Async<string>

CodeFormatter.FormatASTAsync(ast, config)

Full Usage: CodeFormatter.FormatASTAsync(ast, config)

Parameters:
Returns: Async<string>

Format an abstract syntax tree using a given config

ast : ParsedInput
config : FormatConfig
Returns: Async<string>

CodeFormatter.FormatASTAsync(ast)

Full Usage: CodeFormatter.FormatASTAsync(ast)

Parameters:
Returns: Async<string>

Format an abstract syntax tree

ast : ParsedInput
Returns: Async<string>

CodeFormatter.FormatDocumentAsync(isSignature, source, config, cursor)

Full Usage: CodeFormatter.FormatDocumentAsync(isSignature, source, config, cursor)

Parameters:
    isSignature : bool - Determines whether the F# parser will process the source as signature file.
    source : string - F# source code
    config : FormatConfig - Fantomas configuration
    cursor : pos - The location of a cursor, zero-based.

Returns: Async<FormatResult>

Format a source string using an optional config.

isSignature : bool

Determines whether the F# parser will process the source as signature file.

source : string

F# source code

config : FormatConfig

Fantomas configuration

cursor : pos

The location of a cursor, zero-based.

Returns: Async<FormatResult>

CodeFormatter.FormatDocumentAsync(isSignature, source, config)

Full Usage: CodeFormatter.FormatDocumentAsync(isSignature, source, config)

Parameters:
    isSignature : bool - Determines whether the F# parser will process the source as signature file.
    source : string - F# source code
    config : FormatConfig - Fantomas configuration

Returns: Async<FormatResult>

Format a source string using an optional config.

isSignature : bool

Determines whether the F# parser will process the source as signature file.

source : string

F# source code

config : FormatConfig

Fantomas configuration

Returns: Async<FormatResult>

CodeFormatter.FormatDocumentAsync(isSignature, source)

Full Usage: CodeFormatter.FormatDocumentAsync(isSignature, source)

Parameters:
    isSignature : bool - Determines whether the F# parser will process the source as signature file.
    source : string - F# source code

Returns: Async<FormatResult>

Format a source string using an optional config.

isSignature : bool

Determines whether the F# parser will process the source as signature file.

source : string

F# source code

Returns: Async<FormatResult>

CodeFormatter.FormatOakAsync(oak, config)

Full Usage: CodeFormatter.FormatOakAsync(oak, config)

Parameters:
Returns: Async<string>

Format SyntaxOak to string using given config

oak : Oak
config : FormatConfig
Returns: Async<string>

CodeFormatter.FormatOakAsync(oak)

Full Usage: CodeFormatter.FormatOakAsync(oak)

Parameters:
Returns: Async<string>

Format SyntaxOak to string

oak : Oak
Returns: Async<string>

CodeFormatter.FormatSelectionAsync(isSignature, source, selection, config)

Full Usage: CodeFormatter.FormatSelectionAsync(isSignature, source, selection, config)

Parameters:
Returns: Async<string * range>

Format a part of source string using given config, and return the (formatted) selected part only. Beware that the range argument is inclusive. The closest expression inside the selection will be formatted if possible.

isSignature : bool
source : string
selection : range
config : FormatConfig
Returns: Async<string * range>

CodeFormatter.FormatSelectionAsync(isSignature, source, selection)

Full Usage: CodeFormatter.FormatSelectionAsync(isSignature, source, selection)

Parameters:
    isSignature : bool
    source : string
    selection : range

Returns: Async<string * range>

Format a part of a source string and return the (formatted) selected part only. Beware that the range argument is inclusive. The closest expression inside the selection will be formatted if possible.

isSignature : bool
source : string
selection : range
Returns: Async<string * range>

CodeFormatter.GetVersion()

Full Usage: CodeFormatter.GetVersion()

Returns: string

Returns the version of Fantomas found in the AssemblyInfo

Returns: string

CodeFormatter.IsValidFSharpCodeAsync(isSignature, source)

Full Usage: CodeFormatter.IsValidFSharpCodeAsync(isSignature, source)

Parameters:
    isSignature : bool
    source : string

Returns: Async<bool>

Check whether an input string is invalid in F# by attempting to parse the code.

isSignature : bool
source : string
Returns: Async<bool>

CodeFormatter.MakePosition(line, column)

Full Usage: CodeFormatter.MakePosition(line, column)

Parameters:
    line : int
    column : int

Returns: pos

Make a pos from line and column

line : int
column : int
Returns: pos

CodeFormatter.MakeRange(fileName, startLine, startCol, endLine, endCol)

Full Usage: CodeFormatter.MakeRange(fileName, startLine, startCol, endLine, endCol)

Parameters:
    fileName : string
    startLine : int
    startCol : int
    endLine : int
    endCol : int

Returns: range

Make a range from (startLine, startCol) to (endLine, endCol) to select some text

fileName : string
startLine : int
startCol : int
endLine : int
endCol : int
Returns: range

CodeFormatter.ParseAsync(isSignature, source)

Full Usage: CodeFormatter.ParseAsync(isSignature, source)

Parameters:
    isSignature : bool
    source : string

Returns: Async<(ParsedInput * string list) array>

Parse a source string using given config

isSignature : bool
source : string
Returns: Async<(ParsedInput * string list) array>

CodeFormatter.ParseOakAsync(isSignature, source)

Full Usage: CodeFormatter.ParseOakAsync(isSignature, source)

Parameters:
    isSignature : bool
    source : string

Returns: Async<(Oak * string list) array>

Parse a source string to SyntaxOak

isSignature : bool
source : string
Returns: Async<(Oak * string list) array>

CodeFormatter.TransformAST(ast, source)

Full Usage: CodeFormatter.TransformAST(ast, source)

Parameters:
Returns: Oak

Transform a ParsedInput to an Oak

ast : ParsedInput
source : string
Returns: Oak

CodeFormatter.TransformAST(ast)

Full Usage: CodeFormatter.TransformAST(ast)

Parameters:
Returns: Oak

Transform a ParsedInput to an Oak

ast : ParsedInput
Returns: Oak

Type something to start searching.