-
Notifications
You must be signed in to change notification settings - Fork 162
Allow analyzer to be loaded from nuget #1419
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
Conversation
…s around loading analyzers
4ceed12 to
91f874c
Compare
| let analyzerPredicate (analyzer: FSharp.Analyzers.SDK.Client.RegisteredAnalyzer<EditorContext>) = | ||
| let inline inMainAnalyzer () = | ||
| analyzerPaths | ||
| |> Array.exists (fun p -> p = IO.Path.GetDirectoryName analyzer.AssemblyPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this logic correct?
I updated to the latest versions of everything in one of my solutions and noticed there were no analyser warnings reported in one of my projects in Ionide any more, even though logging showed that the analzer dlls had been loaded ok.
I tried logging the analyzerPaths and AssemblyPaths here and got this;
[15:13:57.752 INF] [FsAutoComplete.Analyzers] analyzerPaths entry s:/BJKCTitDev/DocLabellerMicro/DocLabellerMicro\analyzers, analyzer.AssemblyPath s:/BJKCTitDev/DocLabellerMicro/DocLabellerMicro\analyzers\ionide.analyzers\0.14.9\analyzers\dotnet\fs\Ionide.Analyzers.dll
Which suggests that it's not running the anayzers if the dll is in a subdirectory of the analyzers path rather than directly under it, even though the analyzer loader has actually loaded the dlls?
Also, the path seprators are a combination of '/' and '\', which might not help if this is doing plain string comparisons on the path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This solution is set up so the 'analyzers' path points to an 'analyzers' folder under the solution root folder, and then the Ionide and G-Research analyzers are in subdirectories under that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely correct!™️ I need to use Uri and IsBaseOf to make sure I'm comparing paths correctly. Let me fix this.
Builds upon:
Loads analyzers when using using nuget
Log output:
Handles each project only running the analyzers specified in it's respective proj file.
For example,
IcedTasks.fsprojhasIonide.Analyzersas aPackageReference:Log output:
Whereas
IcedTasks.Tests.fsprojdoes notLog output: