From c7997ff9ca69c289a71d9ad4b7ab977722512d6b Mon Sep 17 00:00:00 2001 From: nojaf Date: Thu, 26 May 2022 10:52:03 +0100 Subject: [PATCH 1/2] Update fantomas-tool to fantomas --- .config/dotnet-tools.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 9308a4796..09d170d52 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -14,8 +14,8 @@ "paket" ] }, - "fantomas-tool": { - "version": "5.0.0-alpha-002", + "fantomas": { + "version": "5.0.0-alpha-007", "commands": [ "fantomas" ] From 688cc5c4cfe846677dff5809c2cd0911a48d077f Mon Sep 17 00:00:00 2001 From: nojaf Date: Thu, 26 May 2022 10:59:07 +0100 Subject: [PATCH 2/2] Format files --- docs/apidocs.fsx | 4 +- docs/codeformat.fsx | 4 +- docs/content.fsx | 4 +- docs/evaluation.fsx | 6 +- docs/literate.fsx | 4 +- docs/markdown.fsx | 4 +- src/FSharp.Formatting.ApiDocs/GenerateHtml.fs | 933 ++++++++---------- .../GenerateMarkdown.fs | 197 ++-- .../GenerateModel.fs | 268 ++--- .../CodeFormat.fs | 2 +- .../CodeFormatAgent.fs | 6 +- .../CommentFilter.fs | 2 +- .../HtmlFormatting.fs | 4 +- .../LatexFormatting.fs | 4 +- .../PynbFormatting.fs | 2 +- .../SourceParser.fs | 2 +- .../ToolTipReader.fs | 4 +- src/FSharp.Formatting.Common/PynbModel.fs | 12 +- .../YaafFSharpScripting.fs | 84 +- src/FSharp.Formatting.Literate/Contexts.fs | 88 +- src/FSharp.Formatting.Literate/Document.fs | 38 +- src/FSharp.Formatting.Literate/Evaluator.fs | 2 +- .../MarkdownParser.fs | 2 +- .../MarkdownUtils.fs | 20 +- src/fsdocs-tool/BuildCommand.fs | 44 +- .../files/FsLib1/Library1.fs | 10 +- .../files/TestLib1/Library1.fs | 10 +- tests/FSharp.Literate.Tests/EvalTests.fs | 2 +- tests/FSharp.Markdown.Tests/Externals.fs | 3 +- tests/FSharp.Markdown.Tests/Markdown.fs | 268 ++--- 30 files changed, 955 insertions(+), 1078 deletions(-) diff --git a/docs/apidocs.fsx b/docs/apidocs.fsx index 0ebbef309..e571cf524 100644 --- a/docs/apidocs.fsx +++ b/docs/apidocs.fsx @@ -16,11 +16,11 @@ index: 5 (*** condition: fsx ***) #if FSX #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // FSX +#endif (*** condition: ipynb ***) #if IPYNB #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // IPYNB +#endif (*** hide ***) let root = "C:\\" diff --git a/docs/codeformat.fsx b/docs/codeformat.fsx index 3c36b4dfb..5c6561099 100644 --- a/docs/codeformat.fsx +++ b/docs/codeformat.fsx @@ -15,11 +15,11 @@ index: 1 (*** condition: fsx ***) #if FSX #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // FSX +#endif (*** condition: ipynb ***) #if IPYNB #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // IPYNB +#endif (** [![Binder](img/badge-binder.svg)](https://mybinder.org/v2/gh/fsprojects/fsharp.formatting/gh-pages?filepath={{fsdocs-source-basename}}.ipynb)  diff --git a/docs/content.fsx b/docs/content.fsx index 37e5ff6f0..e7aa1740e 100644 --- a/docs/content.fsx +++ b/docs/content.fsx @@ -15,11 +15,11 @@ index: 3 (*** condition: fsx ***) #if FSX #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // FSX +#endif (*** condition: ipynb ***) #if IPYNB #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // IPYNB +#endif (** diff --git a/docs/evaluation.fsx b/docs/evaluation.fsx index d8687580b..4af3c82d5 100644 --- a/docs/evaluation.fsx +++ b/docs/evaluation.fsx @@ -15,11 +15,11 @@ index: 6 (*** condition: fsx ***) #if FSX #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // FSX +#endif (*** condition: ipynb ***) #if IPYNB #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // IPYNB +#endif (** [![Binder](img/badge-binder.svg)](https://mybinder.org/v2/gh/fsprojects/fsharp.formatting/gh-pages?filepath={{fsdocs-source-basename}}.ipynb)  @@ -153,7 +153,7 @@ This can be done by calling `cref:M:FSharp.Formatting.Literate.Evaluation.FsiEva // Create evaluator & register simple formatter for lists let fsiEvaluator = FsiEvaluator() -fsiEvaluator.RegisterTransformation (fun (o, ty, _executionCount) -> +fsiEvaluator.RegisterTransformation(fun (o, ty, _executionCount) -> // If the type of value is an F# list, format it nicely if ty.IsGenericType && ty.GetGenericTypeDefinition() = typedefof> then diff --git a/docs/literate.fsx b/docs/literate.fsx index ecbd7475e..c3d1d6137 100644 --- a/docs/literate.fsx +++ b/docs/literate.fsx @@ -15,11 +15,11 @@ index: 3 (*** condition: fsx ***) #if FSX #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // FSX +#endif (*** condition: ipynb ***) #if IPYNB #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // IPYNB +#endif (** diff --git a/docs/markdown.fsx b/docs/markdown.fsx index 58dc54c36..989ef4003 100644 --- a/docs/markdown.fsx +++ b/docs/markdown.fsx @@ -12,11 +12,11 @@ index: 2 (*** condition: fsx ***) #if FSX #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // FSX +#endif (*** condition: ipynb ***) #if IPYNB #r "nuget: FSharp.Formatting,{{fsdocs-package-version}}" -#endif // IPYNB +#endif (** diff --git a/src/FSharp.Formatting.ApiDocs/GenerateHtml.fs b/src/FSharp.Formatting.ApiDocs/GenerateHtml.fs index 02be1e185..7d08e93ce 100644 --- a/src/FSharp.Formatting.ApiDocs/GenerateHtml.fs +++ b/src/FSharp.Formatting.ApiDocs/GenerateHtml.fs @@ -31,27 +31,25 @@ type HtmlRender(model: ApiDocModel) = uniqueNumber let codeWithToolTip content tip = - div [] [ - let id = UniqueID().ToString() + div + [] + [ let id = UniqueID().ToString() - code - [ OnMouseOut(sprintf "hideTip(event, '%s', %s)" id id) - OnMouseOver(sprintf "showTip(event, '%s', %s)" id id) ] - content + code + [ OnMouseOut(sprintf "hideTip(event, '%s', %s)" id id) + OnMouseOver(sprintf "showTip(event, '%s', %s)" id id) ] + content - div [ Class "fsdocs-tip"; Id id ] tip - ] + div [ Class "fsdocs-tip"; Id id ] tip ] let sourceLink url = [ match url with | None -> () | Some href -> - a [ Href href; Class "fsdocs-source-link"; HtmlProperties.Title "Source on GitHub" ] [ - img [ Src(sprintf "%scontent/img/github.png" root) - Class "normal" ] - img [ Src(sprintf "%scontent/img/github-hover.png" root) - Class "hover" ] - ] ] + a + [ Href href; Class "fsdocs-source-link"; HtmlProperties.Title "Source on GitHub" ] + [ img [ Src(sprintf "%scontent/img/github.png" root); Class "normal" ] + img [ Src(sprintf "%scontent/img/github-hover.png" root); Class "hover" ] ] ] let removeParen (memberName: string) = let firstParen = memberName.IndexOf("(") @@ -63,14 +61,12 @@ type HtmlRender(model: ApiDocModel) = // Copy XML sig for use in `cref` XML let copyXmlSigIcon xmlDocSig = - div [ Class "fsdocs-source-link" + div + [ Class "fsdocs-source-link" HtmlProperties.Title "Copy signature (XML)" - OnClick(sprintf "Clipboard_CopyTo('')" xmlDocSig) ] [ - img [ Src(sprintf "%scontent/img/copy-xml.png" root) - Class "normal" ] - img [ Src(sprintf "%scontent/img/copy-xml-hover.png" root) - Class "hover" ] - ] + OnClick(sprintf "Clipboard_CopyTo('')" xmlDocSig) ] + [ img [ Src(sprintf "%scontent/img/copy-xml.png" root); Class "normal" ] + img [ Src(sprintf "%scontent/img/copy-xml-hover.png" root); Class "hover" ] ] let copyXmlSigIconForSymbol (symbol: FSharpSymbol) = [ match symbol with @@ -88,14 +84,12 @@ type HtmlRender(model: ApiDocModel) = elif xmlDocSig.Contains("`") then "``" else "`" - div [ Class "fsdocs-source-link" + div + [ Class "fsdocs-source-link" HtmlProperties.Title "Copy signature (Markdown)" - OnClick(sprintf "Clipboard_CopyTo('%scref:%s%s')" delim xmlDocSig delim) ] [ - img [ Src(sprintf "%scontent/img/copy-md.png" root) - Class "normal" ] - img [ Src(sprintf "%scontent/img/copy-md-hover.png" root) - Class "hover" ] - ] + OnClick(sprintf "Clipboard_CopyTo('%scref:%s%s')" delim xmlDocSig delim) ] + [ img [ Src(sprintf "%scontent/img/copy-md.png" root); Class "normal" ] + img [ Src(sprintf "%scontent/img/copy-md-hover.png" root); Class "hover" ] ] let copyXmlSigIconForSymbolMarkdown (symbol: FSharpSymbol) = [ match symbol with @@ -107,189 +101,174 @@ type HtmlRender(model: ApiDocModel) = [ if members.Length > 0 then h3 [] [ !!header ] - table [ Class "table outer-list fsdocs-member-list" ] [ - thead [] [ - tr [] [ - td [ Class "fsdocs-member-list-header" ] [ - !!tableHeader - ] - td [ Class "fsdocs-member-list-header" ] [ - !! "Description" - ] - ] - ] - tbody [] [ - for m in members do - tr [] [ - td [ Class "fsdocs-member-usage" ] [ - - codeWithToolTip [ - // This adds #MemberName anchor. These may be ambiguous due to overloading - p [] [ - a [ Id m.Name ] [ - a [ Href("#" + m.Name) ] [ - embed m.UsageHtml - ] - ] - ] ] [ - div [ Class "member-tooltip" ] [ - !! "Full Usage: " - embed m.UsageHtml - br [] - br [] - if not m.Parameters.IsEmpty then - !! "Parameters: " - - ul [] [ - for p in m.Parameters do - span [] [ - b [] [ !!p.ParameterNameText ] - !! ":" - embed p.ParameterType - match p.ParameterDocs with + table + [ Class "table outer-list fsdocs-member-list" ] + [ thead + [] + [ tr + [] + [ td [ Class "fsdocs-member-list-header" ] [ !!tableHeader ] + td [ Class "fsdocs-member-list-header" ] [ !! "Description" ] ] ] + tbody + [] + [ for m in members do + tr + [] + [ td + [ Class "fsdocs-member-usage" ] + [ + + codeWithToolTip + [ + // This adds #MemberName anchor. These may be ambiguous due to overloading + p + [] + [ a [ Id m.Name ] [ a [ Href("#" + m.Name) ] [ embed m.UsageHtml ] ] ] ] + [ div + [ Class "member-tooltip" ] + [ !! "Full Usage: " + embed m.UsageHtml + br [] + br [] + if not m.Parameters.IsEmpty then + !! "Parameters: " + + ul + [] + [ for p in m.Parameters do + span + [] + [ b [] [ !!p.ParameterNameText ] + !! ":" + embed p.ParameterType + match p.ParameterDocs with + | None -> () + | Some d -> + !! " - " + embed d ] + + br [] ] + + br [] + match m.ReturnInfo.ReturnType with + | None -> () + | Some (_, rty) -> + span + [] + [ !!(if m.Kind <> ApiDocMemberKind.RecordField then + "Returns: " + else + "Field type: ") + embed rty ] + + match m.ReturnInfo.ReturnDocs with | None -> () - | Some d -> - !! " - " - embed d - ] + | Some d -> embed d + + br [] + //!! "Signature: " + //encode(m.SignatureTooltip) + if not m.Modifiers.IsEmpty then + !! "Modifiers: " + encode (m.FormatModifiers) + br [] + + // We suppress the display of ill-formatted type parameters for places + // where these have not been explicitly declared + match m.FormatTypeArguments with + | None -> () + | Some v -> + !! "Type parameters: " + encode (v) ] ] ] + + td + [ Class "fsdocs-member-xmldoc" ] + [ div + [ Class "fsdocs-summary" ] + [ yield! copyXmlSigIconForSymbolMarkdown m.Symbol + yield! copyXmlSigIconForSymbol m.Symbol + yield! sourceLink m.SourceLocation + p [ Class "fsdocs-summary" ] [ embed m.Comment.Summary ] ] + + match m.Comment.Remarks with + | Some r -> p [ Class "fsdocs-remarks" ] [ embed r ] + | None -> () - br [] - ] + match m.ExtendedType with + | Some (_, extendedTypeHtml) -> + p [] [ !! "Extended Type: "; embed extendedTypeHtml ] + | _ -> () + + if not m.Parameters.IsEmpty then + dl + [ Class "fsdocs-params" ] + [ for parameter in m.Parameters do + dt + [ Class "fsdocs-param" ] + [ span + [ Class "fsdocs-param-name" ] + [ !!parameter.ParameterNameText ] + !! ":" + embed parameter.ParameterType ] + + dd + [ Class "fsdocs-param-docs" ] + [ match parameter.ParameterDocs with + | None -> () + | Some d -> p [] [ embed d ] ] ] - br [] match m.ReturnInfo.ReturnType with | None -> () - | Some (_, rty) -> - span [] [ - !!(if m.Kind <> ApiDocMemberKind.RecordField then - "Returns: " - else - "Field type: ") - embed rty - ] - - match m.ReturnInfo.ReturnDocs with - | None -> () - | Some d -> embed d - - br [] - //!! "Signature: " - //encode(m.SignatureTooltip) - if not m.Modifiers.IsEmpty then - !! "Modifiers: " - encode (m.FormatModifiers) - br [] - - // We suppress the display of ill-formatted type parameters for places - // where these have not been explicitly declared - match m.FormatTypeArguments with - | None -> () - | Some v -> - !! "Type parameters: " - encode (v) - ] - ] - ] - - td [ Class "fsdocs-member-xmldoc" ] [ - div [ Class "fsdocs-summary" ] [ - yield! copyXmlSigIconForSymbolMarkdown m.Symbol - yield! copyXmlSigIconForSymbol m.Symbol - yield! sourceLink m.SourceLocation - p [ Class "fsdocs-summary" ] [ - embed m.Comment.Summary - ] - ] - - match m.Comment.Remarks with - | Some r -> p [ Class "fsdocs-remarks" ] [ embed r ] - | None -> () - - match m.ExtendedType with - | Some (_, extendedTypeHtml) -> - p [] [ - !! "Extended Type: " - embed extendedTypeHtml - ] - | _ -> () - - if not m.Parameters.IsEmpty then - dl [ Class "fsdocs-params" ] [ - for parameter in m.Parameters do - dt [ Class "fsdocs-param" ] [ - span [ Class "fsdocs-param-name" ] [ - !!parameter.ParameterNameText - ] - !! ":" - embed parameter.ParameterType - ] - - dd [ Class "fsdocs-param-docs" ] [ - match parameter.ParameterDocs with - | None -> () - | Some d -> p [] [ embed d ] - ] - ] - - match m.ReturnInfo.ReturnType with - | None -> () - | Some (_, returnTypeHtml) -> - dl [ Class "fsdocs-returns" ] [ - dt [] [ - span [ Class "fsdocs-return-name" ] [ - !!(if m.Kind <> ApiDocMemberKind.RecordField then - "Returns: " - else - "Field type: ") - ] - embed returnTypeHtml - ] - dd [ Class "fsdocs-return-docs" ] [ - match m.ReturnInfo.ReturnDocs with - | None -> () - | Some r -> p [] [ embed r ] - ] - ] - - if not m.Comment.Exceptions.IsEmpty then - //p [] [ !! "Exceptions:" ] - table [ Class "fsdocs-exception-list" ] [ - for (nm, link, html) in m.Comment.Exceptions do - tr [] [ - td - [] - (match link with - | None -> [] - | Some href -> [ a [ Href href ] [ !!nm ] ]) - td [] [ embed html ] - ] - ] - - for e in m.Comment.Notes do - h5 [ Class "fsdocs-note-header" ] [ - !! "Note" - ] - - p [ Class "fsdocs-note" ] [ embed e ] - - for e in m.Comment.Examples do - h5 [ Class "fsdocs-example-header" ] [ - !! "Example" - ] - - p [ Class "fsdocs-example"; if e.Id.IsSome then Id e.Id.Value ] [ - embed e - ] - - //if m.IsObsolete then - // obsoleteMessage m.ObsoleteMessage - - //if not (String.IsNullOrEmpty(m.Details.FormatCompiledName)) then - // p [] [!!"CompiledName: "; code [] [!!m.Details.FormatCompiledName]] - ] - ] - ] - ] ] + | Some (_, returnTypeHtml) -> + dl + [ Class "fsdocs-returns" ] + [ dt + [] + [ span + [ Class "fsdocs-return-name" ] + [ !!(if m.Kind <> ApiDocMemberKind.RecordField then + "Returns: " + else + "Field type: ") ] + embed returnTypeHtml ] + dd + [ Class "fsdocs-return-docs" ] + [ match m.ReturnInfo.ReturnDocs with + | None -> () + | Some r -> p [] [ embed r ] ] ] + + if not m.Comment.Exceptions.IsEmpty then + //p [] [ !! "Exceptions:" ] + table + [ Class "fsdocs-exception-list" ] + [ for (nm, link, html) in m.Comment.Exceptions do + tr + [] + [ td + [] + (match link with + | None -> [] + | Some href -> [ a [ Href href ] [ !!nm ] ]) + td [] [ embed html ] ] ] + + for e in m.Comment.Notes do + h5 [ Class "fsdocs-note-header" ] [ !! "Note" ] + + p [ Class "fsdocs-note" ] [ embed e ] + + for e in m.Comment.Examples do + h5 [ Class "fsdocs-example-header" ] [ !! "Example" ] + + p + [ Class "fsdocs-example"; if e.Id.IsSome then Id e.Id.Value ] + [ embed e ] + + //if m.IsObsolete then + // obsoleteMessage m.ObsoleteMessage + + //if not (String.IsNullOrEmpty(m.Details.FormatCompiledName)) then + // p [] [!!"CompiledName: "; code [] [!!m.Details.FormatCompiledName]] + ] ] ] ] ] let renderEntities (entities: ApiDocEntity list) = [ if entities.Length > 0 then @@ -297,59 +276,65 @@ type HtmlRender(model: ApiDocModel) = let hasModules = entities |> List.exists (fun e -> not e.IsTypeDefinition) - table [ Class "table outer-list fsdocs-entity-list" ] [ - thead [] [ - tr [] [ - td [] [ - !!(if hasTypes && hasModules then - "Type/Module" - elif hasTypes then - "Type" - else - "Modules") - ] - td [] [ !! "Description" ] - ] - ] - tbody [] [ - for e in entities do - tr [] [ - td [ Class "fsdocs-entity-name" ] [ - let nm = e.Name - - let multi = (entities |> List.filter (fun e -> e.Name = nm) |> List.length) > 1 - - let nmWithSiffix = - if multi then - (if e.IsTypeDefinition then - nm + " (Type)" - else - nm + " (Module)") - else - nm - - // This adds #EntityName anchor. These may currently be ambiguous - p [] [ - a [ Name nm ] [ - a [ Href(e.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [ - !!nmWithSiffix - ] - ] - ] - ] - td [ Class "fsdocs-entity-xmldoc" ] [ - div [] [ - yield! copyXmlSigIconForSymbolMarkdown e.Symbol - yield! copyXmlSigIconForSymbol e.Symbol - yield! sourceLink e.SourceLocation - p [ Class "fsdocs-summary" ] [ - embed e.Comment.Summary - ] - ] - ] - ] - ] - ] ] + table + [ Class "table outer-list fsdocs-entity-list" ] + [ thead + [] + [ tr + [] + [ td + [] + [ !!(if hasTypes && hasModules then + "Type/Module" + elif hasTypes then + "Type" + else + "Modules") ] + td [] [ !! "Description" ] ] ] + tbody + [] + [ for e in entities do + tr + [] + [ td + [ Class "fsdocs-entity-name" ] + [ let nm = e.Name + + let multi = + (entities |> List.filter (fun e -> e.Name = nm) |> List.length) > 1 + + let nmWithSiffix = + if multi then + (if e.IsTypeDefinition then + nm + " (Type)" + else + nm + " (Module)") + else + nm + + // This adds #EntityName anchor. These may currently be ambiguous + p + [] + [ a + [ Name nm ] + [ a + [ Href( + e.Url( + root, + collectionName, + qualify, + model.FileExtensions.InUrl + ) + ) ] + [ !!nmWithSiffix ] ] ] ] + td + [ Class "fsdocs-entity-xmldoc" ] + [ div + [] + [ yield! copyXmlSigIconForSymbolMarkdown e.Symbol + yield! copyXmlSigIconForSymbol e.Symbol + yield! sourceLink e.SourceLocation + p [ Class "fsdocs-summary" ] [ embed e.Comment.Summary ] ] ] ] ] ] ] let entityContent (info: ApiDocEntityInfo) = // Get all the members & comment for the type @@ -364,160 +349,129 @@ type HtmlRender(model: ApiDocModel) = | Some m when m.RequiresQualifiedAccess -> m.Name + "." + entity.Name | _ -> entity.Name - [ h2 [] [ - !!(usageName - + (if entity.IsTypeDefinition then - " Type" - else - " Module")) - ] - dl [ Class "fsdocs-metadata" ] [ - dt [] [ - !! "Namespace: " - a [ Href(info.Namespace.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [ - !!info.Namespace.Name - ] - ] - dt [] [ - !!("Assembly: " + entity.Assembly.Name + ".dll") - ] - - match info.ParentModule with - | None -> () - | Some parentModule -> - dt [] [ - !! "Parent Module: " - a [ Href(parentModule.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [ - !!parentModule.Name - ] - ] - - - match entity.AbbreviatedType with - | Some (_, abbreviatedTypHtml) -> - dt [] [ - !! "Abbreviation For: " - embed abbreviatedTypHtml - ] - - | None -> () - - match entity.BaseType with - | Some (_, baseTypeHtml) -> - dt [] [ - !! "Base Type: " - embed baseTypeHtml - ] - | None -> () - - match entity.AllInterfaces with - | [] -> () - | l -> - dt [] [ - !!("All Interfaces: ") - for (i, (_, ityHtml)) in Seq.indexed l do - if i <> 0 then !! ", " - embed ityHtml - ] - - if entity.Symbol.IsValueType then - dt [] [ !!("Kind: Struct") ] - - match entity.DelegateSignature with - | Some (_, delegateSigHtml) -> - dt [] [ - !!("Delegate Signature: ") - embed delegateSigHtml - ] - | None -> () - - if entity.Symbol.IsProvided then - dt [] [ - !!("This is a provided type definition") - ] - - if entity.Symbol.IsAttributeType then - dt [] [ - !!("This is an attribute type definition") - ] - - if entity.Symbol.IsEnum then - dt [] [ - !!("This is an enum type definition") - ] - - //if info.Entity.IsObsolete then - // obsoleteMessage entity.ObsoleteMessage - ] + [ h2 + [] + [ !!(usageName + + (if entity.IsTypeDefinition then + " Type" + else + " Module")) ] + dl + [ Class "fsdocs-metadata" ] + [ dt + [] + [ !! "Namespace: " + a + [ Href(info.Namespace.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] + [ !!info.Namespace.Name ] ] + dt [] [ !!("Assembly: " + entity.Assembly.Name + ".dll") ] + + match info.ParentModule with + | None -> () + | Some parentModule -> + dt + [] + [ !! "Parent Module: " + a + [ Href(parentModule.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] + [ !!parentModule.Name ] ] + + + match entity.AbbreviatedType with + | Some (_, abbreviatedTypHtml) -> dt [] [ !! "Abbreviation For: "; embed abbreviatedTypHtml ] + + | None -> () + + match entity.BaseType with + | Some (_, baseTypeHtml) -> dt [] [ !! "Base Type: "; embed baseTypeHtml ] + | None -> () + + match entity.AllInterfaces with + | [] -> () + | l -> + dt + [] + [ !!("All Interfaces: ") + for (i, (_, ityHtml)) in Seq.indexed l do + if i <> 0 then !! ", " + embed ityHtml ] + + if entity.Symbol.IsValueType then + dt [] [ !!("Kind: Struct") ] + + match entity.DelegateSignature with + | Some (_, delegateSigHtml) -> dt [] [ !!("Delegate Signature: "); embed delegateSigHtml ] + | None -> () + + if entity.Symbol.IsProvided then + dt [] [ !!("This is a provided type definition") ] + + if entity.Symbol.IsAttributeType then + dt [] [ !!("This is an attribute type definition") ] + + if entity.Symbol.IsEnum then + dt [] [ !!("This is an enum type definition") ] + + //if info.Entity.IsObsolete then + // obsoleteMessage entity.ObsoleteMessage + ] // Show the summary (and sectioned docs without any members) - div [ Class "fsdocs-xmldoc" ] [ - div [] [ - //yield! copyXmlSigIconForSymbol entity.Symbol - //yield! sourceLink entity.SourceLocation - p [ Class "fsdocs-summary" ] [ - embed entity.Comment.Summary - ] - ] - // Show the remarks etc. - match entity.Comment.Remarks with - | Some r -> p [ Class "fsdocs-remarks" ] [ embed r ] - | None -> () - for note in entity.Comment.Notes do - h5 [ Class "fsdocs-note-header" ] [ - !! "Note" - ] - - p [ Class "fsdocs-note" ] [ embed note ] - - for example in entity.Comment.Examples do - h5 [ Class "fsdocs-example-header" ] [ - !! "Example" - ] - - p [ Class "fsdocs-example" ] [ - embed example - ] - - ] + div + [ Class "fsdocs-xmldoc" ] + [ div + [] + [ + //yield! copyXmlSigIconForSymbol entity.Symbol + //yield! sourceLink entity.SourceLocation + p [ Class "fsdocs-summary" ] [ embed entity.Comment.Summary ] ] + // Show the remarks etc. + match entity.Comment.Remarks with + | Some r -> p [ Class "fsdocs-remarks" ] [ embed r ] + | None -> () + for note in entity.Comment.Notes do + h5 [ Class "fsdocs-note-header" ] [ !! "Note" ] + + p [ Class "fsdocs-note" ] [ embed note ] + + for example in entity.Comment.Examples do + h5 [ Class "fsdocs-example-header" ] [ !! "Example" ] + + p [ Class "fsdocs-example" ] [ embed example ] + + ] if (byCategory.Length > 1) then // If there is more than 1 category in the type, generate TOC h3 [] [ !! "Table of contents" ] - ul [] [ - for (index, _, name) in byCategory do - li [] [ - a [ Href(sprintf "#section%d" index) ] [ - !!name - ] - ] - ] + ul + [] + [ for (index, _, name) in byCategory do + li [] [ a [ Href(sprintf "#section%d" index) ] [ !!name ] ] ] // let nestedEntities = entity.NestedEntities |> List.filter (fun e -> not e.IsObsolete) if (nestedEntities.Length > 0) then - div [] [ - h3 [] [ - !!(if nestedEntities |> List.forall (fun e -> not e.IsTypeDefinition) then - "Nested modules" - elif nestedEntities |> List.forall (fun e -> e.IsTypeDefinition) then - "Types" - else - "Types and nested modules") - ] - yield! renderEntities nestedEntities - ] + div + [] + [ h3 + [] + [ !!(if nestedEntities |> List.forall (fun e -> not e.IsTypeDefinition) then + "Nested modules" + elif nestedEntities |> List.forall (fun e -> e.IsTypeDefinition) then + "Types" + else + "Types and nested modules") ] + yield! renderEntities nestedEntities ] for (index, ms, name) in byCategory do // Iterate over all the categories and print members. If there are more than one // categories, print the category heading (as

) and add XML comment from the type // that is related to this specific category. if (byCategory.Length > 1) then - h2 [ Id(sprintf "section%d" index) ] [ - !!name - ] + h2 [ Id(sprintf "section%d" index) ] [ !!name ] // 

let functionsOrValues = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.ValueOrFunction) let extensions = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.TypeExtension) @@ -542,43 +496,37 @@ type HtmlRender(model: ApiDocModel) = let allByCategory = Categorise.entities (nsIndex, ns, false) [ if allByCategory.Length > 0 then - h2 [ Id ns.UrlHash ] [ - !!(ns.Name + " Namespace") - ] + h2 [ Id ns.UrlHash ] [ !!(ns.Name + " Namespace") ] - div [ Class "fsdocs-xmldoc" ] [ - match ns.NamespaceDocs with - | Some nsdocs -> - p [] [ embed nsdocs.Summary ] + div + [ Class "fsdocs-xmldoc" ] + [ match ns.NamespaceDocs with + | Some nsdocs -> + p [] [ embed nsdocs.Summary ] - match nsdocs.Remarks with - | Some r -> p [] [ embed r ] - | None -> () + match nsdocs.Remarks with + | Some r -> p [] [ embed r ] + | None -> () - | None -> () - ] + | None -> () ] if (allByCategory.Length > 1) then h3 [] [ !! "Contents" ] - ul [] [ - for category in allByCategory do - li [] [ - a [ Href("#category-" + category.CategoryIndex) ] [ - !!category.CategoryName - ] - ] - ] + ul + [] + [ for category in allByCategory do + li [] [ a [ Href("#category-" + category.CategoryIndex) ] [ !!category.CategoryName ] ] ] for category in allByCategory do if (allByCategory.Length > 1) then - h3 [] [ - a [ Class "anchor" - Name("category-" + category.CategoryIndex) - Href("#category-" + category.CategoryIndex) ] [ - !!category.CategoryName - ] - ] + h3 + [] + [ a + [ Class "anchor" + Name("category-" + category.CategoryIndex) + Href("#category-" + category.CategoryIndex) ] + [ !!category.CategoryName ] ] yield! renderEntities category.CategoryEntites ] @@ -588,18 +536,16 @@ type HtmlRender(model: ApiDocModel) = for _allByCategory, ns in categorise do // Generate the entry for the namespace - tr [] [ - td [] [ - a [ Href(ns.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [ - !!ns.Name - ] - ] - td [] [ - match ns.NamespaceDocs with - | Some nsdocs -> embed nsdocs.Summary - | None -> () - ] - ] ] + tr + [] + [ td + [] + [ a [ Href(ns.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [ !!ns.Name ] ] + td + [] + [ match ns.NamespaceDocs with + | Some nsdocs -> embed nsdocs.Summary + | None -> () ] ] ] let listOfNamespacesNavAux otherDocs (nsOpt: ApiDocNamespace option) = [ @@ -607,16 +553,14 @@ type HtmlRender(model: ApiDocModel) = // // For non-FSharp.Core we only show one link "API Reference" in the nav menu if otherDocs && model.Collection.CollectionName <> "FSharp.Core" then - li [ Class "nav-header" ] [ - !! "API Reference" - ] - - li [ Class "nav-item" ] [ - a [ Class "nav-link" - Href(model.IndexFileUrl(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [ - !! "All Namespaces" - ] - ] + li [ Class "nav-header" ] [ !! "API Reference" ] + + li + [ Class "nav-item" ] + [ a + [ Class "nav-link" + Href(model.IndexFileUrl(root, collectionName, qualify, model.FileExtensions.InUrl)) ] + [ !! "All Namespaces" ] ] else let categorise = Categorise.model model @@ -624,51 +568,50 @@ type HtmlRender(model: ApiDocModel) = let someExist = categorise.Length > 0 if someExist then - li [ Class "nav-header" ] [ - !! "Namespaces" - ] + li [ Class "nav-header" ] [ !! "Namespaces" ] for allByCategory, ns in categorise do // Generate the entry for the namespace - li [ Class( - "nav-item" - + - // add the 'active' class if this is the namespace of the thing being shown - match nsOpt with - | Some ns2 when ns.Name = ns2.Name -> " active" - | _ -> "" - ) ] [ - span [] [ - a [ Class( - "nav-link" - + - // add the 'active' class if this is the namespace of the thing being shown - match nsOpt with - | Some ns2 when ns.Name = ns2.Name -> " active" - | _ -> "" - ) - Href(ns.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [ - !!ns.Name - ] - - ] - ] + li + [ Class( + "nav-item" + + + // add the 'active' class if this is the namespace of the thing being shown + match nsOpt with + | Some ns2 when ns.Name = ns2.Name -> " active" + | _ -> "" + ) ] + [ span + [] + [ a + [ Class( + "nav-link" + + + // add the 'active' class if this is the namespace of the thing being shown + match nsOpt with + | Some ns2 when ns.Name = ns2.Name -> " active" + | _ -> "" + ) + Href(ns.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] + [ !!ns.Name ] + + ] ] // In the navigation bar generate the expanded list of entities // for the active namespace match nsOpt with | Some ns2 when ns.Name = ns2.Name -> - ul [ Custom("list-style-type", "none") (* Class "navbar-nav " *) ] [ - for category in allByCategory do - for e in category.CategoryEntites do - li [ Class "nav-item" ] [ - a [ Class "nav-link" - Href(e.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [ - !!e.Name - ] - ] - ] + ul + [ Custom("list-style-type", "none") (* Class "navbar-nav " *) ] + [ for category in allByCategory do + for e in category.CategoryEntites do + li + [ Class "nav-item" ] + [ a + [ Class "nav-link" + Href(e.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] + [ !!e.Name ] ] ] | _ -> () ] let listOfNamespacesNav otherDocs (nsOpt: ApiDocNamespace option) = @@ -695,23 +638,19 @@ type HtmlRender(model: ApiDocModel) = let collection = model.Collection (let content = - div [] [ - h1 [] [ !! "API Reference" ] - h2 [] [ !! "Available Namespaces:" ] - table [ Class "table outer-list fsdocs-member-list" ] [ - thead [] [ - tr [] [ - td [ Class "fsdocs-member-list-header" ] [ - !! "Namespace" - ] - td [ Class "fsdocs-member-list-header" ] [ - !! "Description" - ] - ] - ] - tbody [] (tableOfNamespacesAux ()) - ] - ] + div + [] + [ h1 [] [ !! "API Reference" ] + h2 [] [ !! "Available Namespaces:" ] + table + [ Class "table outer-list fsdocs-member-list" ] + [ thead + [] + [ tr + [] + [ td [ Class "fsdocs-member-list-header" ] [ !! "Namespace" ] + td [ Class "fsdocs-member-list-header" ] [ !! "Description" ] ] ] + tbody [] (tableOfNamespacesAux ()) ] ] let pageTitle = sprintf "%s (API Reference)" collectionName diff --git a/src/FSharp.Formatting.ApiDocs/GenerateMarkdown.fs b/src/FSharp.Formatting.ApiDocs/GenerateMarkdown.fs index f6e014f0a..deaa718ff 100644 --- a/src/FSharp.Formatting.ApiDocs/GenerateMarkdown.fs +++ b/src/FSharp.Formatting.ApiDocs/GenerateMarkdown.fs @@ -59,9 +59,10 @@ type MarkdownRender(model: ApiDocModel) = yield! m.Parameters |> List.collect (fun parameter -> - [ p [ strong [ !!parameter.ParameterNameText ] - !! ": " - embedSafe parameter.ParameterType ] + [ p + [ strong [ !!parameter.ParameterNameText ] + !! ": " + embedSafe parameter.ParameterType ] match parameter.ParameterDocs with | None -> () | Some d -> p [ !!(sprintf ": %s" (htmlStringSafe d)) ] @@ -72,33 +73,32 @@ type MarkdownRender(model: ApiDocModel) = match m.ExtendedType with | None -> () - | Some (_, extendedTypeHtml) -> - p [ !! "Extended Type: " - embedSafe extendedTypeHtml - br ] + | Some (_, extendedTypeHtml) -> p [ !! "Extended Type: "; embedSafe extendedTypeHtml; br ] match m.ReturnInfo.ReturnType with | None -> () | Some (_, returnTypeHtml) -> - p [ !!(if m.Kind <> ApiDocMemberKind.RecordField then - "Returns: " - else - "Field type: ") - embedSafe returnTypeHtml - br - match m.ReturnInfo.ReturnDocs with - | None -> () - | Some r -> - embedSafe r - br ] + p + [ !!(if m.Kind <> ApiDocMemberKind.RecordField then + "Returns: " + else + "Field type: ") + embedSafe returnTypeHtml + br + match m.ReturnInfo.ReturnDocs with + | None -> () + | Some r -> + embedSafe r + br ] if not m.Comment.Exceptions.IsEmpty then for (nm, url, html) in m.Comment.Exceptions do - p [ match url with - | None -> () - | Some href -> link [ !!nm ] href - embed html - br ] + p + [ match url with + | None -> () + | Some href -> link [ !!nm ] href + embed html + br ] for e in m.Comment.Notes do p [ !! "Note" ] @@ -116,32 +116,34 @@ type MarkdownRender(model: ApiDocModel) = let hasModules = entities |> List.exists (fun e -> not e.IsTypeDefinition) table - [ [ p [ !!(if hasTypes && hasModules then - "Type/Module" - elif hasTypes then - "Type" - else - "Modules") ] + [ [ p + [ !!(if hasTypes && hasModules then + "Type/Module" + elif hasTypes then + "Type" + else + "Modules") ] p [ !! "Description" ] p [ !! "Source" ] ] ] [ AlignLeft; AlignLeft; AlignCenter ] [ for e in entities do - [ [ p [ let nm = e.Name - - let multi = (entities |> List.filter (fun e -> e.Name = nm) |> List.length) > 1 - - let nmWithSiffix = - if multi then - (if e.IsTypeDefinition then - nm + " (Type)" - else - nm + " (Module)") - else - nm - - link - [ !!nmWithSiffix ] - (e.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] ] + [ [ p + [ let nm = e.Name + + let multi = (entities |> List.filter (fun e -> e.Name = nm) |> List.length) > 1 + + let nmWithSiffix = + if multi then + (if e.IsTypeDefinition then + nm + " (Type)" + else + nm + " (Module)") + else + nm + + link + [ !!nmWithSiffix ] + (e.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] ] [ p [ embedSafe e.Comment.Summary ] ] [ p [ yield! (sourceLink e.SourceLocation) ] ] ] ] ] @@ -158,29 +160,30 @@ type MarkdownRender(model: ApiDocModel) = | Some m when m.RequiresQualifiedAccess -> m.Name + "." + entity.Name | _ -> entity.Name - [ ``##`` [ !!(usageName - + (if entity.IsTypeDefinition then - " Type" - else - " Module")) ] - p [ !! "Namespace: " - link - [ !!info.Namespace.Name ] - (info.Namespace.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] + [ ``##`` + [ !!(usageName + + (if entity.IsTypeDefinition then + " Type" + else + " Module")) ] + p + [ !! "Namespace: " + link + [ !!info.Namespace.Name ] + (info.Namespace.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] p [ !!("Assembly: " + entity.Assembly.Name + ".dll") ] match info.ParentModule with | None -> () | Some parentModule -> - p [ !! "Parent Module: " - link - [ !!parentModule.Name ] - (parentModule.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] + p + [ !! "Parent Module: " + link + [ !!parentModule.Name ] + (parentModule.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] match entity.AbbreviatedType with - | Some (_, abbreviatedTyp) -> - p [ !! "Abbreviation For: " - embed abbreviatedTyp ] + | Some (_, abbreviatedTyp) -> p [ !! "Abbreviation For: "; embed abbreviatedTyp ] | None -> () match entity.BaseType with @@ -190,18 +193,17 @@ type MarkdownRender(model: ApiDocModel) = match entity.AllInterfaces with | [] -> () | l -> - p [ !! "All Interfaces: " - for (i, (_, interfaceTyHtml)) in Seq.indexed l do - if i <> 0 then !! ", " - embed interfaceTyHtml ] + p + [ !! "All Interfaces: " + for (i, (_, interfaceTyHtml)) in Seq.indexed l do + if i <> 0 then !! ", " + embed interfaceTyHtml ] if entity.Symbol.IsValueType then p [ !!("Kind: Struct") ] match entity.DelegateSignature with - | Some (_, delegateSigHtml) -> - p [ !!("Delegate Signature: ") - embed delegateSigHtml ] + | Some (_, delegateSigHtml) -> p [ !!("Delegate Signature: "); embed delegateSigHtml ] | None -> () if entity.Symbol.IsProvided then @@ -236,8 +238,9 @@ type MarkdownRender(model: ApiDocModel) = // If there is more than 1 category in the type, generate TOC ``###`` [ !! "Table of contents" ] - ul [ for (index, _, name) in byCategory do - [ p [ link [ !!(sprintf "#section%d" index) ] (name) ] ] ] + ul + [ for (index, _, name) in byCategory do + [ p [ link [ !!(sprintf "#section%d" index) ] (name) ] ] ] // @@ -245,12 +248,13 @@ type MarkdownRender(model: ApiDocModel) = if (nestedEntities.Length > 0) then - ``###`` [ !!(if nestedEntities |> List.forall (fun e -> not e.IsTypeDefinition) then - "Nested modules" - elif nestedEntities |> List.forall (fun e -> e.IsTypeDefinition) then - "Types" - else - "Types and nested modules") ] + ``###`` + [ !!(if nestedEntities |> List.forall (fun e -> not e.IsTypeDefinition) then + "Nested modules" + elif nestedEntities |> List.forall (fun e -> e.IsTypeDefinition) then + "Types" + else + "Types and nested modules") ] yield! renderEntities nestedEntities @@ -299,8 +303,9 @@ type MarkdownRender(model: ApiDocModel) = if (allByCategory.Length > 1) then ``###`` [ !! "Contents" ] - ul [ for category in allByCategory do - [ p [ link [ !!category.CategoryName ] ("#category-" + category.CategoryIndex) ] ] ] + ul + [ for category in allByCategory do + [ p [ link [ !!category.CategoryName ] ("#category-" + category.CategoryIndex) ] ] ] for category in allByCategory do if (allByCategory.Length > 1) then @@ -314,10 +319,11 @@ type MarkdownRender(model: ApiDocModel) = // // For non-FSharp.Core we only show one link "API Reference" in the nav menu if otherDocs && nav && model.Collection.CollectionName <> "FSharp.Core" then - p [ !! "API Reference" - link - [ !! "All Namespaces" ] - (model.IndexFileUrl(root, collectionName, qualify, model.FileExtensions.InUrl)) ] + p + [ !! "API Reference" + link + [ !! "All Namespaces" ] + (model.IndexFileUrl(root, collectionName, qualify, model.FileExtensions.InUrl)) ] else let categorise = Categorise.model model @@ -330,26 +336,29 @@ type MarkdownRender(model: ApiDocModel) = for allByCategory, ns in categorise do // Generate the entry for the namespace - p [ link [ !!ns.Name ] (ns.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) + p + [ link [ !!ns.Name ] (ns.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) - // If not in the navigation list then generate the summary text as well - if not nav then - !! " - " + // If not in the navigation list then generate the summary text as well + if not nav then + !! " - " - match ns.NamespaceDocs with - | Some nsdocs -> embed nsdocs.Summary - | None -> () ] + match ns.NamespaceDocs with + | Some nsdocs -> embed nsdocs.Summary + | None -> () ] // In the navigation bar generate the expanded list of entities // for the active namespace if nav then match nsOpt with | Some ns2 when ns.Name = ns2.Name -> - ul [ for category in allByCategory do - for e in category.CategoryEntites do - [ p [ link - [ !!e.Name ] - (e.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] ] ] + ul + [ for category in allByCategory do + for e in category.CategoryEntites do + [ p + [ link + [ !!e.Name ] + (e.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] ] ] | _ -> () ] let listOfNamespaces otherDocs nav (nsOpt: ApiDocNamespace option) = diff --git a/src/FSharp.Formatting.ApiDocs/GenerateModel.fs b/src/FSharp.Formatting.ApiDocs/GenerateModel.fs index 434362853..c727665b1 100644 --- a/src/FSharp.Formatting.ApiDocs/GenerateModel.fs +++ b/src/FSharp.Formatting.ApiDocs/GenerateModel.fs @@ -404,7 +404,7 @@ type ApiDocMember ReturnType = returnType |} // /// The full signature section in a typical tooltip -// member x.SignatureTooltip : ApiDocHtml = signatureTooltip + // member x.SignatureTooltip : ApiDocHtml = signatureTooltip /// The member's parameters and associated documentation member x.Parameters = parameters @@ -595,15 +595,7 @@ type ApiDocEntity /// All members of the type member x.AllMembers: ApiDocMember list = - List.concat [ ctors - inst - stat - cases - fields - statParams - vals - exts - pats ] + List.concat [ ctors; inst; stat; cases; fields; statParams; vals; exts; pats ] /// All interfaces of the type, formatted member x.AllInterfaces: (FSharpType * ApiDocHtml) list = allInterfaces @@ -1192,44 +1184,23 @@ module internal TypeFormatter = if prefix then match args with | [] -> typeName - | [ arg ] -> - span [] [ - typeName - !! "<" - (formatTypeWithPrecAsHtml ctx 4 arg) - !! ">" - ] + | [ arg ] -> span [] [ typeName; !! "<"; (formatTypeWithPrecAsHtml ctx 4 arg); !! ">" ] | args -> bracketHtmlIf (prec <= 1) - (span [] [ - typeName - !! "<" - formatTypesWithPrecAsHtml ctx 2 ", " args - !! ">" - ]) + (span [] [ typeName; !! "<"; formatTypesWithPrecAsHtml ctx 2 ", " args; !! ">" ]) else match args with | [] -> typeName | [ arg ] -> if tcref.DisplayName.StartsWith "[" then - span [] [ - formatTypeWithPrecAsHtml ctx 2 arg - !!tcref.DisplayName - ] + span [] [ formatTypeWithPrecAsHtml ctx 2 arg; !!tcref.DisplayName ] else - span [] [ - formatTypeWithPrecAsHtml ctx 2 arg - !! " " - typeName - ] + span [] [ formatTypeWithPrecAsHtml ctx 2 arg; !! " "; typeName ] | args -> bracketHtmlIf (prec <= 1) - (span [] [ - bracketNonAtomicHtml (formatTypesWithPrecAsHtml ctx 2 ", " args) - typeName - ]) + (span [] [ bracketNonAtomicHtml (formatTypesWithPrecAsHtml ctx 2 ", " args); typeName ]) and formatTypesWithPrecAsHtml ctx prec sep typs = typs |> List.map (formatTypeWithPrecAsHtml ctx prec) |> Html.sepWith sep @@ -1243,23 +1214,11 @@ module internal TypeFormatter = | MeasureProd (MeasureOne, ty) -> formatTypeWithPrecAsHtml ctx prec ty | MeasureProd (ty1, MeasureInv ty2) | MeasureProd (ty1, MeasureProd (MeasureInv ty2, MeasureOne)) -> - span [] [ - formatTypeWithPrecAsHtml ctx 2 ty1 - !! "/" - formatTypeWithPrecAsHtml ctx 2 ty2 - ] + span [] [ formatTypeWithPrecAsHtml ctx 2 ty1; !! "/"; formatTypeWithPrecAsHtml ctx 2 ty2 ] | MeasureProd (ty1, MeasureProd (ty2, MeasureOne)) | MeasureProd (ty1, ty2) -> - span [] [ - formatTypeWithPrecAsHtml ctx 2 ty1 - !! "*" - formatTypeWithPrecAsHtml ctx 2 ty2 - ] - | MeasureInv ty -> - span [] [ - !! "/" - formatTypeWithPrecAsHtml ctx 1 ty - ] + span [] [ formatTypeWithPrecAsHtml ctx 2 ty1; !! "*"; formatTypeWithPrecAsHtml ctx 2 ty2 ] + | MeasureInv ty -> span [] [ !! "/"; formatTypeWithPrecAsHtml ctx 1 ty ] | MeasureOne -> !! "1" | _ when typ.HasTypeDefinition -> let tcref = typ.TypeDefinition @@ -1322,12 +1281,12 @@ module internal TypeFormatter = !!argName let formatArgNameAndTypePairUsageAsHtml ctx (argName0, argType) = - span [] [ - !!(match argName0 with - | None -> "" - | Some argName -> argName + ": ") - formatTypeWithPrecAsHtml ctx 2 argType - ] + span + [] + [ !!(match argName0 with + | None -> "" + | Some argName -> argName + ": ") + formatTypeWithPrecAsHtml ctx 2 argType ] let formatCurriedArgsUsageAsHtml preferNoParens isItemIndexer curriedArgs = let counter = @@ -1486,28 +1445,19 @@ module internal SymbolReader = match v.IsMember, v.IsInstanceMember, v.LogicalName, v.DisplayName, customOpName with // Constructors - | _, _, ".ctor", _, _ -> - span [] [ - !!v.ApparentEnclosingEntity.DisplayName - fullArgUsage - ] + | _, _, ".ctor", _, _ -> span [] [ !!v.ApparentEnclosingEntity.DisplayName; fullArgUsage ] // Indexers - | _, true, _, "Item", _ -> - span [] [ - !! "this.[" - fullArgUsage - !! "]" - ] + | _, true, _, "Item", _ -> span [] [ !! "this.["; fullArgUsage; !! "]" ] // Custom operators | _, _, _, _, Some name -> - span [] [ - !!name - if preferNoParens then - !! " " - fullArgUsage - ] + span + [] + [ !!name + if preferNoParens then + !! " " + fullArgUsage ] // op_XYZ operators | _, false, _, name, _ when PrettyNaming.IsMangledOpName v.CompiledName -> @@ -1520,13 +1470,7 @@ module internal SymbolReader = let right = formatCurriedArgsUsageAsHtml true false [ [ y ] ] - span [] [ - left - !! " " - !!nm - !! " " - right - ] + span [] [ left; !! " "; !!nm; !! " "; right ] // binary operators (curried, like in FSharp.Core.Operators) | [ args1; args2 ] -> @@ -1536,13 +1480,7 @@ module internal SymbolReader = let right = formatCurriedArgsUsageAsHtml true false [ args2 ] - span [] [ - left - !! " " - !!nm - !! " " - right - ] + span [] [ left; !! " "; !!nm; !! " "; right ] // unary operators | [ [ x ] ] -> @@ -1552,48 +1490,48 @@ module internal SymbolReader = span [] [ !!nm; right ] | _ -> - span [] [ - !!name - if preferNoParens then - !! " " - fullArgUsage - ] + span + [] + [ !!name + if preferNoParens then + !! " " + fullArgUsage ] // Ordinary instance members | _, true, _, name, _ -> - span [] [ - !! "this." - !!name - if preferNoParens then - !! " " - fullArgUsage - ] + span + [] + [ !! "this." + !!name + if preferNoParens then + !! " " + fullArgUsage ] // A hack for Array.Parallel.map in FSharp.Core. TODO: generalise this | _, false, _, name, _ when specialCase1 -> - span [] [ - !!("Array.Parallel." + name) - if preferNoParens then - !! " " - fullArgUsage - ] + span + [] + [ !!("Array.Parallel." + name) + if preferNoParens then + !! " " + fullArgUsage ] // Ordinary functions or values | false, _, _, name, _ when not requireQualifiedAccess -> - span [] [ - !!name - if preferNoParens then - !! " " - fullArgUsage - ] + span + [] + [ !!name + if preferNoParens then + !! " " + fullArgUsage ] // Ordinary static members or things (?) that require fully qualified access | _, false, _, name, _ -> - span [] [ - !!(v.ApparentEnclosingEntity.DisplayName + "." + name) - if preferNoParens then !! " " - fullArgUsage - ] + span + [] + [ !!(v.ApparentEnclosingEntity.DisplayName + "." + name) + if preferNoParens then !! " " + fullArgUsage ] let usageHtml = codeHtml usageHtml @@ -1705,13 +1643,7 @@ module internal SymbolReader = let fieldsHtmls = fields |> List.map formatFieldUsage if case.Name = "op_ColonColon" then - span [] [ - fieldsHtmls.[0] - !! " " - !!nm - fieldsHtmls.[1] - ] - |> codeHtml + span [] [ fieldsHtmls.[0]; !! " "; !!nm; fieldsHtmls.[1] ] |> codeHtml else match fieldsHtmls with | [] -> span [] [ !!nm ] @@ -1719,12 +1651,7 @@ module internal SymbolReader = | _ -> let fieldHtml = fieldsHtmls |> Html.sepWith ", " - span [] [ - !!nm - !! "(" - fieldHtml - !! ")" - ] + span [] [ !!nm; !! "("; fieldHtml; !! ")" ] |> codeHtml let paramTypes = @@ -1810,15 +1737,15 @@ module internal SymbolReader = let readFSharpStaticParam (ctx: ReadingContext) (staticParam: FSharpStaticParameter) = let usageHtml = - span [] [ - !!staticParam.Name - !! ": " - formatTypeAsHtml ctx.UrlMap staticParam.Kind - !!(if staticParam.IsOptional then - sprintf " (optional, default = %A)" staticParam.DefaultValue - else - "") - ] + span + [] + [ !!staticParam.Name + !! ": " + formatTypeAsHtml ctx.UrlMap staticParam.Kind + !!(if staticParam.IsOptional then + sprintf " (optional, default = %A)" staticParam.DefaultValue + else + "") ] |> codeHtml let modifiers = List.empty @@ -2755,13 +2682,7 @@ module internal SymbolReader = let rqa = hasAttrib typ.Attributes - let nsdocs = - combineNamespaceDocs [ nsdocs1 - nsdocs2 - nsdocs3 - nsdocs4 - nsdocs5 - nsdocs6 ] + let nsdocs = combineNamespaceDocs [ nsdocs1; nsdocs2; nsdocs3; nsdocs4; nsdocs5; nsdocs6 ] if nsdocs.IsSome then printfn "ignoring namespace summary on nested position" @@ -2827,11 +2748,7 @@ module internal SymbolReader = || (modul.Namespace = Some "Microsoft.FSharp.Core" && modul.DisplayName = "ValueOption") - let nsdocs = - combineNamespaceDocs [ nsdocs1 - nsdocs2 - nsdocs3 - nsdocs4 ] + let nsdocs = combineNamespaceDocs [ nsdocs1; nsdocs2; nsdocs3; nsdocs4 ] if nsdocs.IsSome then printfn "ignoring namespace summary on nested position" @@ -2875,9 +2792,7 @@ module internal SymbolReader = let typs, nsdocs2 = readChildren ctx entities readType (fun x -> not x.IsFSharpModule) - (modifiers @ typs), - combineNamespaceDocs [ nsdocs1 - nsdocs2 ] + (modifiers @ typs), combineNamespaceDocs [ nsdocs1; nsdocs2 ] // ---------------------------------------------------------------------------------------------- // Reading namespace and assembly details @@ -2965,31 +2880,33 @@ module internal SymbolReader = /// Represents an input assembly for API doc generation type ApiDocInput = - { /// The path to the assembly - Path: string + { + /// The path to the assembly + Path: string - /// Override the default XML file (normally assumed to live alongside) - XmlFile: string option + /// Override the default XML file (normally assumed to live alongside) + XmlFile: string option - /// The compile-time source folder - SourceFolder: string option + /// The compile-time source folder + SourceFolder: string option - /// The URL the the source repo where the source code lives - SourceRepo: string option + /// The URL the the source repo where the source code lives + SourceRepo: string option - /// The substitutionss active for this input. If specified these - /// are used instead of the overall substitutions. This allows different parameters (e.g. - /// different authors) for each assembly in a collection. - Substitutions: Substitutions option + /// The substitutionss active for this input. If specified these + /// are used instead of the overall substitutions. This allows different parameters (e.g. + /// different authors) for each assembly in a collection. + Substitutions: Substitutions option - /// Whether the input uses markdown comments - MarkdownComments: bool + /// Whether the input uses markdown comments + MarkdownComments: bool - /// Whether doc processing should warn on missing comments - Warn: bool + /// Whether doc processing should warn on missing comments + Warn: bool - /// Whether to generate only public things - PublicOnly: bool } + /// Whether to generate only public things + PublicOnly: bool + } static member FromFile ( assemblyPath: string, @@ -3184,10 +3101,7 @@ type ApiDocModel internal (substitutions, collection, entityInfos, root, qualify match namespaces.TryGetValue(ns.Name) with | true, (entities, summary, substitutions) -> namespaces.[ns.Name] <- - (entities @ ns.Entities, - combineNamespaceDocs [ ns.NamespaceDocs - summary ], - substitutions) + (entities @ ns.Entities, combineNamespaceDocs [ ns.NamespaceDocs; summary ], substitutions) | false, _ -> namespaces.Add(ns.Name, (ns.Entities, ns.NamespaceDocs, ns.Substitutions)) let namespaces = diff --git a/src/FSharp.Formatting.CodeFormat/CodeFormat.fs b/src/FSharp.Formatting.CodeFormat/CodeFormat.fs index 3c9542c9e..164d57a2e 100644 --- a/src/FSharp.Formatting.CodeFormat/CodeFormat.fs +++ b/src/FSharp.Formatting.CodeFormat/CodeFormat.fs @@ -28,7 +28,7 @@ type FormattedSnippet(key: string, content: string) = /// Represents formatted snippets -type FormattedContent(snippets: FormattedSnippet [], tips: string) = +type FormattedContent(snippets: FormattedSnippet[], tips: string) = /// Returns the processed snippets as an array member x.Snippets = snippets diff --git a/src/FSharp.Formatting.CodeFormat/CodeFormatAgent.fs b/src/FSharp.Formatting.CodeFormat/CodeFormatAgent.fs index 504f75a6d..e406ac000 100644 --- a/src/FSharp.Formatting.CodeFormat/CodeFormatAgent.fs +++ b/src/FSharp.Formatting.CodeFormat/CodeFormatAgent.fs @@ -70,7 +70,7 @@ module private Helpers = /// Use the F# compiler's SourceTokenizer to split a snippet (array of strings) /// into a snippet with token information and line numbers. - let getTokens file defines (lines: string []) : Snippet = + let getTokens file defines (lines: string[]) : Snippet = // Get defined directives let defines = @@ -182,8 +182,8 @@ module CodeFormatter = // Processes a single line of the snippet let processSnippetLine (checkResults: FSharpCheckFileResults) - (semanticRanges: SemanticClassificationItem []) - (lines: string []) + (semanticRanges: SemanticClassificationItem[]) + (lines: string[]) (line: int, lineTokens: SnippetLine) = let lineStr = lines.[line] diff --git a/src/FSharp.Formatting.CodeFormat/CommentFilter.fs b/src/FSharp.Formatting.CodeFormat/CommentFilter.fs index 342f6aeda..b53c7aab7 100644 --- a/src/FSharp.Formatting.CodeFormat/CommentFilter.fs +++ b/src/FSharp.Formatting.CodeFormat/CommentFilter.fs @@ -43,7 +43,7 @@ let rec getSnippets (state: NamedSnippet option) (snippets: NamedSnippet list) (source: IndexedSnippetLine list) - (lines: string []) + (lines: string[]) = match source with | [] -> snippets diff --git a/src/FSharp.Formatting.CodeFormat/HtmlFormatting.fs b/src/FSharp.Formatting.CodeFormat/HtmlFormatting.fs index 2c01b6485..64353b82f 100644 --- a/src/FSharp.Formatting.CodeFormat/HtmlFormatting.fs +++ b/src/FSharp.Formatting.CodeFormat/HtmlFormatting.fs @@ -154,7 +154,7 @@ let rec formatTokenSpans (ctx: FormattingContext) = ctx.Writer.Write(HttpUtility.HtmlEncode(body))) /// Generate HTML with the specified snippets -let formatSnippets (ctx: FormattingContext) (snippets: Snippet []) = +let formatSnippets (ctx: FormattingContext) (snippets: Snippet[]) = [| for (Snippet (key, lines)) in snippets do // Skip empty lines at the beginning and at the end let skipEmptyLines = Seq.skipWhile (fun (Line (_, spans)) -> List.isEmpty spans) >> List.ofSeq @@ -224,7 +224,7 @@ let formatSnippetsAsHtml openLinesTag closeLinesTag tokenKindToCss - (snippets: Snippet []) + (snippets: Snippet[]) = let tipf = ToolTipFormatter prefix diff --git a/src/FSharp.Formatting.CodeFormat/LatexFormatting.fs b/src/FSharp.Formatting.CodeFormat/LatexFormatting.fs index 774f4415f..fecfe6aeb 100644 --- a/src/FSharp.Formatting.CodeFormat/LatexFormatting.fs +++ b/src/FSharp.Formatting.CodeFormat/LatexFormatting.fs @@ -85,7 +85,7 @@ let rec formatTokenSpans (ctx: FormattingContext) = ctx.Writer.Write(latexEncode body)) /// Generate LaTEX with the specified snippets -let formatSnippets (ctx: FormattingContext) (snippets: Snippet []) = +let formatSnippets (ctx: FormattingContext) (snippets: Snippet[]) = [| for (Snippet (key, lines)) in snippets do // Generate snippet to a local StringBuilder let mainStr = StringBuilder() @@ -119,7 +119,7 @@ let formatSnippets (ctx: FormattingContext) (snippets: Snippet []) = /// Format snippets and return LaTEX for
 tags together
 /// (to be added to the end of document)
