44using JetBrains . ProjectModel ;
55using JetBrains . ReSharper . Daemon . CodeInsights ;
66using JetBrains . ReSharper . Feature . Services . Daemon ;
7+ using JetBrains . ReSharper . Features . Internal . Resources ;
78using JetBrains . ReSharper . Psi . CSharp . Tree ;
89using JetBrains . ReSharper . Psi . Tree ;
10+ using JetBrains . Rider . Backend . Platform . Icons ;
11+ using JetBrains . UI . Icons ;
912using JetBrains . Util ;
1013using 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
0 commit comments