From 9c91c2cd67a45a483f3e3816ff5255dd97d309ed Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Sun, 31 Mar 2024 16:20:40 +0200 Subject: [PATCH] Bump analyzers and Fantomas (#1257) --- .config/dotnet-tools.json | 4 +-- paket.dependencies | 2 +- paket.lock | 2 +- .../CompilerServiceInterface.fs | 16 +++------- src/FsAutoComplete.Core/FileSystem.fs | 15 +++------ src/FsAutoComplete.Core/InlayHints.fs | 8 ++--- src/FsAutoComplete.Core/Lexer.fs | 6 ++-- .../ParseAndCheckResults.fsi | 9 +++--- src/FsAutoComplete.Core/SignatureHelp.fs | 25 ++++----------- src/FsAutoComplete.Core/TipFormatter.fsi | 6 ++-- src/FsAutoComplete.Logging/FsOpenTelemetry.fs | 27 +++++----------- src/FsAutoComplete/CodeFixes.fs | 1 + src/FsAutoComplete/CodeFixes.fsi | 1 + .../CodeFixes/AddExplicitTypeAnnotation.fs | 9 +++--- .../CodeFixes/AddPrivateAccessModifier.fs | 10 ++++-- .../CodeFixes/AddPrivateAccessModifier.fsi | 7 ++++- .../CodeFixes/AdjustConstant.fs | 11 +++++-- .../CodeFixes/AdjustConstant.fsi | 2 ++ .../CodeFixes/ConvertPositionalDUToNamed.fs | 3 +- .../CodeFixes/ExternalSystemDiagnostics.fs | 7 +++-- src/FsAutoComplete/CommandResponse.fs | 2 +- src/FsAutoComplete/CommandResponse.fsi | 2 +- .../LspServers/AdaptiveFSharpLspServer.fs | 12 +++---- .../LspServers/AdaptiveServerState.fs | 31 +++++++++---------- src/FsAutoComplete/LspServers/Common.fs | 13 +++++--- src/FsAutoComplete/Parser.fs | 4 +-- 26 files changed, 106 insertions(+), 129 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index f759710e7..6e73b4e65 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,13 +15,13 @@ ] }, "fantomas": { - "version": "6.2.3", + "version": "6.3.1", "commands": [ "fantomas" ] }, "fsharp-analyzers": { - "version": "0.23.0", + "version": "0.25.0", "commands": [ "fsharp-analyzers" ] diff --git a/paket.dependencies b/paket.dependencies index 739581137..019107193 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -14,7 +14,7 @@ lowest_matching: true nuget BenchmarkDotNet 0.13.5 nuget Fantomas.Client >= 0.9 nuget FSharp.Compiler.Service >= 43.8.200 -nuget Ionide.Analyzers 0.7.0 +nuget Ionide.Analyzers 0.10.0 nuget FSharp.Analyzers.Build 0.3.0 nuget Ionide.ProjInfo >= 0.62.0 nuget Ionide.ProjInfo.FCS >= 0.62.0 diff --git a/paket.lock b/paket.lock index 60780d5e9..3d88971c3 100644 --- a/paket.lock +++ b/paket.lock @@ -131,7 +131,7 @@ NUGET Microsoft.Win32.Registry (>= 5.0) System.Collections.Immutable (>= 5.0) System.Reflection.Metadata (>= 5.0) - Ionide.Analyzers (0.7) + Ionide.Analyzers (0.10) Ionide.KeepAChangelog.Tasks (0.1.8) - copy_local: true Ionide.LanguageServerProtocol (0.4.20) FSharp.Core (>= 6.0) diff --git a/src/FsAutoComplete.Core/CompilerServiceInterface.fs b/src/FsAutoComplete.Core/CompilerServiceInterface.fs index 6835368fa..a40b70486 100644 --- a/src/FsAutoComplete.Core/CompilerServiceInterface.fs +++ b/src/FsAutoComplete.Core/CompilerServiceInterface.fs @@ -253,13 +253,8 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe /// Note: all files except the one being checked are read from the FileSystem API /// Result of ParseAndCheckResults member __.ParseAndCheckFileInProject - ( - filePath: string, - version, - source: ISourceText, - options, - ?shouldCache: bool - ) = + (filePath: string, version, source: ISourceText, options, ?shouldCache: bool) + = asyncResult { let shouldCache = defaultArg shouldCache false let opName = sprintf "ParseAndCheckFileInProject - %A" filePath @@ -359,11 +354,8 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe result member x.GetUsesOfSymbol - ( - file: string, - options: (string * FSharpProjectOptions) seq, - symbol: FSharpSymbol - ) = + (file: string, options: (string * FSharpProjectOptions) seq, symbol: FSharpSymbol) + = async { checkerLogger.info ( Log.setMessage "GetUsesOfSymbol - {file}" diff --git a/src/FsAutoComplete.Core/FileSystem.fs b/src/FsAutoComplete.Core/FileSystem.fs index 533589b0a..f2723f2c9 100644 --- a/src/FsAutoComplete.Core/FileSystem.fs +++ b/src/FsAutoComplete.Core/FileSystem.fs @@ -585,11 +585,8 @@ module Tokenizer = /// /// based on: `dotnet/fsharp` `Tokenizer.fixupSpan` let private tryFixupRangeBySplittingAtDot - ( - range: Range, - text: IFSACSourceText, - includeBackticks: bool - ) : Range voption = + (range: Range, text: IFSACSourceText, includeBackticks: bool) + : Range voption = match text[range] with | Error _ -> ValueNone | Ok rangeText when rangeText.EndsWith("``", StringComparison.Ordinal) -> @@ -651,12 +648,8 @@ module Tokenizer = /// /// returns `None` iff `range` isn't inside `text` -> `range` & `text` for different states let tryFixupRange - ( - symbolNameCore: string, - range: Range, - text: IFSACSourceText, - includeBackticks: bool - ) : Range voption = + (symbolNameCore: string, range: Range, text: IFSACSourceText, includeBackticks: bool) + : Range voption = // first: try match symbolNameCore in last line // usually identifier cannot contain linebreak -> is in last line of range // Exception: Active Pattern can span multiple lines: `(|Even|Odd|)` -> `(|Even|\n Odd|)` is valid too diff --git a/src/FsAutoComplete.Core/InlayHints.fs b/src/FsAutoComplete.Core/InlayHints.fs index 18dda8872..9a25c8f68 100644 --- a/src/FsAutoComplete.Core/InlayHints.fs +++ b/src/FsAutoComplete.Core/InlayHints.fs @@ -880,12 +880,8 @@ type HintConfig = ShowParameterHints: bool } let provideHints - ( - text: IFSACSourceText, - parseAndCheck: ParseAndCheckResults, - range: Range, - hintConfig - ) : Async = + (text: IFSACSourceText, parseAndCheck: ParseAndCheckResults, range: Range, hintConfig) + : Async = asyncResult { let! cancellationToken = Async.CancellationToken diff --git a/src/FsAutoComplete.Core/Lexer.fs b/src/FsAutoComplete.Core/Lexer.fs index 3168352b7..128564a9f 100644 --- a/src/FsAutoComplete.Core/Lexer.fs +++ b/src/FsAutoComplete.Core/Lexer.fs @@ -89,10 +89,8 @@ module Lexer = let inline private isPunctuation t = t.ColorClass = FSharpTokenColorKind.Punctuation let inline private (|GenericTypeParameterPrefix|StaticallyResolvedTypeParameterPrefix|ActivePattern|Other|) - ( - (token: FSharpTokenInfo), - (lineStr: string) - ) = + ((token: FSharpTokenInfo), (lineStr: string)) + = if token.Tag = FSharpTokenTag.QUOTE then GenericTypeParameterPrefix elif token.Tag = FSharpTokenTag.INFIX_AT_HAT_OP then diff --git a/src/FsAutoComplete.Core/ParseAndCheckResults.fsi b/src/FsAutoComplete.Core/ParseAndCheckResults.fsi index f3099f45a..960d50b14 100644 --- a/src/FsAutoComplete.Core/ParseAndCheckResults.fsi +++ b/src/FsAutoComplete.Core/ParseAndCheckResults.fsi @@ -54,11 +54,10 @@ type ParseAndCheckResults = member TryGetFormattedDocumentation: pos: Position -> lineStr: LineStr -> - Result<(ToolTipText option * - (string * string) option * - (string * DocumentationFormatter.EntityInfo) * - string * - string), string> + Result< + (ToolTipText option * (string * string) option * (string * DocumentationFormatter.EntityInfo) * string * string), + string + > member TryGetFormattedDocumentationForSymbol: xmlSig: string -> diff --git a/src/FsAutoComplete.Core/SignatureHelp.fs b/src/FsAutoComplete.Core/SignatureHelp.fs index e3f059674..e7067263e 100644 --- a/src/FsAutoComplete.Core/SignatureHelp.fs +++ b/src/FsAutoComplete.Core/SignatureHelp.fs @@ -27,12 +27,8 @@ type SignatureHelpInfo = } let private getSignatureHelpForFunctionApplication - ( - tyRes: ParseAndCheckResults, - caretPos: Position, - endOfPreviousIdentPos: Position, - lines: IFSACSourceText - ) : Async = + (tyRes: ParseAndCheckResults, caretPos: Position, endOfPreviousIdentPos: Position, lines: IFSACSourceText) + : Async = asyncOption { let! lineStr = lines.GetLine endOfPreviousIdentPos @@ -124,12 +120,8 @@ let private getSignatureHelpForFunctionApplication } let private getSignatureHelpForMethod - ( - tyRes: ParseAndCheckResults, - caretPos: Position, - lines: IFSACSourceText, - triggerChar - ) = + (tyRes: ParseAndCheckResults, caretPos: Position, lines: IFSACSourceText, triggerChar) + = asyncOption { let! paramLocations = tyRes.GetParseResults.FindParameterLocations caretPos let names = paramLocations.LongId @@ -213,13 +205,8 @@ let private getSignatureHelpForMethod } let getSignatureHelpFor - ( - tyRes: ParseAndCheckResults, - pos: Position, - lines: IFSACSourceText, - triggerChar, - possibleSessionKind - ) = + (tyRes: ParseAndCheckResults, pos: Position, lines: IFSACSourceText, triggerChar, possibleSessionKind) + = asyncResult { let previousNonWhitespaceChar = let rec loop ch pos = diff --git a/src/FsAutoComplete.Core/TipFormatter.fsi b/src/FsAutoComplete.Core/TipFormatter.fsi index 1fe98eb3f..caa81f531 100644 --- a/src/FsAutoComplete.Core/TipFormatter.fsi +++ b/src/FsAutoComplete.Core/TipFormatter.fsi @@ -108,8 +108,10 @@ val prepareFooterLines: footerText: string -> string array val tryFormatTipEnhanced: toolTipText: ToolTipText -> formatCommentStyle: FormatCommentStyle -> - TipFormatterResult<{| DocComment: string - HasTruncatedExamples: bool |}> + TipFormatterResult< + {| DocComment: string + HasTruncatedExamples: bool |} + > /// /// Generate the 'Show documentation' link for the tooltip. diff --git a/src/FsAutoComplete.Logging/FsOpenTelemetry.fs b/src/FsAutoComplete.Logging/FsOpenTelemetry.fs index ad467cc68..356f94b41 100644 --- a/src/FsAutoComplete.Logging/FsOpenTelemetry.fs +++ b/src/FsAutoComplete.Logging/FsOpenTelemetry.fs @@ -544,26 +544,20 @@ type ActivityExtensions = [] static member inline SetNetworkNetTransport - ( - span: Activity, - value: string - ) = + (span: Activity, value: string) + = span.SetTagSafe(SemanticConventions.General.Network.net_transport, UMX.untag value) [] static member inline SetNetworkNetHostConnectionType - ( - span: Activity, - value: string - ) = + (span: Activity, value: string) + = span.SetTagSafe(SemanticConventions.General.Network.net_host_connection_type, UMX.untag value) [] static member inline SetNetworkNetHostConnectionSubType - ( - span: Activity, - value: string - ) = + (span: Activity, value: string) + = span.SetTagSafe(SemanticConventions.General.Network.net_host_connection_subtype, UMX.untag value) @@ -575,13 +569,8 @@ type ActivityExtensions = /// SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. [] static member inline RecordError - ( - span: Activity, - errorMessage: string, - errorType: string, - ?stacktrace: string, - ?escaped: bool - ) = + (span: Activity, errorMessage: string, errorType: string, ?stacktrace: string, ?escaped: bool) + = if Funcs.isNotNull span then let escaped = defaultArg escaped false diff --git a/src/FsAutoComplete/CodeFixes.fs b/src/FsAutoComplete/CodeFixes.fs index 3c11fdd3c..f7a730560 100644 --- a/src/FsAutoComplete/CodeFixes.fs +++ b/src/FsAutoComplete/CodeFixes.fs @@ -37,6 +37,7 @@ module Types = string -> Async> [] + [] type FixKind = | Fix | Refactor diff --git a/src/FsAutoComplete/CodeFixes.fsi b/src/FsAutoComplete/CodeFixes.fsi index 1a8366bbe..bba12fb54 100644 --- a/src/FsAutoComplete/CodeFixes.fsi +++ b/src/FsAutoComplete/CodeFixes.fsi @@ -31,6 +31,7 @@ module Types = string -> Async> [] + [] type FixKind = | Fix | Refactor diff --git a/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs b/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs index ff6cb423a..f04a85587 100644 --- a/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs +++ b/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs @@ -26,6 +26,7 @@ let rec nonTypedParameterName p = | _ -> None /// Captures a SynBinding that either has no return type or has parameters that are not typed. +[] let (|FunctionBindingWithMissingTypes|_|) = function | SynBinding( @@ -33,7 +34,7 @@ let (|FunctionBindingWithMissingTypes|_|) = returnInfo = None trivia = { LeadingKeyword = lk }) -> let bindingStartRange = unionRanges lk.Range lid.Range - Some(bindingStartRange, Some headPat.Range, parameters.Length, List.choose nonTypedParameterName parameters) + ValueSome(bindingStartRange, Some headPat.Range, parameters.Length, List.choose nonTypedParameterName parameters) | SynBinding( headPat = SynPat.LongIdent(longDotId = lid; argPats = SynArgPats.Pats parameters) returnInfo = Some _ @@ -42,10 +43,10 @@ let (|FunctionBindingWithMissingTypes|_|) = let nonTypedParameters = List.choose nonTypedParameterName parameters if List.isEmpty nonTypedParameters then - None + ValueNone else - Some(bindingStartRange, None, parameters.Length, nonTypedParameters) - | _ -> None + ValueSome(bindingStartRange, None, parameters.Length, nonTypedParameters) + | _ -> ValueNone /// /// Try and find a SynBinding function where either the return type or any parameter is missing a type definition. diff --git a/src/FsAutoComplete/CodeFixes/AddPrivateAccessModifier.fs b/src/FsAutoComplete/CodeFixes/AddPrivateAccessModifier.fs index a9b6bd659..993b01edd 100644 --- a/src/FsAutoComplete/CodeFixes/AddPrivateAccessModifier.fs +++ b/src/FsAutoComplete/CodeFixes/AddPrivateAccessModifier.fs @@ -19,8 +19,14 @@ type SymbolUseWorkspace = -> LineStr -> IFSACSourceText -> ParseAndCheckResults - -> Async, FSharp.Compiler.Text.range array>, string>> - + -> Async< + Result< + System.Collections.Generic.IDictionary, FSharp.Compiler.Text.range array>, + string + > + > + +[] type private Placement = | Before | After diff --git a/src/FsAutoComplete/CodeFixes/AddPrivateAccessModifier.fsi b/src/FsAutoComplete/CodeFixes/AddPrivateAccessModifier.fsi index 932009bbf..38c91f6ad 100644 --- a/src/FsAutoComplete/CodeFixes/AddPrivateAccessModifier.fsi +++ b/src/FsAutoComplete/CodeFixes/AddPrivateAccessModifier.fsi @@ -19,7 +19,12 @@ type SymbolUseWorkspace = -> LineStr -> IFSACSourceText -> ParseAndCheckResults - -> Async, FSharp.Compiler.Text.range array>, string>> + -> Async< + Result< + System.Collections.Generic.IDictionary, FSharp.Compiler.Text.range array>, + string + > + > val fix: getParseResultsForFile: GetParseResultsForFile -> diff --git a/src/FsAutoComplete/CodeFixes/AdjustConstant.fs b/src/FsAutoComplete/CodeFixes/AdjustConstant.fs index 626ec2beb..1e4c84d8d 100644 --- a/src/FsAutoComplete/CodeFixes/AdjustConstant.fs +++ b/src/FsAutoComplete/CodeFixes/AdjustConstant.fs @@ -274,6 +274,7 @@ module private Char = let inline isSingleQuote c = c = '\'' [] +[] type CharFormat = /// `ç` | Char @@ -345,6 +346,7 @@ module private CharConstant = ValueRange = valueRange SuffixRange = suffixRange } +[] type private Sign = | Negative | Positive @@ -364,6 +366,7 @@ module private Sign = Positive, range.EmptyAtStart, range [] +[] type Base = /// No prefix | Decimal @@ -437,10 +440,11 @@ module private IntConstant = SuffixRange = suffixRange } [] +[] type private FloatValue = - | Float of float - | Float32 of float32 - | Decimal of decimal + | Float of f: float + | Float32 of f32: float32 + | Decimal of d: decimal static member from(f: float) = FloatValue.Float f static member from(f: float32) = FloatValue.Float32 f @@ -588,6 +592,7 @@ module private DigitGroup = else [] + [] type Direction = /// thousands -> left of `.` | RightToLeft diff --git a/src/FsAutoComplete/CodeFixes/AdjustConstant.fsi b/src/FsAutoComplete/CodeFixes/AdjustConstant.fsi index fc6a655f9..f4954842e 100644 --- a/src/FsAutoComplete/CodeFixes/AdjustConstant.fsi +++ b/src/FsAutoComplete/CodeFixes/AdjustConstant.fsi @@ -4,6 +4,7 @@ open FsAutoComplete.CodeFix.Types open Ionide.LanguageServerProtocol.Types [] +[] type CharFormat = /// `ç` | Char @@ -17,6 +18,7 @@ type CharFormat = | Utf32Hexadecimal [] +[] type Base = /// No prefix | Decimal diff --git a/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs b/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs index 2341b0b07..429fce724 100644 --- a/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs +++ b/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs @@ -159,8 +159,7 @@ let fix (getParseResultsForFile: GetParseResultsForFile) : CodeFix = let commasBetweenFields = toPosSeq (parenRange, sourceText) - |> Seq.filter notInsidePatterns - |> Seq.filter (fun pos -> sourceText.GetCharUnsafe pos = ',') + |> Seq.filter (fun pos -> notInsidePatterns pos && sourceText.GetCharUnsafe pos = ',') let removeCommaEdits = commasBetweenFields diff --git a/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs b/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs index b38381978..df47b0f98 100644 --- a/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs +++ b/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs @@ -7,11 +7,12 @@ open Ionide.LanguageServerProtocol.Types open FsAutoComplete open Newtonsoft.Json.Linq -let private (|Payload|_|) (tok: JToken) : 't option = +[] +let private (|Payload|_|) (tok: JToken) : 't voption = try - Some(Ionide.LanguageServerProtocol.Server.deserialize tok: 't) + ValueSome(Ionide.LanguageServerProtocol.Server.deserialize tok: 't) with e -> - None + ValueNone let private mapExternalDiagnostic diagnosticType = Run.ifDiagnosticByType diagnosticType (fun diagnostic codeActionParams -> diff --git a/src/FsAutoComplete/CommandResponse.fs b/src/FsAutoComplete/CommandResponse.fs index 7d98794e5..f524b37fe 100644 --- a/src/FsAutoComplete/CommandResponse.fs +++ b/src/FsAutoComplete/CommandResponse.fs @@ -168,7 +168,7 @@ module CommandResponse = AdditionalInfo: Map } - and ProjectOutputType = + and [] ProjectOutputType = | Library | Exe | Custom of string diff --git a/src/FsAutoComplete/CommandResponse.fsi b/src/FsAutoComplete/CommandResponse.fsi index b28384d18..b68c16035 100644 --- a/src/FsAutoComplete/CommandResponse.fsi +++ b/src/FsAutoComplete/CommandResponse.fsi @@ -79,7 +79,7 @@ module CommandResponse = Items: List AdditionalInfo: Map } - and ProjectOutputType = + and [] ProjectOutputType = | Library | Exe | Custom of string diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index 36ad6070e..51442d29a 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -262,10 +262,8 @@ type AdaptiveFSharpLspServer member __.ScriptFileProjectOptions = state.ScriptFileProjectOptions.Publish member private x.logUnimplementedRequest<'t, 'u> - ( - argValue: 't, - [] caller: string - ) = + (argValue: 't, [] caller: string) + = logger.info ( Log.setMessage $"{caller} request: {{params}}" >> Log.addContextDestructured "params" argValue @@ -274,10 +272,8 @@ type AdaptiveFSharpLspServer Helpers.notImplemented<'u> member private x.logIgnoredNotification<'t> - ( - argValue: 't, - [] caller: string - ) = + (argValue: 't, [] caller: string) + = logger.info ( Log.setMessage $"{caller} request: {{params}}" >> Log.addContextDestructured "params" argValue diff --git a/src/FsAutoComplete/LspServers/AdaptiveServerState.fs b/src/FsAutoComplete/LspServers/AdaptiveServerState.fs index f636ca685..82020dad9 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveServerState.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveServerState.fs @@ -845,8 +845,11 @@ type AdaptiveState(lspClient: FSharpLspClient, sourceTextFactory: ISourceTextFac | MSBuildAllProjects v -> yield! v - |> Array.filter (fun x -> x.EndsWith(".props", StringComparison.Ordinal) && isWithinObjFolder x) - |> Array.map (UMX.tag >> projectFileChanges) + |> Array.choose (fun x -> + if x.EndsWith(".props", StringComparison.Ordinal) && isWithinObjFolder x then + UMX.tag x |> projectFileChanges |> Some + else + None) | _ -> () ] HashMap.ofList @@ -1323,11 +1326,14 @@ type AdaptiveState(lspClient: FSharpLspClient, sourceTextFactory: ISourceTextFac } let autoCompleteItems - : cmap * - (Position -> option) * - FSharp.Compiler.Syntax.ParsedInput> = + : cmap< + DeclName, + DeclarationListItem * + Position * + string * + (Position -> option) * + FSharp.Compiler.Syntax.ParsedInput + > = cmap () let getAutoCompleteByDeclName name = autoCompleteItems |> AMap.tryFind name @@ -2201,15 +2207,8 @@ type AdaptiveState(lspClient: FSharpLspClient, sourceTextFactory: ISourceTextFac member x.GetAutoCompleteNamespacesByDeclName declName = getAutoCompleteNamespacesByDeclName declName |> AVal.force member x.SymbolUseWorkspace - ( - includeDeclarations, - includeBackticks, - errorOnFailureToFixRange, - pos, - lineStr, - text, - tyRes - ) = + (includeDeclarations, includeBackticks, errorOnFailureToFixRange, pos, lineStr, text, tyRes) + = symbolUseWorkspace includeDeclarations includeBackticks errorOnFailureToFixRange pos lineStr text tyRes member x.GetDeclarationLocation(symbolUse, text) = getDeclarationLocation (symbolUse, text) diff --git a/src/FsAutoComplete/LspServers/Common.fs b/src/FsAutoComplete/LspServers/Common.fs index 318eeda76..60d6e1534 100644 --- a/src/FsAutoComplete/LspServers/Common.fs +++ b/src/FsAutoComplete/LspServers/Common.fs @@ -29,8 +29,11 @@ module Result = let lineLookupErr (r: - Result<'T, {| FileName: string - Position: FcsPos |}>) + Result< + 'T, + {| FileName: string + Position: FcsPos |} + >) = r |> Result.mapError (ErrorMsgUtils.formatLineLookErr >> JsonRpc.Error.InternalErrorMessage) @@ -57,8 +60,10 @@ type DiagnosticCollection(sendDiagnostics: DocumentUri -> Diagnostic[] -> Async< Map.toArray diags |> Array.collect (snd >> snd) |> sendDiagnostics uri let agents = - System.Collections.Concurrent.ConcurrentDictionary * - CancellationTokenSource>() + System.Collections.Concurrent.ConcurrentDictionary< + DocumentUri, + MailboxProcessor * CancellationTokenSource + >() let rec restartAgent (fileUri: DocumentUri) = removeAgent fileUri diff --git a/src/FsAutoComplete/Parser.fs b/src/FsAutoComplete/Parser.fs index 0ad58284b..5ecee6b4f 100644 --- a/src/FsAutoComplete/Parser.fs +++ b/src/FsAutoComplete/Parser.fs @@ -180,7 +180,7 @@ module Parser = let warnOnUnknownOptions = Invocation.InvocationMiddleware(fun ctx next -> if - ctx.ParseResult.UnmatchedTokens = null + isNull ctx.ParseResult.UnmatchedTokens || ctx.ParseResult.UnmatchedTokens.Count = 0 then next.Invoke(ctx) @@ -249,7 +249,7 @@ module Parser = let sourcesToExclude = Matching.WithProperty( Constants.SourceContextPropertyName, - fun s -> s <> null && Array.contains s logSourcesToExclude + fun s -> not (isNull s) && Array.contains s logSourcesToExclude ) let verbositySwitch = LoggingLevelSwitch(logLevel)