-let formatSnippetsAsLatex lineNumbers openTag closeTag (snippets: Snippet []) =
+let formatSnippetsAsLatex lineNumbers openTag closeTag (snippets: Snippet[]) =
     let ctx =
         { GenerateLineNumbers = lineNumbers
           Writer = null
diff --git a/src/FSharp.Formatting.CodeFormat/PynbFormatting.fs b/src/FSharp.Formatting.CodeFormat/PynbFormatting.fs
index fa7271be7..b2aa32c11 100644
--- a/src/FSharp.Formatting.CodeFormat/PynbFormatting.fs
+++ b/src/FSharp.Formatting.CodeFormat/PynbFormatting.fs
@@ -9,7 +9,7 @@ open System
 open FSharp.Formatting.CodeFormat
 
 /// Generate Pynb code cell text with the specified snippets
-let formatSnippetsAsPynb (snippets: Snippet []) =
+let formatSnippetsAsPynb (snippets: Snippet[]) =
     [| for (Snippet (key, lines)) in snippets do
            let str =
                [| for (Line (originalLine, _spans)) in lines -> originalLine |]
diff --git a/src/FSharp.Formatting.CodeFormat/SourceParser.fs b/src/FSharp.Formatting.CodeFormat/SourceParser.fs
index d218579ed..0eda9dcf2 100644
--- a/src/FSharp.Formatting.CodeFormat/SourceParser.fs
+++ b/src/FSharp.Formatting.CodeFormat/SourceParser.fs
@@ -130,7 +130,7 @@ type ErrorInfo =
 /// performs type checking (using 'RunTypeCheck') and then creates information
 /// for the formatter (using 'ProcessSourceTokens')
 // [snippet:Async]
-type SourceFile(file, source, lines: string [], ?options, ?defines) =
+type SourceFile(file, source, lines: string[], ?options, ?defines) =
     (*[omit:(construction of interactive checker and compiler options omitted)]*)
 
     // Create an instance of an InteractiveChecker (which does background analysis
diff --git a/src/FSharp.Formatting.CodeFormat/ToolTipReader.fs b/src/FSharp.Formatting.CodeFormat/ToolTipReader.fs
index 68009fee6..3f34b5ac8 100644
--- a/src/FSharp.Formatting.CodeFormat/ToolTipReader.fs
+++ b/src/FSharp.Formatting.CodeFormat/ToolTipReader.fs
@@ -21,7 +21,7 @@ open FSharp.Compiler.Text
 // Implements formatting of tool tips
 // --------------------------------------------------------------------------------------
 
-let linesFromTaggedText (tags: TaggedText []) =
+let linesFromTaggedText (tags: TaggedText[]) =
     seq {
         let content = StringBuilder()
 
@@ -37,7 +37,7 @@ let linesFromTaggedText (tags: TaggedText []) =
     }
 
 /// Turn string into a sequence of lines interleaved with line breaks
-let formatMultilineString (lines: string []) =
+let formatMultilineString (lines: string[]) =
     [ for line in lines do
           yield HardLineBreak
           yield Literal line ]
diff --git a/src/FSharp.Formatting.Common/PynbModel.fs b/src/FSharp.Formatting.Common/PynbModel.fs
index a503a5c1d..0129119f8 100644
--- a/src/FSharp.Formatting.Common/PynbModel.fs
+++ b/src/FSharp.Formatting.Common/PynbModel.fs
@@ -11,7 +11,7 @@ let addLineEnd (s: string) =
     if s.EndsWith("\n") then s else s + "\n"
 
 type OutputData =
-    | OutputData of kind: string * lines: string []
+    | OutputData of kind: string * lines: string[]
     override this.ToString() =
         let (OutputData (kind, lines)) = this
 
@@ -47,8 +47,8 @@ type Cell =
     { cell_type: string
       execution_count: int option
       metadata: string
-      outputs: Output []
-      source: string [] }
+      outputs: Output[]
+      source: string[] }
     static member Default =
         { cell_type = "code"
           execution_count = None
@@ -146,7 +146,7 @@ type Notebook =
     { nbformat: int
       nbformat_minor: int
       metadata: Metadata
-      cells: Cell [] }
+      cells: Cell[] }
     static member Default =
         { nbformat = 4
           nbformat_minor = 1
@@ -171,7 +171,7 @@ type Notebook =
 let internal splitLines (s: string) =
     s.Replace("\r\n", "\n").Split([| '\n' |])
 
-let codeCell (lines: string []) executionCount outputs =
+let codeCell (lines: string[]) executionCount outputs =
     let lines = lines |> Array.collect splitLines |> Array.map addLineEnd
 
     let cell =
@@ -188,7 +188,7 @@ let rawCell (s: string) =
         cell_type = "raw"
         source = splitLines s }
 
-let markdownCell (lines: string []) =
+let markdownCell (lines: string[]) =
     let lines = lines |> Array.collect splitLines |> Array.map addLineEnd
 
     { Cell.Default with
diff --git a/src/FSharp.Formatting.Common/YaafFSharpScripting.fs b/src/FSharp.Formatting.Common/YaafFSharpScripting.fs
index 23c783d67..a0d705f73 100644
--- a/src/FSharp.Formatting.Common/YaafFSharpScripting.fs
+++ b/src/FSharp.Formatting.Common/YaafFSharpScripting.fs
@@ -497,34 +497,36 @@ type internal OptimizationType =
 
 /// See https://msdn.microsoft.com/en-us/library/dd233172.aspx
 type internal FsiOptions =
-    { Checked: bool option
-      Codepage: int option
-      CrossOptimize: bool option
-      Debug: DebugMode option
-      Defines: string list
-      Exec: bool
-      FullPaths: bool
-      Gui: bool option
-      LibDirs: string list
-      Loads: string list
-      NoFramework: bool
-      NoLogo: bool
-      NonInteractive: bool
-      NoWarns: int list
-      Optimize: (bool * OptimizationType list) list
-      Quiet: bool
-      QuotationsDebug: bool
-      ReadLine: bool option
-      References: string list
-      TailCalls: bool option
-      Uses: string list
-      Utf8Output: bool
-      /// Sets a warning level (0 to 5). The default level is 3. Each warning is given a level based on its severity. Level 5 gives more, but less severe, warnings than level 1.
-      /// Level 5 warnings are: 21 (recursive use checked at runtime), 22 (let rec evaluated out of order), 45 (full abstraction), and 52 (defensive copy). All other warnings are level 2.
-      WarnLevel: int option
-      WarnAsError: bool option
-      WarnAsErrorList: (bool * int list) list
-      ScriptArgs: string list }
+    {
+        Checked: bool option
+        Codepage: int option
+        CrossOptimize: bool option
+        Debug: DebugMode option
+        Defines: string list
+        Exec: bool
+        FullPaths: bool
+        Gui: bool option
+        LibDirs: string list
+        Loads: string list
+        NoFramework: bool
+        NoLogo: bool
+        NonInteractive: bool
+        NoWarns: int list
+        Optimize: (bool * OptimizationType list) list
+        Quiet: bool
+        QuotationsDebug: bool
+        ReadLine: bool option
+        References: string list
+        TailCalls: bool option
+        Uses: string list
+        Utf8Output: bool
+        /// Sets a warning level (0 to 5). The default level is 3. Each warning is given a level based on its severity. Level 5 gives more, but less severe, warnings than level 1.
+        /// Level 5 warnings are: 21 (recursive use checked at runtime), 22 (let rec evaluated out of order), 45 (full abstraction), and 52 (defensive copy). All other warnings are level 2.
+        WarnLevel: int option
+        WarnAsError: bool option
+        WarnAsErrorList: (bool * int list) list
+        ScriptArgs: string list
+    }
     static member Empty =
         { Checked = None
           Codepage = None
@@ -820,16 +822,18 @@ module internal Helper =
         let mergedOutStream = new StringWriter(mergedOut) :> TextWriter
 
         let fsiOutWriter =
-            CombineTextWriter.Create [ yield fsiOutStream
-                                       yield mergedOutStream
-                                       if liveFsiWriter.IsSome then
-                                           yield liveFsiWriter.Value ]
+            CombineTextWriter.Create
+                [ yield fsiOutStream
+                  yield mergedOutStream
+                  if liveFsiWriter.IsSome then
+                      yield liveFsiWriter.Value ]
 
         let stdOutWriter =
-            CombineTextWriter.Create [ yield stdOutStream
-                                       yield mergedOutStream
-                                       if liveOutWriter.IsSome then
-                                           yield liveOutWriter.Value ]
+            CombineTextWriter.Create
+                [ yield stdOutStream
+                  yield mergedOutStream
+                  if liveOutWriter.IsSome then
+                      yield liveOutWriter.Value ]
 
         let all = [ globalFsiOut, fsiOut; globalStdOut, stdOut; globalMergedOut, mergedOut ]
 
@@ -907,10 +911,8 @@ type internal FsiSession
                 let defOut = Console.Out
                 let defErr = Console.Error
 
-                (CombineTextWriter.Create [ defOut
-                                            out.StdOutWriter ]),
-                (CombineTextWriter.Create [ defErr
-                                            err.StdOutWriter ])
+                (CombineTextWriter.Create [ defOut; out.StdOutWriter ]),
+                (CombineTextWriter.Create [ defErr; err.StdOutWriter ])
 
         consoleCapture captureOut captureErr f
 
@@ -965,7 +967,7 @@ type internal FsiSession
 
     let evalExpression = save fsiSession.EvalExpressionNonThrowing
 
-    let diagsToString (diags: FSharpDiagnostic []) =
+    let diagsToString (diags: FSharpDiagnostic[]) =
         [ for d in diags -> d.ToString() + Environment.NewLine ] |> String.concat ""
 
     let addDiagsToFsiOutput (o: InteractionOutputs) diags =
diff --git a/src/FSharp.Formatting.Literate/Contexts.fs b/src/FSharp.Formatting.Literate/Contexts.fs
index 95dd17aa4..f9513ffef 100644
--- a/src/FSharp.Formatting.Literate/Contexts.fs
+++ b/src/FSharp.Formatting.Literate/Contexts.fs
@@ -7,17 +7,19 @@ open FSharp.Formatting.Templating
 /// Specifies a context that is passed to functions
 /// that need to use the F# compiler
 type internal CompilerContext =
-    { /// F# interactive evaluator
-      Evaluator: IFsiEvaluator option
+    {
+        /// F# interactive evaluator
+        Evaluator: IFsiEvaluator option
 
-      /// Command line options for the F# compiler
-      CompilerOptions: string option
+        /// Command line options for the F# compiler
+        CompilerOptions: string option
 
-      /// Defined symbols for the F# compiler
-      ConditionalDefines: string list
+        /// Defined symbols for the F# compiler
+        ConditionalDefines: string list
 
-      /// Reporting errors
-      OnError: string -> unit }
+        /// Reporting errors
+        OnError: string -> unit
+    }
 
 /// Defines the possible output types from literate script (HTML, Latex, Pynb)
 []
@@ -46,29 +48,31 @@ type OutputKind =
 
 /// Defines the output of processing a literate doc
 type internal LiterateDocModel =
-    { /// The extracted title of the document (first h1 header if not in front matter)
-      Title: string
+    {
+        /// The extracted title of the document (first h1 header if not in front matter)
+        Title: string
 
-      /// The replacement paramaters
-      Substitutions: Substitutions
+        /// The replacement paramaters
+        Substitutions: Substitutions
 
-      /// The text for search index generation (empty for notebooks and latex)
-      IndexText: string option
+        /// The text for search index generation (empty for notebooks and latex)
+        IndexText: string option
 
-      /// The category in the front matter
-      Category: string option
+        /// The category in the front matter
+        Category: string option
 
-      /// The category index in the front matter (determines the order of categories)
-      CategoryIndex: string option
+        /// The category index in the front matter (determines the order of categories)
+        CategoryIndex: string option
 
-      /// The index in the front matter (Determines the order of files within a category)
-      Index: string option
+        /// The index in the front matter (Determines the order of files within a category)
+        Index: string option
 
-      /// The relative output path
-      OutputPath: string
+        /// The relative output path
+        OutputPath: string
 
-      /// The kind of output generated
-      OutputKind: OutputKind }
+        /// The kind of output generated
+        OutputKind: OutputKind
+    }
 
     // Get the URI for the resource when it is part of an overall site
     // Here 'OutputPath' is assumed to be relative to some 'output' directory.
@@ -85,28 +89,30 @@ type internal LiterateDocModel =
 
 /// Specifies a context that is passed to functions that generate the output
 type internal LiterateProcessingContext =
-    { /// Short prefix code added to all HTML 'id' elements
-      Prefix: string
+    {
+        /// Short prefix code added to all HTML 'id' elements
+        Prefix: string
 
-      /// Additional substitutions to be made in the template file
-      Substitutions: Substitutions
+        /// Additional substitutions to be made in the template file
+        Substitutions: Substitutions
 
-      /// Generate line numbers for F# snippets?
-      GenerateLineNumbers: bool
+        /// Generate line numbers for F# snippets?
+        GenerateLineNumbers: bool
 
-      /// Auto-generate anchors for headers
-      GenerateHeaderAnchors: bool
+        /// Auto-generate anchors for headers
+        GenerateHeaderAnchors: bool
 
-      /// The output format
-      OutputKind: OutputKind
+        /// The output format
+        OutputKind: OutputKind
 
-      /// Helper to resolve URL referenecs in markdown, e.g. 'index.md' --> 'index.html' when doing HTML output
-      MarkdownDirectLinkResolver: string -> string option
+        /// Helper to resolve URL referenecs in markdown, e.g. 'index.md' --> 'index.html' when doing HTML output
+        MarkdownDirectLinkResolver: string -> string option
 
-      /// Helper to resolve `cref:T:TypeName` references in markdown
-      CodeReferenceResolver: string -> (string * string) option
+        /// Helper to resolve `cref:T:TypeName` references in markdown
+        CodeReferenceResolver: string -> (string * string) option
 
-      /// Conditional defines for the processing
-      ConditionalDefines: string list
+        /// Conditional defines for the processing
+        ConditionalDefines: string list
 
-      TokenKindToCss: (TokenKind -> string) option }
+        TokenKindToCss: (TokenKind -> string) option
+    }
diff --git a/src/FSharp.Formatting.Literate/Document.fs b/src/FSharp.Formatting.Literate/Document.fs
index 37a577b8c..958c536f6 100644
--- a/src/FSharp.Formatting.Literate/Document.fs
+++ b/src/FSharp.Formatting.Literate/Document.fs
@@ -20,8 +20,10 @@ type LiterateCodeVisibility =
 
 /// Specifies the options for a literate paragraph
 type LiterateParagraphOptions =
-    { /// Specifies a conditional for inclusion of the snippet paragraph
-      Condition: string option }
+    {
+        /// Specifies a conditional for inclusion of the snippet paragraph
+        Condition: string option
+    }
 
 /// 
 /// Additional properties of a literate code snippet, embedded in a
@@ -29,22 +31,24 @@ type LiterateParagraphOptions =
 /// a snippet be evaluated and formatted.
 /// 
 type LiterateCodeOptions =
-    { /// 
-      /// Specifies whether the snippet is evalauted while processing
-      /// Use (*** do-not-eval ***) command to set this to false
-      /// 
-      Evaluate: bool
+    {
+        /// 
+        /// Specifies whether the snippet is evalauted while processing
+        /// Use (*** do-not-eval ***) command to set this to false
+        /// 
+        Evaluate: bool
 
-      /// Specifies the name of the output produced by this snippet
-      /// Use the (*** define-output:foo ***) command to set this value
-      /// Other outputs are named cell1, cell2 etc.
-      OutputName: string
+        /// Specifies the name of the output produced by this snippet
+        /// Use the (*** define-output:foo ***) command to set this value
+        /// Other outputs are named cell1, cell2 etc.
+        OutputName: string
 
-      /// Indiciates the execution sequence number of the cell if it has been evaluated
-      ExecutionCount: int option
+        /// Indiciates the execution sequence number of the cell if it has been evaluated
+        ExecutionCount: int option
 
-      /// Specifies the visibility of the snippet in the generated HTML
-      Visibility: LiterateCodeVisibility }
+        /// Specifies the visibility of the snippet in the generated HTML
+        Visibility: LiterateCodeVisibility
+    }
 
 /// 
 /// Extends MarkdownParagrap using the MarkdownEmbedParagraphs case with
@@ -111,7 +115,7 @@ type LiterateSource =
     | Markdown of string
 
     /// A parsed F# script file consisting of snippets.
-    | Script of Snippet []
+    | Script of Snippet[]
 
 /// Representation of a literate document - the representation of Paragraphs
 /// uses an F# discriminated union type and so is best used from F#.
@@ -127,7 +131,7 @@ type LiterateDocument(paragraphs, formattedTips, links, source, sourceFile, root
     member _.DefinedLinks: IDictionary> = links
 
     /// Errors
-    member _.Diagnostics: SourceError [] = diagnostics
+    member _.Diagnostics: SourceError[] = diagnostics
 
     /// Original document source code
     member _.Source: LiterateSource = source
diff --git a/src/FSharp.Formatting.Literate/Evaluator.fs b/src/FSharp.Formatting.Literate/Evaluator.fs
index 7d6cdda7e..bf911eefa 100644
--- a/src/FSharp.Formatting.Literate/Evaluator.fs
+++ b/src/FSharp.Formatting.Literate/Evaluator.fs
@@ -162,7 +162,7 @@ type FsiEvaluatorConfig() =
 /// A wrapper for F# interactive service that is used to evaluate inline snippets
 type FsiEvaluator
     (
-        ?options: string [],
+        ?options: string[],
         ?fsiObj: obj,
         ?addHtmlPrinter: bool,
         ?discardStdOut: bool,
diff --git a/src/FSharp.Formatting.Markdown/MarkdownParser.fs b/src/FSharp.Formatting.Markdown/MarkdownParser.fs
index aef3aeb3b..bd541846c 100644
--- a/src/FSharp.Formatting.Markdown/MarkdownParser.fs
+++ b/src/FSharp.Formatting.Markdown/MarkdownParser.fs
@@ -819,7 +819,7 @@ let (|PipeTableBlock|_|) input =
 /// Passed function is used to check whether all parts within grid are valid.
 /// Retuns tuple (position of grid columns, text between grid columns).
 let (|EmacsTableLine|_|)
-    (grid: option)
+    (grid: option)
     (c: char)
     (check: string * MarkdownRange -> bool)
     (line: string, _n: MarkdownRange)
diff --git a/src/FSharp.Formatting.Markdown/MarkdownUtils.fs b/src/FSharp.Formatting.Markdown/MarkdownUtils.fs
index bf6bce603..9e7bf9828 100644
--- a/src/FSharp.Formatting.Markdown/MarkdownUtils.fs
+++ b/src/FSharp.Formatting.Markdown/MarkdownUtils.fs
@@ -71,15 +71,17 @@ module internal MarkdownUtils =
 
     /// Context passed around while formatting
     type FormattingContext =
-        { Links: IDictionary>
-          Newline: string
-          /// Additional replacements to be made in content
-          Substitutions: Substitutions
-          /// Helper to resolve `cref:T:TypeName` references in markdown
-          CodeReferenceResolver: string -> (string * string) option
-          /// Helper to resolve `[foo](file.md)` references in markdown (where file.md is producing file.fsx)
-          MarkdownDirectLinkResolver: string -> string option
-          DefineSymbol: string }
+        {
+            Links: IDictionary>
+            Newline: string
+            /// Additional replacements to be made in content
+            Substitutions: Substitutions
+            /// Helper to resolve `cref:T:TypeName` references in markdown
+            CodeReferenceResolver: string -> (string * string) option
+            /// Helper to resolve `[foo](file.md)` references in markdown (where file.md is producing file.fsx)
+            MarkdownDirectLinkResolver: string -> string option
+            DefineSymbol: string
+        }
 
     /// Format a MarkdownSpan
     let rec formatSpan (ctx: FormattingContext) span =
diff --git a/src/fsdocs-tool/BuildCommand.fs b/src/fsdocs-tool/BuildCommand.fs
index 41845ab88..37cfc114a 100644
--- a/src/fsdocs-tool/BuildCommand.fs
+++ b/src/fsdocs-tool/BuildCommand.fs
@@ -554,18 +554,12 @@ type internal DocContent
         [
           // No categories specified
           if modelsByCategory.Length = 1 && (fst modelsByCategory.[0]) = None then
-              li [ Class "nav-header" ] [
-                  !! "Documentation"
-              ]
+              li [ Class "nav-header" ] [ !! "Documentation" ]
 
               for model in snd modelsByCategory.[0] do
                   let link = model.Uri(root)
 
-                  li [ Class "nav-item" ] [
-                      a [ Class "nav-link"; (Href link) ] [
-                          encode model.Title
-                      ]
-                  ]
+                  li [ Class "nav-item" ] [ a [ Class "nav-link"; (Href link) ] [ encode model.Title ] ]
           else
               // At least one category has been specified. Sort each category by index and emit
               // Use 'Other' as a header for uncategorised things
@@ -588,11 +582,7 @@ type internal DocContent
                   for model in modelsInCategory do
                       let link = model.Uri(root)
 
-                      li [ Class "nav-item" ] [
-                          a [ Class "nav-link"; (Href link) ] [
-                              encode model.Title
-                          ]
-                      ] ]
+                      li [ Class "nav-item" ] [ a [ Class "nav-link"; (Href link) ] [ encode model.Title ] ] ]
         |> List.map (fun html -> html.ToString())
         |> String.concat "             \n"
 
@@ -648,12 +638,13 @@ module Serve =
                 homeFolder = Some rootOutputFolderAsGiven }
 
         let app =
-            choose [ path "/" >=> Redirection.redirect "/index.html"
-                     path "/websocket" >=> handShake socketHandler
-                     Writers.setHeader "Cache-Control" "no-cache, no-store, must-revalidate"
-                     >=> Writers.setHeader "Pragma" "no-cache"
-                     >=> Writers.setHeader "Expires" "0"
-                     >=> Files.browseHome ]
+            choose
+                [ path "/" >=> Redirection.redirect "/index.html"
+                  path "/websocket" >=> handShake socketHandler
+                  Writers.setHeader "Cache-Control" "no-cache, no-store, must-revalidate"
+                  >=> Writers.setHeader "Pragma" "no-cache"
+                  >=> Writers.setHeader "Expires" "0"
+                  >=> Files.browseHome ]
 
         startWebServerAsync serverConfig app |> snd |> Async.Start
 
@@ -1184,10 +1175,11 @@ type CoreBuildOptions(watch) =
                 let navEntries = docContent.GetNavigationEntries(actualDocModels)
 
                 let results =
-                    Map.ofList [ for (thing, _action) in docModels do
-                                     match thing with
-                                     | Some (file, _isOtherLang, model) -> (file, model)
-                                     | None -> () ]
+                    Map.ofList
+                        [ for (thing, _action) in docModels do
+                              match thing with
+                              | Some (file, _isOtherLang, model) -> (file, model)
+                              | None -> () ]
 
                 latestDocContentResults <- results
                 latestDocContentSearchIndexEntries <- extrasForSearchIndex
@@ -1317,7 +1309,7 @@ type CoreBuildOptions(watch) =
 
             let docsDependenciesChanged = Event<_>()
 
-            docsDependenciesChanged.Publish.Add (fun () ->
+            docsDependenciesChanged.Publish.Add(fun () ->
                 if not docsQueued then
                     docsQueued <- true
                     printfn "Detected change in '%s', scheduling rebuild of docs..." this.input
@@ -1338,7 +1330,7 @@ type CoreBuildOptions(watch) =
 
             let apiDocsDependenciesChanged = Event<_>()
 
-            apiDocsDependenciesChanged.Publish.Add (fun () ->
+            apiDocsDependenciesChanged.Publish.Add(fun () ->
                 if not generateQueued then
                     generateQueued <- true
                     printfn "Detected change in built outputs, scheduling rebuild of API docs..."
@@ -1369,7 +1361,7 @@ type CoreBuildOptions(watch) =
                 templateWatcher.Filter <- "_template.html"
                 templateWatcher.NotifyFilter <- NotifyFilters.LastWrite
 
-                templateWatcher.Changed.Add (fun _ ->
+                templateWatcher.Changed.Add(fun _ ->
                     docsDependenciesChanged.Trigger()
                     apiDocsDependenciesChanged.Trigger())
 
diff --git a/tests/FSharp.ApiDocs.Tests/files/FsLib1/Library1.fs b/tests/FSharp.ApiDocs.Tests/files/FsLib1/Library1.fs
index 11c334988..859c3d722 100644
--- a/tests/FSharp.ApiDocs.Tests/files/FsLib1/Library1.fs
+++ b/tests/FSharp.ApiDocs.Tests/files/FsLib1/Library1.fs
@@ -11,10 +11,12 @@ type Union =
 
 /// Record sample
 type Record =
-    { /// This is name
-      Name: string
-      /// This is age
-      Age: int }
+    {
+        /// This is name
+        Name: string
+        /// This is age
+        Age: int
+    }
     /// Additional members
     member x.Foo = 0
     member x.Foo2() = 0
diff --git a/tests/FSharp.ApiDocs.Tests/files/TestLib1/Library1.fs b/tests/FSharp.ApiDocs.Tests/files/TestLib1/Library1.fs
index b3e16018c..ff20ca9f9 100644
--- a/tests/FSharp.ApiDocs.Tests/files/TestLib1/Library1.fs
+++ b/tests/FSharp.ApiDocs.Tests/files/TestLib1/Library1.fs
@@ -18,10 +18,12 @@ type Union =
 /// Record sample
 /// 
 type Record =
-    { /// This is name
-      Name: string
-      /// This is age
-      Age: int }
+    {
+        /// This is name
+        Name: string
+        /// This is age
+        Age: int
+    }
     /// Additional member
     member x.Foo = 0
 
diff --git a/tests/FSharp.Literate.Tests/EvalTests.fs b/tests/FSharp.Literate.Tests/EvalTests.fs
index 4bea4d908..795d1cfef 100644
--- a/tests/FSharp.Literate.Tests/EvalTests.fs
+++ b/tests/FSharp.Literate.Tests/EvalTests.fs
@@ -150,7 +150,7 @@ let test = [1;2;3]
     // Create evaluator & register simple formatter for lists
     let fsiEvaluator = FSharp.Formatting.Literate.Evaluation.FsiEvaluator()
 
-    fsiEvaluator.RegisterTransformation (fun (o, ty, _executionCount) ->
+    fsiEvaluator.RegisterTransformation(fun (o, ty, _executionCount) ->
         if ty.IsGenericType && ty.GetGenericTypeDefinition() = typedefof> then
             let items = [ for it in Seq.cast (unbox o) -> [ Paragraph([ Literal(it.ToString(), None) ], None) ] ]
 
diff --git a/tests/FSharp.Markdown.Tests/Externals.fs b/tests/FSharp.Markdown.Tests/Externals.fs
index bb2ca4834..301981334 100644
--- a/tests/FSharp.Markdown.Tests/Externals.fs
+++ b/tests/FSharp.Markdown.Tests/Externals.fs
@@ -33,7 +33,8 @@ let removeWhitespace (s: string) =
     s
 
 let failingTests =
-    set [ "Auto_links.text"
+    set
+        [ "Auto_links.text"
           "Inline_HTML_comments.text"
           "Ordered_and_unordered_lists.text"
           "markdown-readme.text"
diff --git a/tests/FSharp.Markdown.Tests/Markdown.fs b/tests/FSharp.Markdown.Tests/Markdown.fs
index 2272a1b5b..416fe31a7 100644
--- a/tests/FSharp.Markdown.Tests/Markdown.fs
+++ b/tests/FSharp.Markdown.Tests/Markdown.fs
@@ -37,23 +37,24 @@ let ``Inline HTML tag containing 'at' is not turned into hyperlink`` () =
     let doc = """hi""" |> Markdown.Parse
 
     doc.Paragraphs
-    |> shouldEqual [ Paragraph(
-                         [ Literal(
-                               """hi""",
-                               Some(
-                                   { StartLine = 1
-                                     StartColumn = 0
-                                     EndLine = 1
-                                     EndColumn = 29 }
-                               )
-                           ) ],
-                         Some(
-                             { StartLine = 1
-                               StartColumn = 0
-                               EndLine = 1
-                               EndColumn = 29 }
-                         )
-                     ) ]
+    |> shouldEqual
+        [ Paragraph(
+              [ Literal(
+                    """hi""",
+                    Some(
+                        { StartLine = 1
+                          StartColumn = 0
+                          EndLine = 1
+                          EndColumn = 29 }
+                    )
+                ) ],
+              Some(
+                  { StartLine = 1
+                    StartColumn = 0
+                    EndLine = 1
+                    EndColumn = 29 }
+              )
+          ) ]
 
 []
 let ``Encode '<' and '>' characters as HTML entities`` () =
@@ -71,41 +72,42 @@ Some more"""
         |> Markdown.Parse
 
     doc.Paragraphs
-    |> shouldEqual [ Heading(
-                         2,
-                         [ Literal(
-                               "Hello F#",
-                               Some(
-                                   { StartLine = 2
-                                     StartColumn = 3
-                                     EndLine = 2
-                                     EndColumn = 11 }
-                               )
-                           ) ],
-                         Some(
-                             { StartLine = 2
-                               StartColumn = 0
-                               EndLine = 2
-                               EndColumn = 11 }
-                         )
-                     )
-                     Paragraph(
-                         [ Literal(
-                               "Some more",
-                               Some(
-                                   { StartLine = 3
-                                     StartColumn = 0
-                                     EndLine = 3
-                                     EndColumn = 9 }
-                               )
-                           ) ],
-                         Some(
-                             { StartLine = 3
-                               StartColumn = 0
-                               EndLine = 3
-                               EndColumn = 9 }
-                         )
-                     ) ]
+    |> shouldEqual
+        [ Heading(
+              2,
+              [ Literal(
+                    "Hello F#",
+                    Some(
+                        { StartLine = 2
+                          StartColumn = 3
+                          EndLine = 2
+                          EndColumn = 11 }
+                    )
+                ) ],
+              Some(
+                  { StartLine = 2
+                    StartColumn = 0
+                    EndLine = 2
+                    EndColumn = 11 }
+              )
+          )
+          Paragraph(
+              [ Literal(
+                    "Some more",
+                    Some(
+                        { StartLine = 3
+                          StartColumn = 0
+                          EndLine = 3
+                          EndColumn = 9 }
+                    )
+                ) ],
+              Some(
+                  { StartLine = 3
+                    StartColumn = 0
+                    EndLine = 3
+                    EndColumn = 9 }
+              )
+          ) ]
 
 []
 let ``Headings ending with spaces followed by # are parsed correctly`` () =
@@ -116,41 +118,42 @@ Some more"""
         |> Markdown.Parse
 
     doc.Paragraphs
-    |> shouldEqual [ Heading(
-                         2,
-                         [ Literal(
-                               "Hello",
-                               Some(
-                                   { StartLine = 2
-                                     StartColumn = 3
-                                     EndLine = 2
-                                     EndColumn = 8 }
-                               )
-                           ) ],
-                         Some(
-                             { StartLine = 2
-                               StartColumn = 0
-                               EndLine = 2
-                               EndColumn = 13 }
-                         )
-                     )
-                     Paragraph(
-                         [ Literal(
-                               "Some more",
-                               Some(
-                                   { StartLine = 3
-                                     StartColumn = 0
-                                     EndLine = 3
-                                     EndColumn = 9 }
-                               )
-                           ) ],
-                         Some(
-                             { StartLine = 3
-                               StartColumn = 0
-                               EndLine = 3
-                               EndColumn = 9 }
-                         )
-                     ) ]
+    |> shouldEqual
+        [ Heading(
+              2,
+              [ Literal(
+                    "Hello",
+                    Some(
+                        { StartLine = 2
+                          StartColumn = 3
+                          EndLine = 2
+                          EndColumn = 8 }
+                    )
+                ) ],
+              Some(
+                  { StartLine = 2
+                    StartColumn = 0
+                    EndLine = 2
+                    EndColumn = 13 }
+              )
+          )
+          Paragraph(
+              [ Literal(
+                    "Some more",
+                    Some(
+                        { StartLine = 3
+                          StartColumn = 0
+                          EndLine = 3
+                          EndColumn = 9 }
+                    )
+                ) ],
+              Some(
+                  { StartLine = 3
+                    StartColumn = 0
+                    EndLine = 3
+                    EndColumn = 9 }
+              )
+          ) ]
 
 []
 let ``Should be able to create nested list item with two paragraphs`` () =
@@ -579,51 +582,52 @@ let ``Transform horizontal rules correctly`` () =
     let expected = "
\r\n
\r\n
\r\n
\r\n
\r\n" |> properNewLines Markdown.Parse(doc).Paragraphs - |> shouldEqual [ HorizontalRule( - '*', - Some( - { StartLine = 1 - StartColumn = 0 - EndLine = 1 - EndColumn = 5 } - ) - ) - HorizontalRule( - '*', - Some( - { StartLine = 3 - StartColumn = 0 - EndLine = 3 - EndColumn = 3 } - ) - ) - HorizontalRule( - '*', - Some( - { StartLine = 5 - StartColumn = 0 - EndLine = 5 - EndColumn = 5 } - ) - ) - HorizontalRule( - '-', - Some( - { StartLine = 7 - StartColumn = 0 - EndLine = 7 - EndColumn = 5 } - ) - ) - HorizontalRule( - '-', - Some( - { StartLine = 9 - StartColumn = 0 - EndLine = 9 - EndColumn = 39 } - ) - ) ] + |> shouldEqual + [ HorizontalRule( + '*', + Some( + { StartLine = 1 + StartColumn = 0 + EndLine = 1 + EndColumn = 5 } + ) + ) + HorizontalRule( + '*', + Some( + { StartLine = 3 + StartColumn = 0 + EndLine = 3 + EndColumn = 3 } + ) + ) + HorizontalRule( + '*', + Some( + { StartLine = 5 + StartColumn = 0 + EndLine = 5 + EndColumn = 5 } + ) + ) + HorizontalRule( + '-', + Some( + { StartLine = 7 + StartColumn = 0 + EndLine = 7 + EndColumn = 5 } + ) + ) + HorizontalRule( + '-', + Some( + { StartLine = 9 + StartColumn = 0 + EndLine = 9 + EndColumn = 39 } + ) + ) ] Markdown.ToHtml doc |> shouldEqual expected