@@ -3,6 +3,7 @@ namespace JetBrains.ReSharper.Plugins.FSharp.ProjectModel.Diagnostic
33open System
44open System.Collections .Generic
55open JetBrains.Application
6+ open JetBrains.ProjectModel .ProjectsHost
67open JetBrains.ProjectModel .ProjectsHost .Diagnostic
78open JetBrains.ProjectModel .ProjectsHost .Impl
89open JetBrains.ProjectModel .ProjectsHost .MsBuild .Diagnostic
@@ -13,33 +14,28 @@ open JetBrains.Util
1314[<ShellComponent>]
1415type FSharpProjectLoadTargetsAnalyzer () =
1516 interface IMsBuildProjectLoadDiagnosticProvider with
16- member x.CollectDiagnostic ( _ , _ , result ) =
17+ member x.CollectDiagnostic ( projectMark , _ , result ) =
1718 match result.FatalError with
1819 | error when isNotNull error && error.PresentableText.Contains( " Microsoft.FSharp.Targets" ) ->
19- FSharpTargetsDiagnosticMessage.InstanceCollection
20+ [| FSharpTargetsDiagnosticMessage( projectMark ) :> ProjectLoadDiagnostic |] :> _
2021 | _ -> EmptyArray.Instance :> _
2122
22- and FSharpTargetsDiagnosticMessage private ( title , message ) =
23- inherit LoadDiagnosticMessage( title, message)
24-
25- static let [<Literal>] messageTitle = " Could not open F# project"
23+ and FSharpTargetsDiagnosticMessage ( projectMark , message ) =
24+ inherit ProjectLoadError( projectMark, message)
2625
2726 static let platformName platform =
2827 match platform with
2928 | PlatformUtil.Platform.MacOsX -> " mac"
3029 | PlatformUtil.Platform.Linux -> " linux"
3130 | _ -> " windows"
3231
33- private new ( ) =
32+ new ( projectMark : IProjectMark ) =
3433 let osName = platformName PlatformUtil.RuntimePlatform
35- let url = sprintf " https://fsharp.org/use/%s / " osName
34+ let url = $ " https://fsharp.org/use/%s {osName}/ "
3635 let link = RiderContextNotificationHelper.MakeLink( url, " install F# SDK" )
3736 let message = " F# SDK or project dependencies are missing. " +
38- sprintf " Try restoring NuGet packages; if the problem persists, please %s ." link
39- FSharpTargetsDiagnosticMessage( messageTitle, message)
40-
41- static member val InstanceCollection =
42- [| FSharpTargetsDiagnosticMessage() :> ILoadDiagnostic |] :> ICollection<_>
37+ $" Try restoring NuGet packages; if the problem persists, please %s {link}."
38+ FSharpTargetsDiagnosticMessage( projectMark, message)
4339
4440
4541[<ShellComponent>]
@@ -52,15 +48,13 @@ type FSharpProjectTypeGuidAnalyzer() =
5248 if projectMark.Location.ExtensionNoDot <> FsprojExtension then EmptyArray.Instance :> _ else
5349 if isFSharpGuid projectMark.TypeGuid || projectMark.Guid = Guid.Empty then EmptyArray.Instance :> _ else
5450
55- FSharpWrongProjectTypeGuid.InstanceCollection
51+ [| FSharpWrongProjectTypeGuid( projectMark ) :> ProjectLoadDiagnostic |] :> ICollection <_>
5652
57- and FSharpWrongProjectTypeGuid private ( title , message ) =
58- inherit LoadDiagnosticMessage ( title , message)
53+ and FSharpWrongProjectTypeGuid ( projectMark , message ) =
54+ inherit ProjectLoadWarning ( projectMark , message) // todo: allow passing custom title?
5955
6056 static let [<Literal>] messageTitle = " F# project has incorrect guid"
6157 static let [<Literal>] message = " Solution file specifies wrong project type guid."
6258
63- private new () = FSharpWrongProjectTypeGuid( messageTitle, message)
64-
65- static member val InstanceCollection =
66- [| FSharpWrongProjectTypeGuid() :> ILoadDiagnostic |] :> ICollection<_>
59+ new ( projectMark : IProjectMark ) =
60+ FSharpWrongProjectTypeGuid( projectMark, message)
0 commit comments