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

Fix problem with doc scripts #751

Merged
merged 3 commits into from
Jun 7, 2022
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 .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"fantomas": {
"version": "5.0.0-alpha-007",
"version": "5.0.0-alpha-008",
"commands": [
"fantomas"
]
Expand Down
2 changes: 2 additions & 0 deletions .fantomasignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docs/*.fsx
paket-files/
4 changes: 2 additions & 2 deletions docs/apidocs.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ index: 5
(*** condition: fsx ***)
#if FSX
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // IPYNB

(*** hide ***)
let root = "C:\\"
Expand Down
4 changes: 2 additions & 2 deletions docs/codeformat.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ index: 1
(*** condition: fsx ***)
#if FSX
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // IPYNB

(**
[![Binder](img/badge-binder.svg)](https://mybinder.org/v2/gh/fsprojects/fsharp.formatting/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
Expand Down
4 changes: 2 additions & 2 deletions docs/content.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ index: 3
(*** condition: fsx ***)
#if FSX
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // IPYNB


(**
Expand Down
4 changes: 2 additions & 2 deletions docs/evaluation.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ index: 6
(*** condition: fsx ***)
#if FSX
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // IPYNB

(**
[![Binder](img/badge-binder.svg)](https://mybinder.org/v2/gh/fsprojects/fsharp.formatting/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
Expand Down
4 changes: 2 additions & 2 deletions docs/literate.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ index: 3
(*** condition: fsx ***)
#if FSX
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // IPYNB


(**
Expand Down
4 changes: 2 additions & 2 deletions docs/markdown.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ index: 2
(*** condition: fsx ***)
#if FSX
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: FSharp.Formatting,{{fsdocs-package-version}}"
#endif
#endif // IPYNB


(**
Expand Down
28 changes: 12 additions & 16 deletions src/FSharp.Formatting.ApiDocs/GenerateModel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,8 @@ module internal CrossReferences =
| "" ->
try
defaultArg (Option.map (sprintf "T:%s") typ.TryFullName) ""
with
| _ -> ""
with _ ->
""
| n -> n

let getMemberXmlDocsSigPrefix (memb: FSharpMemberOrFunctionOrValue) =
Expand Down Expand Up @@ -784,8 +784,7 @@ module internal CrossReferences =
""

sprintf "%s%s%s" name typeArgs paramList
with
| exn ->
with exn ->
printfn "Error while building fsdocs-member-name for %s because: %s" memb.FullName exn.Message
Log.verbf "Full Exception details of previous message: %O" exn
memb.CompiledName
Expand Down Expand Up @@ -1603,8 +1602,8 @@ module internal SymbolReader =
v.ApparentEnclosingEntity,
formatTyconRefAsHtml ctx.UrlMap v.ApparentEnclosingEntity |> codeHtml
)
with
| _ -> None
with _ ->
None
else
None

Expand Down Expand Up @@ -2387,8 +2386,8 @@ module internal SymbolReader =
| Let "1000" (idx, _) ->
(try
int idx
with
| _ -> Int32.MaxValue)
with _ ->
Int32.MaxValue)

let exclude =
match cmds with
Expand All @@ -2398,26 +2397,23 @@ module internal SymbolReader =

try
Some(f cat catindex exclude cmds comment, nsdocs)
with
| e ->
with e ->
let name =
try
sym.FullName
with
| _ ->
with _ ->
try
sym.DisplayName
with
| _ ->
with _ ->
let part =
try
let ass = sym.Assembly

match ass.FileName with
| Some file -> file
| None -> ass.QualifiedName
with
| _ -> "unknown"
with _ ->
"unknown"

sprintf "unknown, part of %s" part

Expand Down
4 changes: 2 additions & 2 deletions src/FSharp.Formatting.CodeFormat/Pervasive.fs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ type FSharpChecker with
let! worker = Async.StartChild(parseAndCheckFile, 2000)
let! result = worker
return Ready result
with
| :? TimeoutException -> return StillRunning parseAndCheckFile
with :? TimeoutException ->
return StillRunning parseAndCheckFile
}

let bindParsedInput (results: (FSharpParseFileResults * FSharpCheckFileResults) option) =
Expand Down
4 changes: 2 additions & 2 deletions src/FSharp.Formatting.Common/Templating.fs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ module internal SimpleTemplating =
let path = Path.GetFullPath(outputFile) |> Path.GetDirectoryName

Directory.CreateDirectory(path) |> ignore
with
| _ -> ()
with _ ->
()

File.WriteAllText(outputFile, outputText)
6 changes: 2 additions & 4 deletions src/FSharp.Formatting.Common/YaafFSharpScripting.fs
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,7 @@ type internal FsiSession

saveOutput () |> ignore
session)
with
| e ->
with e ->
let err, out, _ = getMessages ()

raise
Expand All @@ -943,8 +942,7 @@ type internal FsiSession
redirectOut (fun () ->
let res = f text
saveOutput (), res)
with
| e ->
with e ->
let err, out, inp = getMessages ()

raise
Expand Down
27 changes: 13 additions & 14 deletions src/FSharp.Formatting.Literate/Evaluator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ module __FsiSettings =
if depth > 20 then
try
sprintf "%A" v
with
| e -> e.ToString()
with e ->
e.ToString()
else
plainTextPrinters
// Try to find a printer or print transformer
Expand All @@ -387,21 +387,21 @@ module __FsiSettings =
| Choice1Of2 addedPrinter ->
try
addedPrinter v
with
| _ -> None
with _ ->
None
| Choice2Of2 addedPrintTransformer ->
(try
addedPrintTransformer v
with
| _ -> None)
with _ ->
None)
|> Option.map (plainTextPrint (depth + 1)))
|> function
| None ->
// no printer found
try
sprintf "%A" v
with
| e -> e.ToString()
with e ->
e.ToString()
| Some t -> t

let rec tryHtmlPrint depth (v: obj) =
Expand All @@ -415,13 +415,13 @@ module __FsiSettings =
| Choice1Of2 addedPrinter ->
try
addedPrinter v
with
| _ -> None
with _ ->
None
| Choice2Of2 addedPrintTransformer ->
(try
addedPrintTransformer v
with
| _ -> None)
with _ ->
None)
|> Option.bind (tryHtmlPrint (depth + 1)))

/// Registered transformations for pretty printing values
Expand Down Expand Up @@ -555,8 +555,7 @@ module __FsiSettings =
Result = value
ItValue = itvalue }
:> IFsiEvaluationResult)
with
| :? FsiEvaluationException as e ->
with :? FsiEvaluationException as e ->
evalFailed.Trigger
{ File = file
AsExpression = asExpression
Expand Down
Loading