Header menu logo TestPrune

AstAnalyzer Module

Types

Type Description

AnalysisDiagnostics

The combined output of analyzing a source file: symbols, dependencies, and test methods. Diagnostic counters for observability into the analysis pipeline. These track how many symbols/edges were dropped during analysis to help diagnose missing dependency edges.

AnalysisResult

Dependency

A directed dependency from one symbol to another, with its kind.

DependencyKind

The kind of edge in a dependency graph (calls, uses type, pattern match, etc.).

RouteHandlerEntry

Maps an HTTP route (method + URL pattern) to its handler's source file.

SymbolInfo

A symbol's fully-qualified name, kind, source file, and line span.

SymbolKind

Discriminated union for kinds of F# symbols (function, type, DU case, etc.).

TestMethodInfo

Describes a test method's fully-qualified name, project, class, and method name.

Functions and values

Function or value Description

analyzeSource checker sourceFileName source projectOptions

Full Usage: analyzeSource checker sourceFileName source projectOptions

Parameters:
Returns: Async<Result<AnalysisResult, string>>

Parse and analyze a single F# source string using project options.

checker : FSharpChecker
sourceFileName : string
source : string
projectOptions : FSharpProjectOptions
Returns: Async<Result<AnalysisResult, string>>

analyzeSourceWithSnapshot checker sourceFileName source projectSnapshot

Full Usage: analyzeSourceWithSnapshot checker sourceFileName source projectSnapshot

Parameters:
Returns: Async<Result<AnalysisResult, string>>

Parse and analyze a single F# source file using a project snapshot. FCS internally caches results for files with unchanged version strings.

checker : FSharpChecker
sourceFileName : string
source : string
projectSnapshot : FSharpProjectSnapshot
Returns: Async<Result<AnalysisResult, string>>

collectModuleBindingRanges tree

Full Usage: collectModuleBindingRanges tree

Parameters:
Returns: (string * range) list

Walk the parsed AST to collect module-level binding names and their full ranges. Each binding's range covers from the `let` keyword to the end of its body, which correctly encompasses nested local bindings.

tree : ParsedInput
Returns: (string * range) list

collectTypeDefnRanges tree

Full Usage: collectTypeDefnRanges tree

Parameters:
Returns: (string * range) list

Walk the parsed AST to collect type definition names and their full ranges. Each type's range covers from the `type` keyword through all cases/fields/members.

tree : ParsedInput
Returns: (string * range) list

collectTypeMemberRanges tree

Full Usage: collectTypeMemberRanges tree

Parameters:
Returns: (string * range) list

Walk the parsed AST to collect type member binding names and their full ranges. This enables `findEnclosing` to attribute symbol uses inside type members (e.g. class-based xUnit test methods) to the correct enclosing member.

tree : ParsedInput
Returns: (string * range) list

createProjectSnapshot projectOptions

Full Usage: createProjectSnapshot projectOptions

Parameters:
Returns: Async<FSharpProjectSnapshot>

Create a project snapshot from project options, using file modification times as version keys. FCS uses version strings to skip re-checking files that haven't changed.

projectOptions : FSharpProjectOptions
Returns: Async<FSharpProjectSnapshot>

getScriptOptions checker sourceFileName source

Full Usage: getScriptOptions checker sourceFileName source

Parameters:
    checker : FSharpChecker
    sourceFileName : string
    source : string

Returns: Async<FSharpProjectOptions>

Convenience: create project options from a script source string. Detects 'open' statements and includes related script files in the SourceFiles array.

checker : FSharpChecker
sourceFileName : string
source : string
Returns: Async<FSharpProjectOptions>

normalizeSymbolPaths repoRoot symbols

Full Usage: normalizeSymbolPaths repoRoot symbols

Parameters:
Returns: SymbolInfo list

Normalize symbol source paths from absolute to repo-relative.

repoRoot : string
symbols : SymbolInfo list
Returns: SymbolInfo list

Type something to start searching.