Skip to content

Commit 44bdb1c

Browse files
Initial docs generation using Fornax
1 parent 1d173b6 commit 44bdb1c

File tree

134 files changed

+6537
-3545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+6537
-3545
lines changed

fcs/.config/dotnet-tools.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
"commands": [
1414
"paket"
1515
]
16+
},
17+
"fornax": {
18+
"version": "0.13.1",
19+
"commands": [
20+
"fornax"
21+
]
1622
}
1723
}
1824
}

fcs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ FSharp.Compiler.Service.netstandard/pplex.fs
1111
FSharp.Compiler.Service.netstandard/pppars.fs
1212
FSharp.Compiler.Service.netstandard/pppars.fsi
1313
.idea/
14+
_public

fcs/docsrc/_lib/Fornax.Core.dll

729 KB
Binary file not shown.

fcs/docsrc/config.fsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#r "_lib/Fornax.Core.dll"
2+
3+
open Config
4+
5+
let customRename (page: string) =
6+
System.IO.Path.ChangeExtension(page.Replace ("content/", ""), ".html")
7+
8+
let isScriptToParse (ap, rp : string) =
9+
let folder = System.IO.Path.GetDirectoryName rp
10+
folder.Contains "content" && rp.EndsWith ".fsx"
11+
12+
let config = {
13+
Generators = [
14+
{Script = "page.fsx"; Trigger = OnFileExt ".md"; OutputFile = Custom customRename }
15+
{Script = "page.fsx"; Trigger = OnFilePredicate isScriptToParse; OutputFile = Custom customRename }
16+
{Script = "apiref.fsx"; Trigger = Once; OutputFile = MultipleFiles (sprintf "reference/%s.html") }
17+
18+
{Script = "lunr.fsx"; Trigger = Once; OutputFile = NewFileName "index.json" }
19+
]
20+
}

