From 9a41ef0911bab7a06b6627fbfdbec6c7d34db64d Mon Sep 17 00:00:00 2001 From: nojaf Date: Tue, 20 Jun 2023 14:55:37 +0200 Subject: [PATCH] Process API changes up to 43.7.400-preview.23319.6 --- src/FsAutoComplete.Core/InlayHints.fs | 2 +- src/FsAutoComplete.Core/Lexer.fs | 2 +- .../UnionPatternMatchCaseGenerator.fs | 2 +- src/FsAutoComplete.Core/UntypedAstUtils.fs | 11 +++-------- .../CodeFixes/AddExplicitTypeAnnotation.fs | 1 - 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/FsAutoComplete.Core/InlayHints.fs b/src/FsAutoComplete.Core/InlayHints.fs index 99dfc77cd..1a8213635 100644 --- a/src/FsAutoComplete.Core/InlayHints.fs +++ b/src/FsAutoComplete.Core/InlayHints.fs @@ -31,7 +31,7 @@ and private defaultTraversePat visitor origPath pat = | SynPat.As(p1, p2, _) | SynPat.Or(p1, p2, _, _) -> [ p1; p2 ] |> List.tryPick (traversePat visitor path) | SynPat.Ands(ps, _) - | SynPat.Tuple(_, ps, _) + | SynPat.Tuple(elementPats = ps) | SynPat.ArrayOrList(_, ps, _) -> ps |> List.tryPick (traversePat visitor path) | SynPat.Attrib(p, _, _) -> traversePat visitor path p | SynPat.LongIdent(argPats = args) -> diff --git a/src/FsAutoComplete.Core/Lexer.fs b/src/FsAutoComplete.Core/Lexer.fs index 387e63972..3afa1ffbd 100644 --- a/src/FsAutoComplete.Core/Lexer.fs +++ b/src/FsAutoComplete.Core/Lexer.fs @@ -48,7 +48,7 @@ module Lexer = |> Seq.choose (fun s -> if s.StartsWith "--define:" then Some s.[9..] else None) |> Seq.toList - let sourceTokenizer = FSharpSourceTokenizer(defines, Some "/tmp.fsx") + let sourceTokenizer = FSharpSourceTokenizer(defines, Some "/tmp.fsx", None) let lineTokenizer = sourceTokenizer.CreateLineTokenizer lineStr let rec loop lexState acc = diff --git a/src/FsAutoComplete.Core/UnionPatternMatchCaseGenerator.fs b/src/FsAutoComplete.Core/UnionPatternMatchCaseGenerator.fs index 4c8b6788b..752071759 100644 --- a/src/FsAutoComplete.Core/UnionPatternMatchCaseGenerator.fs +++ b/src/FsAutoComplete.Core/UnionPatternMatchCaseGenerator.fs @@ -310,7 +310,7 @@ let getWrittenCases (patMatchExpr: PatternMatchExpr) = | SynPat.ListCons _ | SynPat.FromParseError(_, _) -> false - | SynPat.Tuple(_, innerPatList, _) -> List.forall checkPattern innerPatList + | SynPat.Tuple(elementPats = innerPatList) -> List.forall checkPattern innerPatList | SynPat.Record(recordInnerPatList, _) -> recordInnerPatList diff --git a/src/FsAutoComplete.Core/UntypedAstUtils.fs b/src/FsAutoComplete.Core/UntypedAstUtils.fs index 842328af0..a6d777564 100644 --- a/src/FsAutoComplete.Core/UntypedAstUtils.fs +++ b/src/FsAutoComplete.Core/UntypedAstUtils.fs @@ -50,8 +50,7 @@ let (|AllAttrs|) (attrs: SynAttributes) = let (|AllSimplePats|) (pats: SynSimplePats) = let rec loop acc pat = match pat with - | SynSimplePats.SimplePats(pats, _) -> acc @ pats - | SynSimplePats.Typed(pats, _, _) -> loop acc pats + | SynSimplePats.SimplePats(pats = pats) -> acc @ pats loop [] pats @@ -122,7 +121,7 @@ let internal getRangesAtPosition input (r: Position) : Range list = and walkPat = function - | SynPat.Tuple(_, pats, r) + | SynPat.Tuple(elementPats = pats; range = r) | SynPat.ArrayOrList(_, pats, r) | SynPat.Ands(pats, r) -> addIfInside r @@ -253,13 +252,9 @@ let internal getRangesAtPosition input (r: Position) : Range list = and walkSimplePats = function - | SynSimplePats.SimplePats(pats, r) -> + | SynSimplePats.SimplePats(pats = pats; range = r) -> addIfInside r List.iter walkSimplePat pats - | SynSimplePats.Typed(pats, ty, r) -> - addIfInside r - walkSimplePats pats - walkType ty and walkInterpolatedStringPart = function diff --git a/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs b/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs index c56235876..c257ff678 100644 --- a/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs +++ b/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs @@ -52,7 +52,6 @@ let private isPositionContainedInUntypedImplicitCtorParameter input pos = | _ -> None return! tryGetUntypedIdent pat - | _ -> return! None } |> Option.orElseWith (fun _ -> defaultTraverse decl) | _ -> defaultTraverse decl }