Skip to content

Commit 00bb1bd

Browse files
authored
add icon to error hotspot (#149)
Signed-off-by: shalom <[email protected]> Signed-off-by: shalom <[email protected]>
1 parent f40e4dc commit 00bb1bd

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

rider/Digma.Rider.Plugin/Digma.Rider/Highlighting/CodeObjectsHighlighter.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
using JetBrains.ProjectModel;
55
using JetBrains.ReSharper.Daemon.CodeInsights;
66
using JetBrains.ReSharper.Feature.Services.Daemon;
7+
using JetBrains.ReSharper.Features.Internal.Resources;
78
using JetBrains.ReSharper.Psi.CSharp.Tree;
89
using JetBrains.ReSharper.Psi.Tree;
10+
using JetBrains.Rider.Backend.Platform.Icons;
11+
using JetBrains.UI.Icons;
912
using JetBrains.Util;
1013
using static Digma.Rider.Logging.Logger;
1114

@@ -18,17 +21,19 @@ public class CodeObjectsHighlighter : ElementProblemAnalyzer<ICSharpFunctionDecl
1821
private readonly CodeObjectsHost _codeObjectsHost;
1922
private readonly ErrorHotspotMethodInsightsProvider _errorHotspotMethodInsightsProvider;
2023
private readonly UsageMethodInsightsProvider _usageMethodInsightsProvider;
24+
private readonly IconHost _iconHost;
2125

2226
public CodeObjectsHighlighter(ILogger logger,
2327
CodeObjectsHost codeObjectsHost,
2428
ISolution solution,
2529
ErrorHotspotMethodInsightsProvider errorHotspotMethodInsightsProvider,
26-
UsageMethodInsightsProvider usageMethodInsightsProvider)
30+
UsageMethodInsightsProvider usageMethodInsightsProvider,IconHost iconHost)
2731
{
2832
_logger = logger;
2933
_codeObjectsHost = codeObjectsHost;
3034
_errorHotspotMethodInsightsProvider = errorHotspotMethodInsightsProvider;
3135
_usageMethodInsightsProvider = usageMethodInsightsProvider;
36+
_iconHost = iconHost;
3237
}
3338

3439
protected override void Run(ICSharpFunctionDeclaration functionDeclaration,
@@ -51,14 +56,19 @@ protected override void Run(ICSharpFunctionDeclaration functionDeclaration,
5156
? _errorHotspotMethodInsightsProvider
5257
: _usageMethodInsightsProvider;
5358

59+
var icon =
60+
riderCodeLensInfo.Type.Equals(CodeLensType.ErrorHotspot)
61+
? _iconHost.Transform(Icons.ExclMark)
62+
: null;
63+
5464
highlightingConsumer.AddHighlighting(
5565
new CodeInsightsHighlighting(
5666
functionDeclaration.GetNameDocumentRange(),
5767
riderCodeLensInfo.LensText ?? throw new InvalidOperationException("LensText must not be null"),
5868
riderCodeLensInfo.LensTooltip ?? string.Empty, //todo: can be null
5969
riderCodeLensInfo.MoreText ?? string.Empty, //todo: can be null
6070
codeInsightsProvider,
61-
functionDeclaration.DeclaredElement,null)
71+
functionDeclaration.DeclaredElement,icon)
6272
);
6373
}
6474

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using JetBrains.RdBackend.Common.Features.Icons;
2+
3+
namespace Digma.Rider.Highlighting
4+
{
5+
public class Icons
6+
{
7+
public static FrontendIconId ExclMark = new FrontendIconId("icons/exclMark.svg");
8+
}
9+
}
Lines changed: 7 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)