Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One fsiEvaluator per docs file #807

Merged
merged 2 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .paket/Paket.Restore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<MSBuild Projects="$(PaketToolsPath)paket.bootstrapper.proj" Targets="Restore" />
</Target>

<!-- Official workaround for https://learn.microsoft.com/en-us/visualstudio/msbuild/getfilehash-task?view=vs-2019 -->
<!-- Official workaround for https://docs.microsoft.com/en-us/visualstudio/msbuild/getfilehash-task?view=vs-2019 -->
<UsingTask TaskName="Microsoft.Build.Tasks.GetFileHash" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(MSBuildSupportsHashing)' == 'true' And '$(DetectedMSBuildVersion)' &lt; '16.0.360' " />
<UsingTask TaskName="Microsoft.Build.Tasks.VerifyFileHash" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(MSBuildSupportsHashing)' == 'true' And '$(DetectedMSBuildVersion)' &lt; '16.0.360' " />
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" DependsOnTargets="SetPaketCommand;PaketBootstrapping">
Expand Down
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 17.4.0

* One FSI evaluator per docs file [#737](https://github.com/fsprojects/FSharp.Formatting/issues/737)

## 17.3.0

* Better test project detection [#800](https://github.com/fsprojects/FSharp.Formatting/issues/800)
Expand Down
16 changes: 8 additions & 8 deletions src/fsdocs-tool/BuildCommand.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type internal DocContent
rootOutputFolderAsGiven,
previous: Map<_, _>,
lineNumbers,
fsiEvaluator,
evaluate,
substitutions,
saveImages,
watch,
Expand Down Expand Up @@ -252,6 +252,12 @@ type internal DocContent
if isFsx then
printfn " generating model for %s --> %s" inputFileFullPath outputFileRelativeToRoot

let fsiEvaluator =
(if evaluate then
Some(FsiEvaluator(onError = onError) :> IFsiEvaluator)
else
None)

let model =
Literate.ParseAndTransformScriptFile(
inputFileFullPath,
Expand Down Expand Up @@ -1579,18 +1585,12 @@ type CoreBuildOptions(watch) =
| "all" -> Some true
| _ -> None)

let fsiEvaluator =
(if this.eval then
Some(FsiEvaluator(onError = onError) :> IFsiEvaluator)
else
None)

let docContent =
DocContent(
rootOutputFolderAsGiven,
latestDocContentResults,
Some this.linenumbers,
fsiEvaluator,
this.eval,
docsSubstitutions,
saveImages,
watch,
Expand Down
4 changes: 2 additions & 2 deletions tests/FSharp.Literate.Tests/DocContentTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let ``Can build doc content`` () =
rootOutputFolderAsGiven,
Map.empty,
lineNumbers = None,
fsiEvaluator = None,
evaluate = false,
substitutions = [],
saveImages = None,
watch = false,
Expand Down Expand Up @@ -115,7 +115,7 @@ let ``Can build doc content using relative input path`` () =
rootOutputFolderAsGiven,
Map.empty,
lineNumbers = None,
fsiEvaluator = None,
evaluate = false,
substitutions = [],
saveImages = None,
watch = false,
Expand Down