fcs/docsrc/content/caches.fsx

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
(**
2+
---
3+
category: how-to
4+
title: Notes on the FSharpChecker caches
5+
menu_order: 2
6+
7+
---
8+
*)
19
(*** hide ***)
210
#I "../../../artifacts/bin/fcs/Release/netcoreapp3.0"
311
(**
@@ -8,24 +16,24 @@ This is a design note on the FSharpChecker component and its caches. See also t
816
917
Each FSharpChecker object maintains a set of caches. These are
1018
11-
* ``scriptClosureCache`` - an MRU cache of default size ``projectCacheSize`` that caches the
19+
* ``scriptClosureCache`` - an MRU cache of default size ``projectCacheSize`` that caches the
1220
computation of GetProjectOptionsFromScript. This computation can be lengthy as it can involve processing the transitive closure
1321
of all ``#load`` directives, which in turn can mean parsing an unbounded number of script files
1422
15-
* ``incrementalBuildersCache`` - an MRU cache of projects where a handle is being kept to their incremental checking state,
16-
of default size ``projectCacheSize`` (= 3 unless explicitly set as a parameter).
17-
The "current background project" (see the [FSharpChecker operations queue](queue.html))
23+
* ``incrementalBuildersCache`` - an MRU cache of projects where a handle is being kept to their incremental checking state,
24+
of default size ``projectCacheSize`` (= 3 unless explicitly set as a parameter).
25+
The "current background project" (see the [FSharpChecker operations queue](queue.html))
1826
will be one of these projects. When analyzing large collections of projects, this cache usually occupies by far the most memory.
1927
Increasing the size of this cache can dramatically decrease incremental computation of project-wide checking, or of checking
2028
individual files within a project, but can very greatly increase memory usage.
2129
2230
* ``braceMatchCache`` - an MRU cache of size ``braceMatchCacheSize`` (default = 5) keeping the results of calls to MatchBraces, keyed by filename, source and project options.
2331
24-
* ``parseFileCache`` - an MRU cache of size ``parseFileCacheSize`` (default = 2) keeping the results of ParseFile,
32+
* ``parseFileCache`` - an MRU cache of size ``parseFileCacheSize`` (default = 2) keeping the results of ParseFile,
2533
keyed by filename, source and project options.
2634
27-
* ``checkFileInProjectCache`` - an MRU cache of size ``incrementalTypeCheckCacheSize`` (default = 5) keeping the results of
28-
ParseAndCheckFileInProject, CheckFileInProject and/or CheckFileInProjectIfReady. This is keyed by filename, file source
35+
* ``checkFileInProjectCache`` - an MRU cache of size ``incrementalTypeCheckCacheSize`` (default = 5) keeping the results of
36+
ParseAndCheckFileInProject, CheckFileInProject and/or CheckFileInProjectIfReady. This is keyed by filename, file source
2937
and project options. The results held in this cache are only returned if they would reflect an accurate parse and check of the
3038
file.
3139
@@ -35,8 +43,8 @@ Each FSharpChecker object maintains a set of caches. These are
3543
are all weak references, you can generally ignore this cache, since its entries will be automatically collected.
3644
Strong references to binary readers will be kept by other FCS data structures, e.g. any project checkers, symbols or project checking results.
3745
38-
In more detail, the bytes for referenced .NET binaries are read into memory all at once, eagerly. Files are not left
39-
open or memory-mapped when using FSharpChecker (as opposed to FsiEvaluationSession, which loads assemblies using reflection).
46+
In more detail, the bytes for referenced .NET binaries are read into memory all at once, eagerly. Files are not left
47+
open or memory-mapped when using FSharpChecker (as opposed to FsiEvaluationSession, which loads assemblies using reflection).
4048
The purpose of this cache is mainly to ensure that while setting up compilation, the reads of mscorlib, FSharp.Core and so on
4149
amortize cracking the DLLs.
4250
@@ -46,8 +54,8 @@ Each FSharpChecker object maintains a set of caches. These are
4654
4755
Profiling the memory used by the various caches can be done by looking for the corresponding static roots in memory profiling traces.
4856
49-
The sizes of some of these caches can be adjusted by giving parameters to FSharpChecker. Unless otherwise noted,
50-
the cache sizes above indicate the "strong" size of the cache, where memory is held regardless of the memory
57+
The sizes of some of these caches can be adjusted by giving parameters to FSharpChecker. Unless otherwise noted,
58+
the cache sizes above indicate the "strong" size of the cache, where memory is held regardless of the memory
5159
pressure on the system. Some of the caches can also hold "weak" references which can be collected at will by the GC.
5260
5361
> Note: Because of these caches, you should generally use one global, shared FSharpChecker for everything in an IDE application.
@@ -58,13 +66,13 @@ Low-Memory Condition
5866
5967
Version 1.4.0.8 added a "maximum memory" limit specified by the `MaxMemory` property on FSharpChecker (in MB). If an FCS project operation
6068
is performed (see `CheckMaxMemoryReached` in `service.fs`) and `System.GC.GetTotalMemory(false)` reports a figure greater than this, then
61-
the strong sizes of all FCS caches are reduced to either 0 or 1. This happens for the remainder of the lifetime of the FSharpChecker object.
62-
In practice this will still make tools like the Visual Studio F# Power Tools usable, but some operations like renaming across multiple
69+
the strong sizes of all FCS caches are reduced to either 0 or 1. This happens for the remainder of the lifetime of the FSharpChecker object.
70+
In practice this will still make tools like the Visual Studio F# Power Tools usable, but some operations like renaming across multiple
6371
projects may take substantially longer.
6472
65-
By default the maximum memory trigger is disabled, see `maxMBDefault` in `service.fs`.
73+
By default the maximum memory trigger is disabled, see `maxMBDefault` in `service.fs`.
6674
67-
Reducing the FCS strong cache sizes does not guarantee there will be enough memory to continue operations - even holding one project
75+
Reducing the FCS strong cache sizes does not guarantee there will be enough memory to continue operations - even holding one project
6876
strongly may exceed a process memory budget. It just means FCS may hold less memory strongly.
6977
7078
If you do not want the maximum memory limit to apply then set MaxMemory to System.Int32.MaxValue.
@@ -73,9 +81,9 @@ Summary
7381
-------
7482
7583
In this design note, you learned that the FSharpChecker component keeps a set of caches in order to support common
76-
incremental analysis scenarios reasonably efficiently. They correspond roughly to the original caches and sizes
84+
incremental analysis scenarios reasonably efficiently. They correspond roughly to the original caches and sizes
7785
used by the Visual F# Tools, from which the FSharpChecker component derives.
7886
79-
In long running, highly interactive, multi-project scenarios you should carefully
87+
In long running, highly interactive, multi-project scenarios you should carefully
8088
consider the cache sizes you are using and the tradeoffs involved between incremental multi-project checking and memory usage.
8189
*)

fcs/docsrc/content/compiler.fsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
(**
2+
---
3+
category: tutorial
4+
title: Hosted Compiler
5+
menu_order: 8
6+
7+
---
8+
*)
19
(*** hide ***)
210
#I "../../../artifacts/bin/fcs/Release/netcoreapp3.0"
311
(**
@@ -10,8 +18,8 @@ This tutorial demonstrates how to host the F# compiler.
1018
*)
1119

1220
(**
13-
> **NOTE:** There are several options for hosting the F# compiler. The easiest one is to use the
14-
`fsc.exe` process and pass arguments.
21+
> **NOTE:** There are several options for hosting the F# compiler. The easiest one is to use the
22+
`fsc.exe` process and pass arguments.
1523
*)
1624

1725
(**
@@ -31,7 +39,7 @@ First, we need to reference the libraries that contain F# interactive service:
3139
open System.IO
3240
open FSharp.Compiler.SourceCodeServices
3341

34-
// Create an interactive checker instance
42+
// Create an interactive checker instance
3543
let checker = FSharpChecker.Create()
3644

3745
(**
@@ -45,7 +53,7 @@ let fn3 = Path.ChangeExtension(fn, ".dll")
4553
File.WriteAllText(fn2, """
4654
module M
4755
48-
type C() =
56+
type C() =
4957
member x.P = 1
5058
5159
let x = 3 + 4
@@ -55,11 +63,11 @@ let x = 3 + 4
5563
Now invoke the compiler:
5664
*)
5765

58-
let errors1, exitCode1 =
59-
checker.Compile([| "fsc.exe"; "-o"; fn3; "-a"; fn2 |])
66+
let errors1, exitCode1 =
67+
checker.Compile([| "fsc.exe"; "-o"; fn3; "-a"; fn2 |])
6068
|> Async.RunSynchronously
6169

62-
(**
70+
(**
6371
6472
If errors occur you can see this in the 'exitCode' and the returned array of errors:
6573
@@ -70,7 +78,7 @@ module M
7078
let x = 1.0 + "" // a type error
7179
""")
7280

73-
let errors1b, exitCode1b =
81+
let errors1b, exitCode1b =
7482
checker.Compile([| "fsc.exe"; "-o"; fn3; "-a"; fn2 |])
7583
|> Async.RunSynchronously
7684

@@ -85,16 +93,16 @@ is not really an option.
8593
8694
You still have to pass the "-o" option to name the output file, but the output file is not actually written to disk.
8795
88-
The 'None' option indicates that the initialization code for the assembly is not executed.
96+
The 'None' option indicates that the initialization code for the assembly is not executed.
8997
*)
90-
let errors2, exitCode2, dynAssembly2 =
98+
let errors2, exitCode2, dynAssembly2 =
9199
checker.CompileToDynamicAssembly([| "-o"; fn3; "-a"; fn2 |], execute=None)
92100
|> Async.RunSynchronously
93101

94102
(*
95103
Passing 'Some' for the 'execute' parameter executes the initialization code for the assembly.
96104
*)
97-
let errors3, exitCode3, dynAssembly3 =
105+
let errors3, exitCode3, dynAssembly3 =
98106
checker.CompileToDynamicAssembly([| "-o"; fn3; "-a"; fn2 |], Some(stdout,stderr))
99107
|> Async.RunSynchronously
100108

fcs/docsrc/content/corelib.fsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
(**
2+
---
3+
category: how-to
4+
title: Notes on FSharp.Core.dll
5+
menu_order: 3
6+
7+
---
8+
*)
19
(*** hide ***)
210
#I "../../../artifacts/bin/fcs/Release/netcoreapp3.0"
311
(**

fcs/docsrc/content/devnotes.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
title: Developer Notes
3+
category: explanation
4+
menu_order: 2
5+
---
6+
17
Developer notes
28
===============
39

@@ -6,9 +12,9 @@ and F# interactive as services.
612

713
## Components
814

9-
There is one main component, `FSharp.Compiler.Service.dll`.
10-
The main aim is to have a stable and documented fork of the main compiler that allows various
11-
tools to share this common code.
15+
There is one main component, `FSharp.Compiler.Service.dll`.
16+
The main aim is to have a stable and documented fork of the main compiler that allows various
17+
tools to share this common code.
1218
This component allows embedding F# Interactive as a service and contains a number of
1319
modifications to the source code of `fsi.exe` that adds `EvalExpression` and `EvalInteraction` functions.
1420

@@ -19,7 +25,7 @@ This repo should be _identical_ to 'fsharp' except:
1925
- Only build `FSharp.Compiler.Service.dll`
2026
- No bootstrap or proto compiler is used - an installed F# compiler is assumed
2127

22-
- Build script using FAKE that builds everything, produces NuGet package and
28+
- Build script using FAKE that builds everything, produces NuGet package and
2329
generates documentation, files for publishing NuGet packages etc.
2430
(following [F# project scaffold](https://github.com/fsprojects/FSharp.ProjectScaffold))
2531

0 commit comments

Comments
 (0)