FSharpChecker Type
Used to parse and check F# source code.
Instance members
Instance member |
Description
|
|
Notify the host that the logical type checking context for a file has now been updated internally and that the file has become eligible to be re-typechecked for errors. The event will be raised on a background thread.
|
Full Usage:
this.CheckFileInProject
Parameters:
FSharpParseFileResults
-
The results of ParseFile for this file.
fileName : string
-
The name of the file in the project whose source is being checked.
fileVersion : int
-
An integer that can be used to indicate the version of the file. This will be returned by TryGetRecentCheckResultsForFile when looking up the file.
sourceText : ISourceText
-
The full source for the file.
options : FSharpProjectOptions
-
The options for the project or script.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<FSharpCheckFileAnswer>
|
Check a source code file, returning a handle to the results Note: all files except the one being checked are read from the FileSystem API Return FSharpCheckFileAnswer.Aborted if a parse tree was not available.
|
|
|
Full Usage:
this.ClearCache
Parameters:
FSharpProjectOptions seq
-
The given project options.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
|
Clear the internal cache of the given projects.
|
Full Usage:
this.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients
|
Flush all caches and garbage collect |
Full Usage:
this.Compile
Parameters:
string[]
-
The command line arguments for the project build.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<FSharpDiagnostic[] * exn option>
|
Compile using the given flags. Source files names are resolved via the FileSystem API. The output file must be given by a -o flag. The first argument is ignored and can just be "fsc.exe". The method returns the collected diagnostics, and (possibly) a terminating exception.
|
|
Raised after a check of a file in the background analysis. The event will be raised on a background thread.
|
|
Raised after a parse of a file in the background analysis. The event will be raised on a background thread.
|
Full Usage:
this.FindBackgroundReferencesInFile
Parameters:
string
projectSnapshot : FSharpProjectSnapshot
symbol : FSharpSymbol
?userOpName : string
Returns: Async<range seq>
|
|
Full Usage:
this.FindBackgroundReferencesInFile
Parameters:
string
-
The file name for the file.
options : FSharpProjectOptions
-
The options for the project or script, used to determine active --define conditionals and other options relevant to parsing.
symbol : FSharpSymbol
-
The symbol to find all uses in the file.
?canInvalidateProject : bool
-
Default: true. If true, this call can invalidate the current state of project if the options have changed. If false, the current state of the project will be used.
?fastCheck : bool
-
Default: false. Experimental feature that makes the operation faster. Requires FSharpChecker to be created with captureIdentifiersWhenParsing = true.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<range seq>
|
Optimized find references for a given symbol in a file of project. All files are read from the FileSystem API, including the file being checked. Can cause a second type-check when `enablePartialTypeChecking` is true on the FSharpChecker.
|
Full Usage:
this.GetBackgroundCheckResultsForFileInProject
Parameters:
string
-
The file name for the file.
options : FSharpProjectOptions
-
The options for the project or script, used to determine active --define conditionals and other options relevant to parsing.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<FSharpParseFileResults * FSharpCheckFileResults>
|
Like CheckFileInProject, but uses the existing results from the background builder. All files are read from the FileSystem API, including the file being checked. Can cause a second type-check when `enablePartialTypeChecking` is true on the FSharpChecker.
|
Full Usage:
this.GetBackgroundParseResultsForFileInProject
Parameters:
string
-
The name for the file.
options : FSharpProjectOptions
-
The options for the project or script, used to determine active --define conditionals and other options relevant to parsing.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<FSharpParseFileResults>
|
Like ParseFile, but uses results from the background builder. All files are read from the FileSystem API, including the file being checked.
|
Full Usage:
this.GetBackgroundSemanticClassificationForFile
Parameters:
string
-
The file name for the file.
snapshot : FSharpProjectSnapshot
-
The project snapshot for which we want to get the semantic classification.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<SemanticClassificationView option>
|
Get semantic classification for a file.
|
Full Usage:
this.GetBackgroundSemanticClassificationForFile
Parameters:
string
-
The file name for the file.
options : FSharpProjectOptions
-
The options for the project or script, used to determine active --define conditionals and other options relevant to parsing.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<SemanticClassificationView option>
|
Get semantic classification for a file. All files are read from the FileSystem API, including the file being checked. Can cause a second type-check when `enablePartialTypeChecking` is true on the FSharpChecker.
|
Full Usage:
this.GetParsingOptionsFromCommandLineArgs
Parameters:
string list
-
The command line arguments for the project build.
?isInteractive : bool
-
Indicates that parsing should assume the INTERACTIVE define and related settings
?isEditing : bool
-
Indicates that compilation should assume the EDITING define and related settings
Returns: FSharpParsingOptions * FSharpDiagnostic list
|
Get the FSharpParsingOptions implied by a set of command line arguments.
|
Full Usage:
this.GetParsingOptionsFromCommandLineArgs
Parameters:
string list
-
Initial source files list. Additional files may be added during argv evaluation.
argv : string list
-
The command line arguments for the project build.
?isInteractive : bool
-
Indicates that parsing should assume the INTERACTIVE define and related settings
?isEditing : bool
-
Indicates that compilation should assume the EDITING define and related settings
Returns: FSharpParsingOptions * FSharpDiagnostic list
|
Get the FSharpParsingOptions implied by a set of command line arguments and list of source files.
|
Full Usage:
this.GetParsingOptionsFromProjectOptions
Parameters:
FSharpProjectOptions
-
The overall options.
Returns: FSharpParsingOptions * FSharpDiagnostic list
|
Get the FSharpParsingOptions implied by a FSharpProjectOptions.
|
Full Usage:
this.GetProjectOptionsFromCommandLineArgs
Parameters:
string
-
Used to differentiate between projects and for the base directory of the project.
argv : string[]
-
The command line arguments for the project build.
?loadedTimeStamp : DateTime
-
Indicates when the script was loaded into the editing environment,
Indicates that compilation should assume the EDITING define and related settingsIndicates that compilation should assume the INTERACTIVE define and related settings
so that an 'unload' and 'reload' action will cause the script to be considered as a new project,
so that references are re-resolved.
?isInteractive : bool
?isEditing : bool
Returns: FSharpProjectOptions
|
Get the FSharpProjectOptions implied by a set of command line arguments.
|
Full Usage:
this.GetProjectOptionsFromScript
Parameters:
string
-
Used to differentiate between scripts, to consider each script a separate project. Also used in formatted error messages.
source : ISourceText
-
The source for the file.
?previewEnabled : bool
-
Is the preview compiler enabled.
?loadedTimeStamp : DateTime
-
Indicates when the script was loaded into the editing environment,
so that an 'unload' and 'reload' action will cause the script to be considered as a new project,
so that references are re-resolved.
?otherFlags : string[]
-
Other flags for compilation.
?useFsiAuxLib : bool
-
Add a default reference to the FSharp.Compiler.Interactive.Settings library.
?useSdkRefs : bool
-
Use the implicit references from the .NET SDK.
?assumeDotNetFramework : bool
-
Set up compilation and analysis for .NET Framework scripts.
?sdkDirOverride : string
-
Override the .NET SDK used for default references.
?optionsStamp : int64
-
An optional unique stamp for the options.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<FSharpProjectOptions * FSharpDiagnostic list>
|
For a given script file, get the FSharpProjectOptions implied by the #load closure. All files are read from the FileSystem API, except the file being checked.
|
Full Usage:
this.GetProjectSnapshotFromScript
Parameters:
string
-
Used to differentiate between scripts, to consider each script a separate project. Also used in formatted error messages.
source : ISourceTextNew
-
The source for the file.
?documentSource : DocumentSource
-
DocumentSource to load any additional files.
?previewEnabled : bool
-
Is the preview compiler enabled.
?loadedTimeStamp : DateTime
-
Indicates when the script was loaded into the editing environment,
so that an 'unload' and 'reload' action will cause the script to be considered as a new project,
so that references are re-resolved.
?otherFlags : string[]
-
Other flags for compilation.
?useFsiAuxLib : bool
-
Add a default reference to the FSharp.Compiler.Interactive.Settings library.
?useSdkRefs : bool
-
Use the implicit references from the .NET SDK.
?assumeDotNetFramework : bool
-
Set up compilation and analysis for .NET Framework scripts.
?sdkDirOverride : string
-
Override the .NET SDK used for default references.
?optionsStamp : int64
-
An optional unique stamp for the options.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<FSharpProjectSnapshot * FSharpDiagnostic list>
|
|
Full Usage:
this.InvalidateAll
|
This function is called when the entire environment is known to have changed for reasons not encoded in the ProjectOptions of any project/compilation. |
Full Usage:
this.InvalidateConfiguration
Parameters:
FSharpProjectSnapshot
?userOpName : string
|
This function is called when the configuration is known to have changed for reasons not encoded in the projectSnapshot. For example, dependent references may have been deleted or created.
|
Full Usage:
this.InvalidateConfiguration
Parameters:
FSharpProjectOptions
-
The options for the project or script, used to determine active --define conditionals and other options relevant to parsing.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
|
This function is called when the configuration is known to have changed for reasons not encoded in the ProjectOptions. For example, dependent references may have been deleted or created.
|
Full Usage:
this.MatchBraces
Parameters:
string
-
The fileName for the file, used to help caching of results.
sourceText : ISourceText
-
The full source for the file.
options : FSharpParsingOptions
-
Parsing options for the project or script.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<(range * range)[]>
|
Parse a source code file, returning information about brace matching in the file. Return an enumeration of the matching parenthetical tokens in the file.
|
Full Usage:
this.NotifyFileChanged
Parameters:
string
options : FSharpProjectOptions
?userOpName : string
Returns: Async<unit>
|
Notify the checker that given file has changed. This needs to be used when checker is created with documentSource = Custom.
|
Full Usage:
this.ParseAndCheckFileInProject
Parameters:
string
projectSnapshot : FSharpProjectSnapshot
?userOpName : string
Returns: Async<FSharpParseFileResults * FSharpCheckFileAnswer>
|
|
Full Usage:
this.ParseAndCheckFileInProject
Parameters:
string
-
The name of the file in the project whose source is being checked.
fileVersion : int
-
An integer that can be used to indicate the version of the file. This will be returned by TryGetRecentCheckResultsForFile when looking up the file.
sourceText : ISourceText
-
The source for the file.
options : FSharpProjectOptions
-
The options for the project or script.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<FSharpParseFileResults * FSharpCheckFileAnswer>
|
Parse and check a source code file, returning a handle to the results Note: all files except the one being checked are read from the FileSystem API Return FSharpCheckFileAnswer.Aborted if a parse tree was not available.
|
Full Usage:
this.ParseAndCheckProject
Parameters:
FSharpProjectSnapshot
?userOpName : string
Returns: Async<FSharpCheckProjectResults>
|
|
Full Usage:
this.ParseAndCheckProject
Parameters:
FSharpProjectOptions
-
The options for the project or script.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<FSharpCheckProjectResults>
|
Parse and typecheck all files in a project. All files are read from the FileSystem API Can cause a second type-check on the entire project when `enablePartialTypeChecking` is true on the FSharpChecker.
|
Full Usage:
this.ParseFile
Parameters:
string
projectSnapshot : FSharpProjectSnapshot
?userOpName : string
Returns: Async<FSharpParseFileResults>
|
|
Full Usage:
this.ParseFile
Parameters:
string
-
The path for the file. The file name is used as a module name for implicit top level modules (e.g. in scripts).
sourceText : ISourceText
-
The source to be parsed.
options : FSharpParsingOptions
-
Parsing options for the project or script.
?cache : bool
-
Store the parse in a size-limited cache associated with the FSharpChecker. Default: true
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: Async<FSharpParseFileResults>
|
Parses a source code for a file and caches the results. Returns an AST that can be traversed for various features.
|
|
Notify the host that a project has been fully checked in the background (using file contents provided by the file system API) The event may be raised on a background thread.
|
|
|
Full Usage:
this.TokenizeLine
Parameters:
string
state : FSharpTokenizerLexState
Returns: FSharpTokenInfo[] * FSharpTokenizerLexState
|
Tokenize a single line, returning token information and a tokenization state represented by an integer
|
Full Usage:
this.TryGetRecentCheckResultsForFile
Parameters:
string
projectSnapshot : FSharpProjectSnapshot
?userOpName : string
Returns: (FSharpParseFileResults * FSharpCheckFileResults) option
|
|
Full Usage:
this.TryGetRecentCheckResultsForFile
Parameters:
string
-
The file name for the file.
options : FSharpProjectOptions
-
The options for the project or script, used to determine active --define conditionals and other options relevant to parsing.
?sourceText : ISourceText
-
Optionally, specify source that must match the previous parse precisely.
?userOpName : string
-
An optional string used for tracing compiler operations associated with this request.
Returns: (FSharpParseFileResults * FSharpCheckFileResults * int64) option
|
Try to get type check results for a file. This looks up the results of recent type checks of the same file, regardless of contents. The version tag specified in the original check of the file is returned. If the source of the file has changed the results returned by this function may be out of date, though may still be usable for generating intellisense menus and information.
|
Full Usage:
this.UsesTransparentCompiler
Returns: bool
|
|
Static members
Static member |
Description
|
Full Usage:
FSharpChecker.ActualCheckFileCount
Returns: int
|
Report a statistic for testability
|
Full Usage:
FSharpChecker.ActualParseFileCount
Returns: int
|
Report a statistic for testability
|
Full Usage:
FSharpChecker.Create(?projectCacheSize, ?keepAssemblyContents, ?keepAllBackgroundResolutions, ?legacyReferenceResolver, ?tryGetMetadataSnapshot, ?suggestNamesForErrors, ?keepAllBackgroundSymbolUses, ?enableBackgroundItemKeyStoreAndSemanticClassification, ?enablePartialTypeChecking, ?parallelReferenceResolution, ?captureIdentifiersWhenParsing, ?documentSource, ?useTransparentCompiler)
Parameters:
int
-
The optional size of the project checking cache.
?keepAssemblyContents : bool
-
Keep the checked contents of projects.
?keepAllBackgroundResolutions : bool
-
If false, do not keep full intermediate checking results from background checking suitable for returning from GetBackgroundCheckResultsForFileInProject. This reduces memory usage.
?legacyReferenceResolver : LegacyReferenceResolver
-
An optional resolver for legacy MSBuild references
?tryGetMetadataSnapshot : ILReaderTryGetMetadataSnapshot
-
An optional resolver to access the contents of .NET binaries in a memory-efficient way
?suggestNamesForErrors : bool
-
Indicate whether name suggestion should be enabled
?keepAllBackgroundSymbolUses : bool
-
Indicate whether all symbol uses should be kept in background checking
?enableBackgroundItemKeyStoreAndSemanticClassification : bool
-
Indicates whether a table of symbol keys should be kept for background compilation
?enablePartialTypeChecking : bool
-
Indicates whether to perform partial type checking. Cannot be set to true if keepAssemblyContents is true. If set to true, can cause duplicate type-checks when richer information on a file is needed, but can skip background type-checking entirely on implementation files with signature files.
?parallelReferenceResolution : bool
-
Indicates whether to resolve references in parallel.
?captureIdentifiersWhenParsing : bool
-
When set to true we create a set of all identifiers for each parsed file which can be used to speed up finding references.
?documentSource : DocumentSource
-
Default: FileSystem. You can use Custom source to provide a function that will return the source for a given file path instead of reading it from the file system. Note that with this option the FSharpChecker will also not monitor the file system for file changes. It will expect to be notified of changes via the NotifyFileChanged method.
?useTransparentCompiler : bool
-
Default: false. Indicates whether we use a new experimental background compiler. This does not yet support all features
Returns: FSharpChecker
|
Create an instance of an FSharpChecker.
|