Skip to content

Commit

Permalink
Bump analyzers and Fantomas
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Mar 31, 2024
1 parent 4bc676c commit d0e13fc
Show file tree
Hide file tree
Showing 26 changed files with 106 additions and 129 deletions.
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 4 additions & 12 deletions src/FsAutoComplete.Core/CompilerServiceInterface.fs
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,8 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe
/// <remarks>Note: all files except the one being checked are read from the FileSystem API</remarks>
/// <returns>Result of ParseAndCheckResults</returns>
member __.ParseAndCheckFileInProject
(
filePath: string<LocalPath>,
version,
source: ISourceText,
options,
?shouldCache: bool
) =
(filePath: string<LocalPath>, version, source: ISourceText, options, ?shouldCache: bool)
=
asyncResult {
let shouldCache = defaultArg shouldCache false
let opName = sprintf "ParseAndCheckFileInProject - %A" filePath
Expand Down Expand Up @@ -359,11 +354,8 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe
result

member x.GetUsesOfSymbol
(
file: string<LocalPath>,
options: (string * FSharpProjectOptions) seq,
symbol: FSharpSymbol
) =
(file: string<LocalPath>, options: (string * FSharpProjectOptions) seq, symbol: FSharpSymbol)
=
async {
checkerLogger.info (
Log.setMessage "GetUsesOfSymbol - {file}"
Expand Down
15 changes: 4 additions & 11 deletions src/FsAutoComplete.Core/FileSystem.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions src/FsAutoComplete.Core/InlayHints.fs
Original file line number Diff line number Diff line change
Expand Up @@ -880,12 +880,8 @@ type HintConfig =
ShowParameterHints: bool }

let provideHints
(
text: IFSACSourceText,
parseAndCheck: ParseAndCheckResults,
range: Range,
hintConfig
) : Async<Hint[]> =
(text: IFSACSourceText, parseAndCheck: ParseAndCheckResults, range: Range, hintConfig)
: Async<Hint[]> =
asyncResult {
let! cancellationToken = Async.CancellationToken

Expand Down
6 changes: 2 additions & 4 deletions src/FsAutoComplete.Core/Lexer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions src/FsAutoComplete.Core/ParseAndCheckResults.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
25 changes: 6 additions & 19 deletions src/FsAutoComplete.Core/SignatureHelp.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ type SignatureHelpInfo =
}

let private getSignatureHelpForFunctionApplication
(
tyRes: ParseAndCheckResults,
caretPos: Position,
endOfPreviousIdentPos: Position,
lines: IFSACSourceText
) : Async<SignatureHelpInfo option> =
(tyRes: ParseAndCheckResults, caretPos: Position, endOfPreviousIdentPos: Position, lines: IFSACSourceText)
: Async<SignatureHelpInfo option> =
asyncOption {
let! lineStr = lines.GetLine endOfPreviousIdentPos

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down
6 changes: 4 additions & 2 deletions src/FsAutoComplete.Core/TipFormatter.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -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 |}
>

/// <summary>
/// Generate the 'Show documentation' link for the tooltip.
Expand Down
27 changes: 8 additions & 19 deletions src/FsAutoComplete.Logging/FsOpenTelemetry.fs
Original file line number Diff line number Diff line change
Expand Up @@ -544,26 +544,20 @@ type ActivityExtensions =

[<Extension>]
static member inline SetNetworkNetTransport
(
span: Activity,
value: string<SemanticConventions.General.Network.net_transport_values>
) =
(span: Activity, value: string<SemanticConventions.General.Network.net_transport_values>)
=
span.SetTagSafe(SemanticConventions.General.Network.net_transport, UMX.untag value)

[<Extension>]
static member inline SetNetworkNetHostConnectionType
(
span: Activity,
value: string<SemanticConventions.General.Network.net_host_connection_type_values>
) =
(span: Activity, value: string<SemanticConventions.General.Network.net_host_connection_type_values>)
=
span.SetTagSafe(SemanticConventions.General.Network.net_host_connection_type, UMX.untag value)

[<Extension>]
static member inline SetNetworkNetHostConnectionSubType
(
span: Activity,
value: string<SemanticConventions.General.Network.net_host_connection_subtype_values>
) =
(span: Activity, value: string<SemanticConventions.General.Network.net_host_connection_subtype_values>)
=
span.SetTagSafe(SemanticConventions.General.Network.net_host_connection_subtype, UMX.untag value)


Expand All @@ -575,13 +569,8 @@ type ActivityExtensions =
/// <param name="escaped">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. </param>
[<Extension>]
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

Expand Down
1 change: 1 addition & 0 deletions src/FsAutoComplete/CodeFixes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module Types =
string<LocalPath> -> Async<ResultOrString<FSharp.Compiler.CodeAnalysis.FSharpProjectOptions>>

[<RequireQualifiedAccess>]
[<Struct>]
type FixKind =
| Fix
| Refactor
Expand Down
1 change: 1 addition & 0 deletions src/FsAutoComplete/CodeFixes.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module Types =
string<LocalPath> -> Async<ResultOrString<FSharp.Compiler.CodeAnalysis.FSharpProjectOptions>>

[<RequireQualifiedAccess>]
[<Struct>]
type FixKind =
| Fix
| Refactor
Expand Down
9 changes: 5 additions & 4 deletions src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ let rec nonTypedParameterName p =
| _ -> None

/// Captures a SynBinding that either has no return type or has parameters that are not typed.
[<return: Struct>]
let (|FunctionBindingWithMissingTypes|_|) =
function
| SynBinding(
headPat = SynPat.LongIdent(longDotId = lid; argPats = SynArgPats.Pats parameters) as headPat
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 _
Expand All @@ -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

/// <summary>
/// Try and find a SynBinding function where either the return type or any parameter is missing a type definition.
Expand Down
10 changes: 8 additions & 2 deletions src/FsAutoComplete/CodeFixes/AddPrivateAccessModifier.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ type SymbolUseWorkspace =
-> LineStr
-> IFSACSourceText
-> ParseAndCheckResults
-> Async<Result<System.Collections.Generic.IDictionary<FSharp.UMX.string<LocalPath>, FSharp.Compiler.Text.range array>, string>>

-> Async<
Result<
System.Collections.Generic.IDictionary<FSharp.UMX.string<LocalPath>, FSharp.Compiler.Text.range array>,
string
>
>

[<Struct>]
type private Placement =
| Before
| After
Expand Down
7 changes: 6 additions & 1 deletion src/FsAutoComplete/CodeFixes/AddPrivateAccessModifier.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ type SymbolUseWorkspace =
-> LineStr
-> IFSACSourceText
-> ParseAndCheckResults
-> Async<Result<System.Collections.Generic.IDictionary<FSharp.UMX.string<LocalPath>, FSharp.Compiler.Text.range array>, string>>
-> Async<
Result<
System.Collections.Generic.IDictionary<FSharp.UMX.string<LocalPath>, FSharp.Compiler.Text.range array>,
string
>
>

val fix:
getParseResultsForFile: GetParseResultsForFile ->
Expand Down
11 changes: 8 additions & 3 deletions src/FsAutoComplete/CodeFixes/AdjustConstant.fs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ module private Char =
let inline isSingleQuote c = c = '\''

[<RequireQualifiedAccess>]
[<Struct>]
type CharFormat =
/// `ç`
| Char
Expand Down Expand Up @@ -345,6 +346,7 @@ module private CharConstant =
ValueRange = valueRange
SuffixRange = suffixRange }

[<Struct>]
type private Sign =
| Negative
| Positive
Expand All @@ -364,6 +366,7 @@ module private Sign =
Positive, range.EmptyAtStart, range

[<RequireQualifiedAccess>]
[<Struct>]
type Base =
/// No prefix
| Decimal
Expand Down Expand Up @@ -437,10 +440,11 @@ module private IntConstant =
SuffixRange = suffixRange }

[<RequireQualifiedAccess>]
[<Struct>]
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
Expand Down Expand Up @@ -588,6 +592,7 @@ module private DigitGroup =
else
[]

[<Struct>]
type Direction =
/// thousands -> left of `.`
| RightToLeft
Expand Down
2 changes: 2 additions & 0 deletions src/FsAutoComplete/CodeFixes/AdjustConstant.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ open FsAutoComplete.CodeFix.Types
open Ionide.LanguageServerProtocol.Types

[<RequireQualifiedAccess>]
[<Struct>]
type CharFormat =
/// `ç`
| Char
Expand All @@ -17,6 +18,7 @@ type CharFormat =
| Utf32Hexadecimal

[<RequireQualifiedAccess>]
[<Struct>]
type Base =
/// No prefix
| Decimal
Expand Down
3 changes: 1 addition & 2 deletions src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit d0e13fc

Please sign in to comment.