@@ -3,6 +3,7 @@ namespace JetBrains.ReSharper.Plugins.FSharp.ProjectModel.Diagnostic
3
3
open System
4
4
open System.Collections .Generic
5
5
open JetBrains.Application
6
+ open JetBrains.ProjectModel .ProjectsHost
6
7
open JetBrains.ProjectModel .ProjectsHost .Diagnostic
7
8
open JetBrains.ProjectModel .ProjectsHost .Impl
8
9
open JetBrains.ProjectModel .ProjectsHost .MsBuild .Diagnostic
@@ -13,33 +14,28 @@ open JetBrains.Util
13
14
[<ShellComponent>]
14
15
type FSharpProjectLoadTargetsAnalyzer () =
15
16
interface IMsBuildProjectLoadDiagnosticProvider with
16
- member x.CollectDiagnostic ( _ , _ , result ) =
17
+ member x.CollectDiagnostic ( projectMark , _ , result ) =
17
18
match result.FatalError with
18
19
| error when isNotNull error && error.PresentableText.Contains( " Microsoft.FSharp.Targets" ) ->
19
- FSharpTargetsDiagnosticMessage.InstanceCollection
20
+ [| FSharpTargetsDiagnosticMessage( projectMark ) :> ProjectLoadDiagnostic |] :> _
20
21
| _ -> EmptyArray.Instance :> _
21
22
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)
26
25
27
26
static let platformName platform =
28
27
match platform with
29
28
| PlatformUtil.Platform.MacOsX -> " mac"
30
29
| PlatformUtil.Platform.Linux -> " linux"
31
30
| _ -> " windows"
32
31
33
- private new ( ) =
32
+ new ( projectMark : IProjectMark ) =
34
33
let osName = platformName PlatformUtil.RuntimePlatform
35
- let url = sprintf " https://fsharp.org/use/%s / " osName
34
+ let url = $ " https://fsharp.org/use/%s {osName}/ "
36
35
let link = RiderContextNotificationHelper.MakeLink( url, " install F# SDK" )
37
36
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)
43
39
44
40
45
41
[<ShellComponent>]
@@ -52,15 +48,13 @@ type FSharpProjectTypeGuidAnalyzer() =
52
48
if projectMark.Location.ExtensionNoDot <> FsprojExtension then EmptyArray.Instance :> _ else
53
49
if isFSharpGuid projectMark.TypeGuid || projectMark.Guid = Guid.Empty then EmptyArray.Instance :> _ else
54
50
55
- FSharpWrongProjectTypeGuid.InstanceCollection
51
+ [| FSharpWrongProjectTypeGuid( projectMark ) :> ProjectLoadDiagnostic |] :> ICollection <_>
56
52
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?
59
55
60
56
static let [<Literal>] messageTitle = " F# project has incorrect guid"
61
57
static let [<Literal>] message = " Solution file specifies wrong project type guid."
62
58
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