Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FSharp.Analyzers.SDK to 0.13.0 #1163

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ NUGET
StreamJsonRpc (>= 2.8.28)
FParsec (1.1.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) (&& (== netstandard2.1) (>= net5.0))
FSharp.Core (>= 4.3.4)
FSharp.Analyzers.SDK (0.11)
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.Analyzers.SDK (0.13)
FSharp.Compiler.Service (>= 43.7.400) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
FSharp.Core (>= 7.0.400) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
McMaster.NETCore.Plugins (>= 1.4) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
FSharp.Compiler.Service (43.7.400)
FSharp.Core (7.0.400)
System.Buffers (>= 4.5.1)
Expand Down Expand Up @@ -154,7 +154,7 @@ NUGET
Newtonsoft.Json (>= 13.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
Ionide.ProjInfo.Sln (0.62)
LinkDotNet.StringBuilder (1.18)
McMaster.NETCore.Plugins (1.4) - 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) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
Microsoft.DotNet.PlatformAbstractions (>= 3.1.6) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp2.1)) (&& (== netstandard2.1) (>= netcoreapp2.1))
Microsoft.Extensions.DependencyModel (>= 5.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp2.1)) (&& (== netstandard2.1) (>= netcoreapp2.1))
MessagePack (2.4.35)
Expand Down Expand Up @@ -273,7 +273,7 @@ NUGET
Microsoft.Extensions.DependencyInjection.Abstractions (6.0)
Microsoft.Bcl.AsyncInterfaces (>= 6.0) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) (&& (== netstandard2.1) (>= net461))
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) (&& (== netstandard2.1) (>= net461))
Microsoft.Extensions.DependencyModel (6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) (&& (== netstandard2.1) (>= net5.0))
Microsoft.Extensions.DependencyModel (6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
System.Buffers (>= 4.5.1)
System.Memory (>= 4.5.4)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
Expand Down
20 changes: 8 additions & 12 deletions src/FsAutoComplete.Core/Commands.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1147,14 +1147,17 @@ module Commands =



let analyzerHandler (file: string<LocalPath>, content, pt, tast, symbols, getAllEnts) =
let analyzerHandler (file: string<LocalPath>, content, parseAndCheck: ParseAndCheckResults, tast) =
let ctx: SDK.Context =
{ FileName = UMX.untag file
Content = content
ParseTree = pt
TypedTree = tast
Symbols = symbols
GetAllEntities = getAllEnts }
GetAllEntities = parseAndCheck.GetAllEntities
ParseFileResults = parseAndCheck.GetParseResults
CheckFileResults = parseAndCheck.GetCheckResults
CheckProjectResults = Unchecked.defaultof<FSharpCheckProjectResults>
AllSymbolUses = Array.empty
SymbolUsesOfFile = parseAndCheck.GetCheckResults.GetAllUsesOfAllSymbolsInFile() |> Seq.toArray }

let extractResultsFromAnalyzer (r: SDK.AnalysisResult) =
match r.Output with
Expand Down Expand Up @@ -1292,14 +1295,7 @@ type Commands
| true, fileData ->

let res =
Commands.analyzerHandler (
file,
fileData.Source.ToString().Split("\n"),
parseAndCheck.GetParseResults.ParseTree,
tast,
parseAndCheck.GetCheckResults.PartialAssemblySignature.Entities |> Seq.toList,
parseAndCheck.GetAllEntities
)
Commands.analyzerHandler (file, fileData.Source.ToString().Split("\n"), parseAndCheck, tast)

(res, file) |> NotificationEvent.AnalyzerMessage |> notify.Trigger

Expand Down
13 changes: 4 additions & 9 deletions src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ type AdaptiveFSharpLspServer

Loggers.analyzers.info (Log.setMessageI $"Loading analyzers from {dir:dir}")

let (dllCount, analyzerCount) = dir |> FSharp.Analyzers.SDK.Client.loadAnalyzers
let dllCount, analyzerCount =
dir
|> FSharp.Analyzers.SDK.Client.loadAnalyzers (fun error -> Loggers.analyzers.error (Log.setMessage error))

Loggers.analyzers.info (
Log.setMessageI
Expand Down Expand Up @@ -391,14 +393,7 @@ type AdaptiveFSharpLspServer
do! Async.SwitchToNewThread()

let res =
Commands.analyzerHandler (
file,
volatileFile.Source.ToString().Split("\n"),
parseAndCheck.GetParseResults.ParseTree,
tast,
parseAndCheck.GetCheckResults.PartialAssemblySignature.Entities |> Seq.toList,
parseAndCheck.GetAllEntities
)
Commands.analyzerHandler (file, volatileFile.Source.ToString().Split("\n"), parseAndCheck, tast)

let! ct = Async.CancellationToken
notifications.Trigger(NotificationEvent.AnalyzerMessage(res, file), ct)
Expand Down
4 changes: 3 additions & 1 deletion src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory
>> Log.addContextDestructured "dir" dir
)

let (n, m) = dir |> SDK.Client.loadAnalyzers
let n, m =
dir
|> SDK.Client.loadAnalyzers (fun error -> Loggers.analyzers.error (Log.setMessage error))

Loggers.analyzers.info (
Log.setMessage "From {name}: {dllNo} dlls including {analyzersNo} analyzers"
Expand Down
Loading