Collection of tools used when developing for Fantomas
To run this tool locally you need:
- Pull in the source dependencies:
dotnet fsi build.fsx -- -p Fantomas-Git- Run the Watch pipeline:
dotnet fsi build.fsx -- -p WatchMaking changes to the client should reflect in the tool. The backends are started once; add --server to have them rebuild on changes too:
dotnet fsi build.fsx -- -p Watch --serverOr try the Run pipeline:
dotnet fsi build -- -p StartThis will run a published version of the tools.
-
Open the repository via https://gitpod.io/#https://github.com/fsprojects/fantomas-tools
-
Run
dotnet fsi build.fsx -- -p Fantomas-Gitdotnet fsi build.fsx -- -p Watch- Open browser for port
9060
The projects and build.fsx are checked with the Ionide and
G-Research analyzers, the pair the Fantomas repository uses:
dotnet fsi build.fsx -- -p AnalyzeEvery finding is printed, and none of them fails the run: the two packages report below error severity, so the
pipeline only fails when a target could not be analyzed at all. Each target also writes a SARIF report to
analysisreports/, and those are merged into analysis.sarif in the repository root. CI runs the pipeline on
every pull request and uploads that merged report to GitHub code scanning.
The AST viewer reads the untyped syntax tree without F# reflection, so it can run under Native AOT.
src/server/ASTViewer/SyntaxReader.fs has one function per syntax type that turns a value into a SyntaxNode.
Do not edit that file: it is generated from SyntaxTree.fsi and SyntaxTrivia.fsi of the FCS commit the
preview Fantomas checkout (FantomasPreviewRepository) builds Fantomas.FCS from.
Run the generator again each time that FCS commit changes:
dotnet fsi build.fsx -- -p Fantomas-Git
dotnet fsi src/server/ASTViewer/GenerateSyntaxReader.fsxThe first command clones or pulls the Fantomas checkouts and builds them, which puts the FCS sources under
.deps. The
generator then writes and formats SyntaxReader.fs. If the syntax files use a type they do not define, the
generator stops and names it. Add a function with that name, starting with a lowercase letter, to the Leaf
module in src/server/ASTViewer/SyntaxNode.fs, and run the generator again.
To see any other avaiable build script pipelines:
dotnet fsi build.fsx -- --help