Skip to content

Update packages #768

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

Merged
merged 3 commits into from
Aug 30, 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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fake-cli": {
"version": "5.22.0",
"version": "5.23.0",
"commands": [
"fake"
]
Expand All @@ -15,7 +15,7 @@
]
},
"fantomas": {
"version": "5.0.0-alpha-008",
"version": "5.0.0-beta-008",
"commands": [
"fantomas"
]
Expand Down
5 changes: 5 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 16.1.0

* Update to .NET 6.0.400
* Update to Ionide.ProjInfo 0.60

## 16.0.4

* [Fix indexers in output](https://github.com/fsprojects/FSharp.Formatting/pull/767)
Expand Down
9 changes: 2 additions & 7 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ Target.create "AssemblyInfo" (fun _ ->
Target.create "Clean" (fun _ ->
!!artifactsDir ++ "temp" |> Shell.cleanDirs
// in case the above pattern is empty as it only matches existing stuff
[ "bin"; "temp"; "tests/bin" ]
|> Seq.iter Directory.ensure)
[ "bin"; "temp"; "tests/bin" ] |> Seq.iter Directory.ensure)

// Build library
// --------------------------------------------------------------------------------------
Expand Down Expand Up @@ -128,11 +127,7 @@ Target.create "GenerateDocs" (fun _ ->

CreateProcess.fromRawCommand
(artifactsDir @@ "fsdocs")
[ "build"
"--strict"
"--clean"
"--properties"
"Configuration=Release" ]
[ "build"; "--strict"; "--clean"; "--properties"; "Configuration=Release" ]
|> CreateProcess.ensureExitCode
|> Proc.run
|> ignore
Expand Down
5 changes: 1 addition & 4 deletions docs/sidebyside/sidescript.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ a sample snippet.

/// The Hello World of functional languages!
let rec factorial x =
if x = 0 then
1
else
x * (factorial (x - 1))
if x = 0 then 1 else x * (factorial (x - 1))

let f10 = factorial 10

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.203",
"version": "6.0.400",
"rollForward": "minor"
}
}
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ framework: auto-detect
storage: none

nuget FSharp.Core >= 4.7 lowest_matching:true
nuget FSharp.Compiler.Service 41.0.4
nuget FSharp.Compiler.Service 41.0.5
nuget CommandLineParser ~> 2.8
nuget Microsoft.Build.Framework
nuget Microsoft.Build.Tasks.Core
Expand Down
386 changes: 194 additions & 192 deletions paket.lock

Large diffs are not rendered by default.

62 changes: 23 additions & 39 deletions src/Common/StringParsing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ open FSharp.Formatting.Markdown
module String =
/// Matches when a string is a whitespace or null
let (|WhiteSpace|_|) (s) =
if String.IsNullOrWhiteSpace(s) then
Some()
else
None
if String.IsNullOrWhiteSpace(s) then Some() else None

/// Returns a string trimmed from both start and end
let (|TrimBoth|) (text: string) = text.Trim()
Expand All @@ -42,9 +39,11 @@ module String =
/// Matches when a string starts with the given value and ends
/// with a given value (and returns the rest of it)
let (|StartsAndEndsWith|_|) (starts: string, ends: string) (s: string) =
if s.StartsWith(starts)
&& s.EndsWith(ends)
&& s.Length >= starts.Length + ends.Length then
if
s.StartsWith(starts)
&& s.EndsWith(ends)
&& s.Length >= starts.Length + ends.Length
then
Some(s.Substring(starts.Length, s.Length - starts.Length - ends.Length))
else
None
Expand Down Expand Up @@ -119,10 +118,7 @@ module String =
module StringPosition =
/// Matches when a string is a whitespace or null
let (|WhiteSpace|_|) (s, _n: MarkdownRange) =
if String.IsNullOrWhiteSpace(s) then
Some()
else
None
if String.IsNullOrWhiteSpace(s) then Some() else None

/// Matches when a string does starts with non-whitespace
let (|Unindented|_|) (s: string, _n: MarkdownRange) =
Expand Down Expand Up @@ -163,11 +159,7 @@ module StringPosition =
let len = text.Length - trimmed.Length

len,
text.Substring(0, len).Replace(
"\t",
" "
)
.Length,
text.Substring(0, len).Replace("\t", " ").Length,
(trimmed, { n with StartColumn = n.StartColumn + text.Length - trimmed.Length })

/// Matches when a string starts with any of the specified sub-strings
Expand Down Expand Up @@ -213,9 +205,7 @@ module StringPosition =
Some(
startNum,
beforeStart.Length,
text
.Substring(beforeStart.Length + (start.Length * startNum))
.Trim()
text.Substring(beforeStart.Length + (start.Length * startNum)).Trim()
)
else
None
Expand All @@ -225,9 +215,11 @@ module StringPosition =
/// Matches when a string starts with the given value and ends
/// with a given value (and returns the rest of it)
let (|StartsAndEndsWith|_|) (starts: string, ends: string) (s: string, n: MarkdownRange) =
if s.StartsWith(starts)
&& s.EndsWith(ends)
&& s.Length >= starts.Length + ends.Length then
if
s.StartsWith(starts)
&& s.EndsWith(ends)
&& s.Length >= starts.Length + ends.Length
then
Some(
s.Substring(starts.Length, s.Length - starts.Length - ends.Length),
{ n with
Expand All @@ -252,12 +244,9 @@ module StringPosition =
///
let (|StartsWithRepeated|_|) (repeated: string) (text: string, ln: MarkdownRange) =
let rec loop i =
if i = text.Length then
i
elif text.[i] <> repeated.[i % repeated.Length] then
i
else
loop (i + 1)
if i = text.Length then i
elif text.[i] <> repeated.[i % repeated.Length] then i
else loop (i + 1)

let n = loop 0

Expand Down Expand Up @@ -305,10 +294,7 @@ module List =

/// Matches a list if it starts with a sub-list. Returns the list.
let inline (|StartsWith|_|) startl input =
if List.startsWith startl input then
Some input
else
None
if List.startsWith startl input then Some input else None

/// Matches a list if it starts with a sub-list that is delimited
/// using the specified delimiter. Returns a wrapped list and the rest.
Expand Down Expand Up @@ -354,9 +340,10 @@ module Lines =
/// either empty (or whitespace) or start with the specified string.
/// Returns all such lines from the beginning until a different line.
let (|TakeStartingWithOrBlank|_|) (start: string) (input: string list) =
match input
|> List.partitionWhile (fun s -> String.IsNullOrWhiteSpace s || s.StartsWith(start))
with
match
input
|> List.partitionWhile (fun s -> String.IsNullOrWhiteSpace s || s.StartsWith(start))
with
| matching, rest when matching <> [] -> Some(matching, rest)
| _ -> None

Expand Down Expand Up @@ -431,10 +418,7 @@ let (|ParseCommands|_|) (str: string) =
kvs
|> Seq.forall (fst >> Seq.forall (fun c -> Char.IsLetter c || c = '_' || c = '-'))

if allKeysValid && kvs <> [] then
Some(dict kvs)
else
None
if allKeysValid && kvs <> [] then Some(dict kvs) else None

/// Utility for parsing commands - this deals with a single command.
/// The key of the command should be identifier with just
Expand Down
5 changes: 1 addition & 4 deletions src/FSharp.Formatting.ApiDocs/Categorise.fs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ let entities (nsIndex: int, ns: ApiDocNamespace, suppress) =
(e.Symbol.DisplayName.ToLowerInvariant(),
e.Symbol.GenericParameters.Count,
e.Name,
(if e.IsTypeDefinition then
e.UrlBaseName
else
"ZZZ")))
(if e.IsTypeDefinition then e.UrlBaseName else "ZZZ")))

if categoryEntities.Length > 0 then
yield
Expand Down
25 changes: 10 additions & 15 deletions src/FSharp.Formatting.ApiDocs/GenerateHtml.fs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ type HtmlRender(model: ApiDocModel, ?menuTemplateFolder: string) =
h5 [ Class "fsdocs-example-header" ] [ !! "Example" ]

p
[ Class "fsdocs-example"; if e.Id.IsSome then Id e.Id.Value ]
[ Class "fsdocs-example"
if e.Id.IsSome then
Id e.Id.Value ]
[ embed e ]

//if m.IsObsolete then
Expand All @@ -284,12 +286,9 @@ type HtmlRender(model: ApiDocModel, ?menuTemplateFolder: string) =
[]
[ td
[]
[ !!(if hasTypes && hasModules then
"Type/Module"
elif hasTypes then
"Type"
else
"Modules") ]
[ !!(if hasTypes && hasModules then "Type/Module"
elif hasTypes then "Type"
else "Modules") ]
td [] [ !! "Description" ] ] ]
tbody
[]
Expand Down Expand Up @@ -349,13 +348,7 @@ type HtmlRender(model: ApiDocModel, ?menuTemplateFolder: string) =
| Some m when m.RequiresQualifiedAccess -> m.Name + "." + entity.Name
| _ -> entity.Name

