Skip to content

Commit

Permalink
minimal code changes to adjust to API surface area
Browse files Browse the repository at this point in the history
  • Loading branch information
baronfel committed Aug 8, 2023
1 parent 72103b5 commit cb7a303
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 35 deletions.
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ lowest_matching: true

nuget BenchmarkDotNet 0.13.5
nuget Fantomas.Client >= 0.9
nuget FSharp.Compiler.Service >= 43.7.300
nuget FSharp.Compiler.Service >= 43.7.400
nuget Ionide.ProjInfo >= 0.61.3
nuget Ionide.ProjInfo.FCS >= 0.61.3
nuget Ionide.ProjInfo.ProjectSystem >= 0.61.3
Expand Down
29 changes: 15 additions & 14 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ NUGET
FSharp.Compiler.Service (>= 41.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) (&& (== netstandard2.1) (>= net5.0))
FSharp.Core (>= 6.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) (&& (== netstandard2.1) (>= net5.0))
McMaster.NETCore.Plugins (>= 1.4) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) (&& (== netstandard2.1) (>= net5.0))
FSharp.Compiler.Service (43.7.300)
FSharp.Core (7.0.300)
FSharp.Compiler.Service (43.7.400)
FSharp.Core (7.0.400)
System.Buffers (>= 4.5.1)
System.Collections.Immutable (>= 6.0)
System.Diagnostics.DiagnosticSource (>= 6.0)
System.Collections.Immutable (>= 7.0)
System.Diagnostics.DiagnosticSource (>= 7.0.2)
System.Memory (>= 4.5.5)
System.Reflection.Emit (>= 4.7)
System.Reflection.Metadata (>= 6.0.1)
System.Reflection.Metadata (>= 7.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
FSharp.Control.AsyncSeq (3.2.1)
FSharp.Core (>= 4.7.2)
Microsoft.Bcl.AsyncInterfaces (>= 5.0)
FSharp.Control.Reactive (5.0.5) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
FSharp.Core (>= 4.7.2)
System.Reactive (>= 5.0 < 6.0)
FSharp.Core (7.0.300)
FSharp.Core (7.0.400)
FSharp.Data.Adaptive (1.2.13)
FSharp.Core (>= 4.7)
System.Reflection.Emit.Lightweight (>= 4.6)
Expand Down Expand Up @@ -395,9 +395,9 @@ NUGET
System.Threading.Tasks.Dataflow (>= 6.0)
System.Buffers (4.5.1)
System.CodeDom (6.0) - copy_local: false
System.Collections.Immutable (6.0)
System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) (== netstandard2.1)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Collections.Immutable (7.0)
System.Memory (>= 4.5.5) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) (== netstandard2.1)
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (== net6.0) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) (== netstandard2.1)
System.CommandLine (2.0.0-beta4.22272.1)
System.Memory (>= 4.5.4) - restriction: || (&& (== net7.0) (< net6.0)) (== netstandard2.0) (== netstandard2.1)
System.ComponentModel.Annotations (5.0) - restriction: || (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0)
Expand All @@ -420,9 +420,9 @@ NUGET
System.Configuration.ConfigurationManager (6.0)
System.Security.Cryptography.ProtectedData (>= 6.0)
System.Security.Permissions (>= 6.0)
System.Diagnostics.DiagnosticSource (6.0)
System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< net5.0)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< net5.0)) (== netstandard2.0) (== netstandard2.1)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Diagnostics.DiagnosticSource (7.0.2)
System.Memory (>= 4.5.5) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) (== netstandard2.1)
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (== net6.0) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) (== netstandard2.1)
System.Drawing.Common (6.0) - copy_local: false, restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
Microsoft.Win32.SystemEvents (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
System.Formats.Asn1 (6.0) - copy_local: false
Expand All @@ -445,8 +445,9 @@ NUGET
System.Reflection.Emit.ILGeneration (4.7) - restriction: || (&& (== net7.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= uap10.1)) (== netstandard2.0) (&& (== netstandard2.1) (< netstandard1.1)) (&& (== netstandard2.1) (< netstandard2.0)) (&& (== netstandard2.1) (>= uap10.1))
System.Reflection.Emit.Lightweight (4.7)
System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== net6.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (< portable-net45+wp8)) (&& (== net6.0) (>= uap10.1)) (&& (== net7.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (< portable-net45+wp8)) (&& (== net7.0) (>= uap10.1)) (== netstandard2.0) (&& (== netstandard2.1) (< netstandard2.0)) (&& (== netstandard2.1) (< portable-net45+wp8)) (&& (== netstandard2.1) (>= uap10.1))
System.Reflection.Metadata (6.0.1)
System.Collections.Immutable (>= 6.0)
System.Reflection.Metadata (7.0)
System.Collections.Immutable (>= 7.0)
System.Memory (>= 4.5.5) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) (== netstandard2.1)
System.Resources.Extensions (6.0) - copy_local: false
System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) (== netstandard2.1)
System.Runtime.CompilerServices.Unsafe (6.0)
Expand Down
11 changes: 6 additions & 5 deletions src/FsAutoComplete.Core/CompilerServiceInterface.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize) =
let checker =
FSharpChecker.Create(
projectCacheSize = 200,
keepAllBackgroundResolutions = true,
keepAssemblyContents = hasAnalyzers,
keepAllBackgroundResolutions = true,
suggestNamesForErrors = true,
enablePartialTypeChecking = not hasAnalyzers,
keepAllBackgroundSymbolUses = true,
enableBackgroundItemKeyStoreAndSemanticClassification = true,
keepAllBackgroundSymbolUses = true
enablePartialTypeChecking = not hasAnalyzers,
parallelReferenceResolution = true,
captureIdentifiersWhenParsing = true,
useSyntaxTreeCache = true
)



let entityCache = EntityCache()

// This is used to hold previous check results for autocompletion.
Expand Down
2 changes: 1 addition & 1 deletion src/FsAutoComplete.Core/InlayHints.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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(_, ps, _, _)
| SynPat.ArrayOrList(_, ps, _) -> ps |> List.tryPick (traversePat visitor path)
| SynPat.Attrib(p, _, _) -> traversePat visitor path p
| SynPat.LongIdent(argPats = args) ->
Expand Down
31 changes: 26 additions & 5 deletions src/FsAutoComplete.Core/Lexer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,35 @@ type private DraftToken =
module Lexer =
let logger = LogProvider.getLoggerByName "Lexer"

[<return: Struct>]
let (|Define|_|) (a: string) =
if a.StartsWith "--defin:" then
ValueSome(a.[9..])
else
ValueNone

[<return: Struct>]
let (|LangVersion|_|) (a: string) =
if a.StartsWith "--langversion:" then
ValueSome(a.[14..])
else
ValueNone

/// Return all tokens of current line
let tokenizeLine (args: string[]) lineStr =
let defines =
args
|> Seq.choose (fun s -> if s.StartsWith "--define:" then Some s.[9..] else None)
|> Seq.toList
let defines, langVersion =
((ResizeArray(), None), args)
||> Array.fold (fun (defines, langVersion) arg ->
match arg with
| Define d ->
defines.Add(d)
defines, langVersion
| LangVersion v -> defines, Some(v)
| _ -> defines, langVersion)

let sourceTokenizer =
FSharpSourceTokenizer(Seq.toList defines, Some "/tmp.fsx", langVersion)

let sourceTokenizer = FSharpSourceTokenizer(defines, Some "/tmp.fsx")
let lineTokenizer = sourceTokenizer.CreateLineTokenizer lineStr

let rec loop lexState acc =
Expand Down
2 changes: 1 addition & 1 deletion src/FsAutoComplete.Core/UnionPatternMatchCaseGenerator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ let getWrittenCases (patMatchExpr: PatternMatchExpr) =
| SynPat.ListCons _
| SynPat.FromParseError(_, _) -> false

| SynPat.Tuple(_, innerPatList, _) -> List.forall checkPattern innerPatList
| SynPat.Tuple(_, innerPatList, _, _) -> List.forall checkPattern innerPatList

| SynPat.Record(recordInnerPatList, _) ->
recordInnerPatList
Expand Down
12 changes: 4 additions & 8 deletions src/FsAutoComplete.Core/UntypedAstUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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, _, _) -> acc @ pats

loop [] pats

Expand Down Expand Up @@ -122,7 +121,7 @@ let internal getRangesAtPosition input (r: Position) : Range list =

and walkPat =
function
| SynPat.Tuple(_, pats, r)
| SynPat.Tuple(_, pats, _, r)
| SynPat.ArrayOrList(_, pats, r)
| SynPat.Ands(pats, r) ->
addIfInside r
Expand Down Expand Up @@ -243,6 +242,7 @@ let internal getRangesAtPosition input (r: Position) : Range list =
addIfInside r
walkType lhs
walkType rhs
| SynType.FromParseError(r) -> addIfInside r

and walkClause (SynMatchClause(pat, e1, e2, r, _, _)) =
addIfInside r
Expand All @@ -252,13 +252,9 @@ let internal getRangesAtPosition input (r: Position) : Range list =

and walkSimplePats =
function
| SynSimplePats.SimplePats(pats, r) ->
| SynSimplePats.SimplePats(pats, _, r) ->
addIfInside r
List.iter walkSimplePat pats
| SynSimplePats.Typed(pats, ty, r) ->
addIfInside r
walkSimplePats pats
walkType ty

and walkInterpolatedStringPart =
function
Expand Down

0 comments on commit cb7a303

Please sign in to comment.