diff --git a/src/Common/Collections.fs b/src/Common/Collections.fs index 406c0c55..d80545ef 100644 --- a/src/Common/Collections.fs +++ b/src/Common/Collections.fs @@ -49,7 +49,7 @@ module internal List = f x g () iterInterleaved f g (y :: tl) - | [x] -> f x + | [ x ] -> f x | [] -> () /// Tests whether a list starts with the elements of another diff --git a/src/Common/StringParsing.fs b/src/Common/StringParsing.fs index af37930b..9ce65ee7 100644 --- a/src/Common/StringParsing.fs +++ b/src/Common/StringParsing.fs @@ -17,7 +17,10 @@ module String = /// Matches when a string is a whitespace or null [] let (|WhiteSpace|_|) (s) = - if String.IsNullOrWhiteSpace(s) then ValueSome() else ValueNone + if String.IsNullOrWhiteSpace(s) then + ValueSome() + else + ValueNone /// Returns a string trimmed from both start and end let (|TrimBoth|) (text: string) = text.Trim() @@ -118,12 +121,15 @@ module String = module StringPosition = /// Matches when a string is a whitespace or null - [] + [] let (|WhiteSpace|_|) (s, _n: MarkdownRange) = - if String.IsNullOrWhiteSpace(s) then ValueSome() else ValueNone + if String.IsNullOrWhiteSpace(s) then + ValueSome() + else + ValueNone /// Matches when a string does starts with non-whitespace - [] + [] let (|Unindented|_|) (s: string, _n: MarkdownRange) = if not (String.IsNullOrWhiteSpace(s)) && s.TrimStart() = s then ValueSome() @@ -177,7 +183,7 @@ module StringPosition = StartColumn = n.StartColumn + text.Length - trimmed.Length }) /// Matches when a string starts with any of the specified sub-strings - [] + [] let (|StartsWithAny|_|) (starts: string seq) (text: string, _n: MarkdownRange) = if starts |> Seq.exists (fun s -> text.StartsWith(s, StringComparison.Ordinal)) then ValueSome() @@ -301,7 +307,7 @@ module StringPosition = /// Matches when a string consists of some number of /// complete repetitions of a specified sub-string. - [] + [] let (|EqualsRepeated|_|) (repeated, _n: MarkdownRange) = function | StartsWithRepeated repeated (_n, (v, _)) when (String.IsNullOrWhiteSpace v) -> ValueSome() @@ -409,7 +415,7 @@ module Lines = lines // first remove all whitespace on the beginning of the line // then remove all additional spaces at the end, but keep two spaces if existent - |> List.map (fun (StringPosition.TrimStart (s, n)) -> + |> List.map (fun (StringPosition.TrimStart(s, n)) -> let endsWithTwoSpaces = s.EndsWith(" ", StringComparison.Ordinal) let trimmed = s.TrimEnd([| ' ' |]) + if endsWithTwoSpaces then " " else "" diff --git a/src/FSharp.Formatting.ApiDocs/GenerateModel.fs b/src/FSharp.Formatting.ApiDocs/GenerateModel.fs index edee8787..04cd96a9 100644 --- a/src/FSharp.Formatting.ApiDocs/GenerateModel.fs +++ b/src/FSharp.Formatting.ApiDocs/GenerateModel.fs @@ -62,7 +62,7 @@ module internal Utils = else None - [] + [] let (|MeasureOne|_|) (typ: FSharpType) = if typ.HasTypeDefinition @@ -1758,7 +1758,7 @@ module internal SymbolReader = [ let mutable line = "" while (line <- reader.ReadLine() - not(isNull line)) do + not (isNull line)) do yield line ] String.removeSpaces lines @@ -1906,14 +1906,14 @@ module internal SymbolReader = let name = elem.Attribute(XName.Get "name") let nameAsHtml = HttpUtility.HtmlEncode name.Value - if not(isNull name) then + if not (isNull name) then html.AppendFormat("{0}", nameAsHtml) |> ignore | "see" | "seealso" -> let cref = elem.Attribute(XName.Get "cref") - if not(isNull cref) then + if not (isNull cref) then if System.String.IsNullOrEmpty(cref.Value) || cref.Value.Length < 3 then printfn "ignoring invalid cref specified in: %A" e @@ -2019,7 +2019,7 @@ module internal SymbolReader = let remarks = let remarkNodes = doc.Elements(XName.Get "remarks") |> Seq.toList - if not(List.isEmpty remarkNodes) then + if not (List.isEmpty remarkNodes) then let html = new StringBuilder() for (id, e) in List.indexed remarkNodes do @@ -2054,7 +2054,7 @@ module internal SymbolReader = [ for e in exceptionNodes do let cref = e.Attribute(XName.Get "cref") - if not(isNull cref) then + if not (isNull cref) then if String.IsNullOrEmpty(cref.Value) || cref.Value.Length < 3 then printfn "Warning: Invalid cref specified in: %A" doc @@ -2822,7 +2822,7 @@ module internal SymbolReader = [ for e in doc.Descendants(XName.Get "member") do let attr = e.Attribute(XName.Get "name") - if (not(isNull attr)) && not (String.IsNullOrEmpty(attr.Value)) then + if (not (isNull attr)) && not (String.IsNullOrEmpty(attr.Value)) then yield attr.Value, e ] do // NOTE: We completely ignore duplicate keys and I don't see // an easy way to detect where "value" is coming from, because the entries diff --git a/src/FSharp.Formatting.CodeFormat/CodeFormatAgent.fs b/src/FSharp.Formatting.CodeFormat/CodeFormatAgent.fs index 1050607b..8d76e181 100644 --- a/src/FSharp.Formatting.CodeFormat/CodeFormatAgent.fs +++ b/src/FSharp.Formatting.CodeFormat/CodeFormatAgent.fs @@ -352,7 +352,7 @@ module CodeFormatter = [| let line = ref "" while (line := reader.ReadLine() - not(isNull line.Value)) do + not (isNull line.Value)) do yield line.Value |] // Get options for a standalone script file (this adds some // default references and doesn't require full project information) diff --git a/src/FSharp.Formatting.Common/Templating.fs b/src/FSharp.Formatting.Common/Templating.fs index b0004121..043543b3 100644 --- a/src/FSharp.Formatting.Common/Templating.fs +++ b/src/FSharp.Formatting.Common/Templating.fs @@ -284,8 +284,7 @@ module internal SimpleTemplating = | true, lookupContent -> lookupContent | false, _ -> "") + (match lookup.TryGetValue ParamKeys.``fsdocs-tooltips`` with - | true, lookupTips -> - "\n\n" + lookupTips + | true, lookupTips -> "\n\n" + lookupTips | false, _ -> "") | Some templateText -> ApplySubstitutionsInText substitutions templateText diff --git a/src/FSharp.Formatting.Common/YaafFSharpScripting.fs b/src/FSharp.Formatting.Common/YaafFSharpScripting.fs index 1a705c63..a8a344d2 100644 --- a/src/FSharp.Formatting.Common/YaafFSharpScripting.fs +++ b/src/FSharp.Formatting.Common/YaafFSharpScripting.fs @@ -247,10 +247,8 @@ module internal CompilerServiceExtensions = |> List.map (fun file -> file, (match referenceDict.TryGetValue file with - | true, refFile -> - Some refFile - | false, _ -> - None)) + | true, refFile -> Some refFile + | false, _ -> None)) let getProjectReferencesSimple frameworkVersion (dllFiles: string list) = getProjectReferences frameworkVersion None None dllFiles |> resolve dllFiles @@ -465,7 +463,7 @@ module internal ArgParser = else None - [] + [] let (|FsiBoolArg|_|) argName s = match s with | StartsWith argName rest -> diff --git a/src/FSharp.Formatting.Literate/ParseScript.fs b/src/FSharp.Formatting.Literate/ParseScript.fs index 0f910f41..e1136dd7 100644 --- a/src/FSharp.Formatting.Literate/ParseScript.fs +++ b/src/FSharp.Formatting.Literate/ParseScript.fs @@ -163,8 +163,9 @@ type internal ParseScript(parseOptions, ctx: CompilerContext) = | Command "condition" name when not (String.IsNullOrWhiteSpace name) -> { Condition = Some name } | _ -> { Condition = None } - [] - let (|EmptyString|_|) (v: string) = if v.Length = 0 then ValueSome() else ValueNone + [] + let (|EmptyString|_|) (v: string) = + if v.Length = 0 then ValueSome() else ValueNone /// Transform list of code blocks (snippet/comment/command) /// into a formatted Markdown document, with link definitions @@ -387,7 +388,7 @@ type internal ParseScript(parseOptions, ctx: CompilerContext) = let parsedBlocks = [ for Snippet(name, lines) in sourceSnippets do - if not(isNull name) then + if not (isNull name) then yield BlockComment("## " + name) yield! parseScriptFile (lines) ] diff --git a/src/FSharp.Formatting.Literate/Transformations.fs b/src/FSharp.Formatting.Literate/Transformations.fs index 257b1de0..3a8cdfe6 100644 --- a/src/FSharp.Formatting.Literate/Transformations.fs +++ b/src/FSharp.Formatting.Literate/Transformations.fs @@ -77,8 +77,7 @@ module internal Transformations = |> Array.toList |> String.removeSpaces |> String.concat "\n" - | _ -> - code + | _ -> code let lang = match language with diff --git a/src/FSharp.Formatting.Markdown/Markdown.fs b/src/FSharp.Formatting.Markdown/Markdown.fs index d0555fd0..c4574efe 100644 --- a/src/FSharp.Formatting.Markdown/Markdown.fs +++ b/src/FSharp.Formatting.Markdown/Markdown.fs @@ -45,7 +45,7 @@ type Markdown internal () = let mutable lineNo = 1 while (line := reader.ReadLine() - not(isNull line.Value)) do + not (isNull line.Value)) do yield (line.Value, { StartLine = lineNo diff --git a/src/fsdocs-tool/ProjectCracker.fs b/src/fsdocs-tool/ProjectCracker.fs index 2e598051..5519d67c 100644 --- a/src/fsdocs-tool/ProjectCracker.fs +++ b/src/fsdocs-tool/ProjectCracker.fs @@ -161,7 +161,7 @@ module DotNetCli = module Crack = - [] + [] let (|ConditionEquals|_|) (str: string) (arg: string) = if System.String.Compare(str, arg, System.StringComparison.OrdinalIgnoreCase) = 0 then ValueSome()