[ h2
[]
[ !!(usageName
+ (if entity.IsTypeDefinition then
" Type"
else
" Module")) ]
[ h2 [] [ !!(usageName + (if entity.IsTypeDefinition then " Type" else " Module")) ]
dl
[ Class "fsdocs-metadata" ]
[ dt
Expand Down Expand Up @@ -393,7 +386,9 @@ type HtmlRender(model: ApiDocModel, ?menuTemplateFolder: string) =
[]
[ !!("All Interfaces: ")
for (i, (_, ityHtml)) in Seq.indexed l do
if i <> 0 then !! ", "
if i <> 0 then
!! ", "

embed ityHtml ]

if entity.Symbol.IsValueType then
Expand Down
24 changes: 8 additions & 16 deletions src/FSharp.Formatting.ApiDocs/GenerateMarkdown.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ let urlEncode (x: string) = HttpUtility.UrlEncode x
let htmlString (x: ApiDocHtml) = (x.HtmlText.Trim())

let htmlStringSafe (x: ApiDocHtml) =
(x.HtmlText.Trim())
.Replace("\n", "<br />")
.Replace("|", "&#124;")
(x.HtmlText.Trim()).Replace("\n", "<br />").Replace("|", "&#124;")

let embed (x: ApiDocHtml) = !!(htmlString x)
let embedSafe (x: ApiDocHtml) = !!(htmlStringSafe x)
Expand Down Expand Up @@ -118,12 +116,9 @@ type MarkdownRender(model: ApiDocModel, ?menuTemplateFolder: string) =

table
[ [ p
[ !!(if hasTypes && hasModules then
"Type/Module"
elif hasTypes then
"Type"
else
"Modules") ]
[ !!(if hasTypes && hasModules then "Type/Module"
elif hasTypes then "Type"
else "Modules") ]
p [ !! "Description" ]
p [ !! "Source" ] ] ]
[ AlignLeft; AlignLeft; AlignCenter ]
Expand Down Expand Up @@ -161,12 +156,7 @@ type MarkdownRender(model: ApiDocModel, ?menuTemplateFolder: string) =
| Some m when m.RequiresQualifiedAccess -> m.Name + "." + entity.Name
| _ -> entity.Name

[ ``##``
[ !!(usageName
+ (if entity.IsTypeDefinition then
" Type"
else
" Module")) ]
[ ``##`` [ !!(usageName + (if entity.IsTypeDefinition then " Type" else " Module")) ]
p
[ !! "Namespace: "
link
Expand Down Expand Up @@ -197,7 +187,9 @@ type MarkdownRender(model: ApiDocModel, ?menuTemplateFolder: string) =
p
[ !! "All Interfaces: "
for (i, (_, interfaceTyHtml)) in Seq.indexed l do
if i <> 0 then !! ", "
if i <> 0 then
!! ", "

embed interfaceTyHtml ]

if entity.Symbol.IsValueType then
Expand Down
Loading