Skip to content

Conversation

@TheAngryByrd
Copy link
Member

@TheAngryByrd TheAngryByrd commented Oct 5, 2025

Builds upon:

Loads analyzers when using using nuget

    <PackageReference Include="Ionide.Analyzers" PrivateAssets="All" />

Log output:

[18:10:08.278 INF] [FsAutoComplete.Analyzers] Loading analyzers from {"PropertyName": "PkgIonide_Analyzers", "NugetPackageRoot": "C:\\Users\\jimmy\\.nuget\\packages\\ionide.analyzers\\0.14.7", "DllRootPath": "C:\\Users\\jimmy\\.nuget\\packages\\ionide.analyzers\\0.14.7\\analyzers\\dotnet\\fs", "$type": "Analyzer"}
[18:10:08.366 INF] [FsAutoComplete.Analyzers] 1 dlls including 11 analyzers with 0 failed assemblies

Handles each project only running the analyzers specified in it's respective proj file.

For example, IcedTasks.fsproj has Ionide.Analyzers as a PackageReference:

Log output:

[18:11:25.672 INF] [FsAutoComplete.Analyzers] begin analysis of c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.726 INF] [FsAutoComplete.Lsp.AdaptiveFSharpLspServer] TextDocumentDocumentSymbol Request: {"WorkDoneToken": null, "PartialResultToken": null, "TextDocument": {"Uri": "file:///c%3A/Users/jimmy/Repositories/public/TheAngryByrd/IcedTasks/src/IcedTasks/Task.fs", "$type": "TextDocumentIdentifier"}, "$type": "DocumentSymbolParams"}
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer StructDiscriminatedUnionAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer EqualsNullAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer CombinePipedModuleFunctionsAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer ReturnStructPartialActivePatternAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer ListEqualsEmptyListAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer HeadConsEmptyListPatternAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer HandleOptionGracefullyAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer EmptyStringAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer UnnamedDiscriminatedUnionFieldAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer IgnoreFunctionAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] Analyzer CopyAndUpdateRecordChangesAllFieldsAnalyzer returned 0 diagnostics for file c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs
[18:11:25.739 INF] [FsAutoComplete.Analyzers] end analysis of c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\src\IcedTasks\Task.fs

Whereas IcedTasks.Tests.fsproj does not

Log output:

[18:22:43.884 INF] [FsAutoComplete.Analyzers] begin analysis of c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\tests\IcedTasks.Tests\Expect.fs
[18:22:43.884 INF] [FsAutoComplete.Analyzers] end analysis of c:\Users\jimmy\Repositories\public\TheAngryByrd\IcedTasks\tests\IcedTasks.Tests\Expect.fs

@TheAngryByrd TheAngryByrd merged commit ae3559f into ionide:main Oct 19, 2025
let analyzerPredicate (analyzer: FSharp.Analyzers.SDK.Client.RegisteredAnalyzer<EditorContext>) =
let inline inMainAnalyzer () =
analyzerPaths
|> Array.exists (fun p -> p = IO.Path.GetDirectoryName analyzer.AssemblyPath)
Copy link
Contributor

@Numpsy Numpsy Oct 20, 2025

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?

Copy link
Contributor

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)

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants