diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index a55a67c4b..fa73b63d7 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -17,7 +17,7 @@ "rollForward": false }, "fantomas": { - "version": "6.3.11", + "version": "7.0.0", "commands": [ "fantomas" ], diff --git a/.editorconfig b/.editorconfig index ca75bf2f3..19f65aa3b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,7 +20,6 @@ trim_trailing_whitespace = false [*.{fs,fsx}] indent_size = 2 fsharp_max_array_or_list_width=80 -fsharp_max_dot_get_expression_width=80 fsharp_max_function_binding_width=80 fsharp_max_value_binding_width=80 diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 5c2c9c6c3..9a57496c6 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,4 @@ +# Fantomas v7.0.0 +e0ab543f5e6c52bcdacd818a3899bfe7d35d2364 # Fantomas v5.0.0-alpha-005 ca9fa561df53e90f6509e95681f8e4fd3ab385c4 \ No newline at end of file diff --git a/src/FsAutoComplete.Core/Commands.fs b/src/FsAutoComplete.Core/Commands.fs index 6d186c7cf..b31c157d7 100644 --- a/src/FsAutoComplete.Core/Commands.fs +++ b/src/FsAutoComplete.Core/Commands.fs @@ -259,8 +259,7 @@ module Commands = | Some(recordEpr, (Some recordDefinition), insertionPos) -> if shouldGenerateRecordStub recordEpr recordDefinition then let result = - (formatRecord insertionPos "$1" recordDefinition recordEpr.FieldExprList) - .TrimStart(' ') + (formatRecord insertionPos "$1" recordDefinition recordEpr.FieldExprList).TrimStart(' ') return CoreResponse.Res(result, insertionPos.InsertionPos) else diff --git a/src/FsAutoComplete.Core/CompilerServiceInterface.fs b/src/FsAutoComplete.Core/CompilerServiceInterface.fs index 1c8cc9000..b278ed907 100644 --- a/src/FsAutoComplete.Core/CompilerServiceInterface.fs +++ b/src/FsAutoComplete.Core/CompilerServiceInterface.fs @@ -500,9 +500,7 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe if shouldCache then let ops = - MemoryCacheEntryOptions() - .SetSize(1) - .SetSlidingExpiration(TimeSpan.FromMinutes(5.)) + MemoryCacheEntryOptions().SetSize(1).SetSlidingExpiration(TimeSpan.FromMinutes(5.)) return lastCheckResults.Set(filePath, r, ops) else @@ -553,9 +551,7 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe if shouldCache then let ops = - MemoryCacheEntryOptions() - .SetSize(1) - .SetSlidingExpiration(TimeSpan.FromMinutes(5.)) + MemoryCacheEntryOptions().SetSize(1).SetSlidingExpiration(TimeSpan.FromMinutes(5.)) return lastCheckResults.Set(filePath, r, ops) else diff --git a/src/FsAutoComplete.Core/FCSPatches.fs b/src/FsAutoComplete.Core/FCSPatches.fs index 91ccb15d5..72d19b6fb 100644 --- a/src/FsAutoComplete.Core/FCSPatches.fs +++ b/src/FsAutoComplete.Core/FCSPatches.fs @@ -198,8 +198,7 @@ module ReflectionDelegates = let method = instanceType.GetMethod(getterName, BindingFlagsToSeeAll) let getFunc = - typedefof> - .MakeGenericType(instanceType, arg1, typeof<'returnType>) + typedefof>.MakeGenericType(instanceType, arg1, typeof<'returnType>) let delegate2 = method.CreateDelegate(getFunc) // TODO: Emit IL for performance diff --git a/src/FsAutoComplete.Core/FsprojEdit.fs b/src/FsAutoComplete.Core/FsprojEdit.fs index 5b2111055..08e1b83eb 100644 --- a/src/FsAutoComplete.Core/FsprojEdit.fs +++ b/src/FsAutoComplete.Core/FsprojEdit.fs @@ -48,7 +48,7 @@ module FsProjEditor = let moveFileUp (fsprojPath: string) (file: string) = let xDoc = System.Xml.XmlDocument() - xDoc.PreserveWhitespace <- true // to keep custom formatting if present + xDoc.PreserveWhitespace <- true // to keep custom formatting if present xDoc.Load fsprojPath let xpath = sprintf "//Compile[@Include='%s']/.." file let itemGroup = xDoc.SelectSingleNode(xpath) @@ -65,7 +65,7 @@ module FsProjEditor = let moveFileDown (fsprojPath: string) (file: string) = let xDoc = System.Xml.XmlDocument() - xDoc.PreserveWhitespace <- true // to keep custom formatting if present + xDoc.PreserveWhitespace <- true // to keep custom formatting if present xDoc.Load fsprojPath let xpath = sprintf "//Compile[@Include='%s']/.." file let itemGroup = xDoc.SelectSingleNode(xpath) @@ -98,7 +98,7 @@ module FsProjEditor = let addFileBelow (fsprojPath: string) (belowFile: string) (newFileName: string) = let xDoc = System.Xml.XmlDocument() - xDoc.PreserveWhitespace <- true // to keep custom formatting if present + xDoc.PreserveWhitespace <- true // to keep custom formatting if present xDoc.Load fsprojPath if fileAlreadyIncludedViaCompileTag xDoc newFileName then @@ -115,7 +115,7 @@ module FsProjEditor = let renameFile (fsprojPath: string) (oldFileName: string) (newFileName: string) = let xDoc = System.Xml.XmlDocument() - xDoc.PreserveWhitespace <- true // to keep custom formatting if present + xDoc.PreserveWhitespace <- true // to keep custom formatting if present xDoc.Load fsprojPath let xpath = sprintf "//Compile[@Include='%s']" oldFileName let node = xDoc.SelectSingleNode(xpath) @@ -124,7 +124,7 @@ module FsProjEditor = let addFile (fsprojPath: string) (newFileName: string) = let xDoc = System.Xml.XmlDocument() - xDoc.PreserveWhitespace <- true // to keep custom formatting if present + xDoc.PreserveWhitespace <- true // to keep custom formatting if present xDoc.Load fsprojPath if fileAlreadyIncludedViaCompileTag xDoc newFileName then @@ -161,7 +161,7 @@ module FsProjEditor = let removeFile (fsprojPath: string) (fileToRemove: string) = let xDoc = System.Xml.XmlDocument() - xDoc.PreserveWhitespace <- true // to keep custom formatting if present + xDoc.PreserveWhitespace <- true // to keep custom formatting if present xDoc.Load fsprojPath let sanitizedFileToRemove = fileToRemove.Replace("\\", "/") diff --git a/src/FsAutoComplete.Core/Sourcelink.fs b/src/FsAutoComplete.Core/Sourcelink.fs index 97f746799..1670688f3 100644 --- a/src/FsAutoComplete.Core/Sourcelink.fs +++ b/src/FsAutoComplete.Core/Sourcelink.fs @@ -194,10 +194,7 @@ let private tryGetUrlWithExactMatch (urlPattern: string) (document: Document) = - if - (UMX.untag pathPattern) - .Equals(UMX.untag document.Name, System.StringComparison.Ordinal) - then + if (UMX.untag pathPattern).Equals(UMX.untag document.Name, System.StringComparison.Ordinal) then Some(urlPattern, normalizeRepoPath (UMX.cast pathPattern), document) else None diff --git a/src/FsAutoComplete.Core/TipFormatter.fs b/src/FsAutoComplete.Core/TipFormatter.fs index 828621e8f..afece5b20 100644 --- a/src/FsAutoComplete.Core/TipFormatter.fs +++ b/src/FsAutoComplete.Core/TipFormatter.fs @@ -683,12 +683,7 @@ module private Format = /// For example, this allows to print '>' in the tooltip instead of '>' /// let private unescapeSpecialCharacters (text: string) = - text - .Replace("<", "<") - .Replace(">", ">") - .Replace(""", "\"") - .Replace("'", "'") - .Replace("&", "&") + text.Replace("<", "<").Replace(">", ">").Replace(""", "\"").Replace("'", "'").Replace("&", "&") let applyAll (text: string) = text diff --git a/src/FsAutoComplete.Core/Utils.fs b/src/FsAutoComplete.Core/Utils.fs index 3d4065c6e..31c58f3a9 100644 --- a/src/FsAutoComplete.Core/Utils.fs +++ b/src/FsAutoComplete.Core/Utils.fs @@ -727,8 +727,7 @@ module Version = let private informationalVersion () = let assemblies = - typeof.Assembly - .GetCustomAttributes(typeof, true) + typeof.Assembly.GetCustomAttributes(typeof, true) match assemblies with | [| x |] -> diff --git a/src/FsAutoComplete.Logging/FsLibLog.fs b/src/FsAutoComplete.Logging/FsLibLog.fs index 7ff48103a..a6450a9b3 100644 --- a/src/FsAutoComplete.Logging/FsLibLog.fs +++ b/src/FsAutoComplete.Logging/FsLibLog.fs @@ -515,9 +515,7 @@ module Providers = Expression.Call(instanceCast, isEnabledMethodInfo, levelCast) let isEnabled = - Expression - .Lambda>(isEnabledMethodCall, instanceParam, levelParam) - .Compile() + Expression.Lambda>(isEnabledMethodCall, instanceParam, levelParam).Compile() let writeMethodInfo = loggerType.GetMethod("Write", [| logEventLevelType; typedefof; typedefof |]) @@ -800,9 +798,7 @@ module Providers = let beginScopeMethodCall = Expression.Call(instanceCast, beginScopeMethodInfo, stateParam) - Expression - .Lambda>(beginScopeMethodCall, instanceParam, stateParam) - .Compile() + Expression.Lambda>(beginScopeMethodCall, instanceParam, stateParam).Compile() |> FuncConvert.FromFunc { Write = write diff --git a/src/FsAutoComplete.Logging/FsOpenTelemetry.fs b/src/FsAutoComplete.Logging/FsOpenTelemetry.fs index 356f94b41..108cb912f 100644 --- a/src/FsAutoComplete.Logging/FsOpenTelemetry.fs +++ b/src/FsAutoComplete.Logging/FsOpenTelemetry.fs @@ -522,9 +522,7 @@ type ActivityExtensions = [] static member inline SetStatusErrorSafe(span: Activity, description: string) = - span - .SetTagSafe("otel.status_code", "ERROR") - .SetTagSafe("otel.status_description", description) + span.SetTagSafe("otel.status_code", "ERROR").SetTagSafe("otel.status_description", description) [] static member inline SetSourceCodeFilePath(span: Activity, value: string) = diff --git a/src/FsAutoComplete/LspHelpers.fs b/src/FsAutoComplete/LspHelpers.fs index 219f85ab1..28c060745 100644 --- a/src/FsAutoComplete/LspHelpers.fs +++ b/src/FsAutoComplete/LspHelpers.fs @@ -207,8 +207,7 @@ module Conversions = let getLine (lines: string[]) (pos: LspPosition) = lines.[int pos.Line] let getText (lines: string[]) (r: LspRange) = - lines.[int r.Start.Line] - .Substring(int r.Start.Character, int (r.End.Character - r.Start.Character)) + lines.[int r.Start.Line].Substring(int r.Start.Character, int (r.End.Character - r.Start.Character)) [] module internal GlyphConversions = diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index e7a969290..bf9be031b 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -237,12 +237,7 @@ type AdaptiveFSharpLspServer ) |> Option.defaultValue (async { return () }) | (Some { Title = "Install globally" }) -> - let! result = - Cli - .Wrap("dotnet") - .WithArguments("tool install -g fantomas") - .ExecuteBufferedAsync() - .Task + let! result = Cli.Wrap("dotnet").WithArguments("tool install -g fantomas").ExecuteBufferedAsync().Task if result.ExitCode = 0 then fantomasLogger.info (Log.setMessage "fantomas was installed globally") diff --git a/src/FsAutoComplete/LspServers/Common.fs b/src/FsAutoComplete/LspServers/Common.fs index cc96f3cba..89e3e3fca 100644 --- a/src/FsAutoComplete/LspServers/Common.fs +++ b/src/FsAutoComplete/LspServers/Common.fs @@ -200,9 +200,7 @@ module ObservableExtensions = /// Fires an event only after the specified interval has passed in which no other pending event has fired. Buffers all events leading up to that emit. member x.BufferedDebounce(ts: TimeSpan) = - x - .Publish(fun shared -> shared.Window(shared.Throttle(ts))) - .SelectMany(fun l -> l.ToList()) + x.Publish(fun shared -> shared.Window(shared.Throttle(ts))).SelectMany(fun l -> l.ToList()) module Helpers = let notImplemented<'t> = async.Return LspResult.notImplemented<'t> diff --git a/src/FsAutoComplete/Parser.fs b/src/FsAutoComplete/Parser.fs index 6184e133b..3beed7817 100644 --- a/src/FsAutoComplete/Parser.fs +++ b/src/FsAutoComplete/Parser.fs @@ -222,9 +222,7 @@ module Parser = let version = FsAutoComplete.Utils.Version.info().Version let resourceBuilder = - ResourceBuilder - .CreateDefault() - .AddService(serviceName = serviceName, serviceVersion = version) + ResourceBuilder.CreateDefault().AddService(serviceName = serviceName, serviceVersion = version) meterProvider <-