How to get plugin warnings into Inspection Severity dialog?

Hi, I want my plugin warnings to be manageable from "Inspection Severity" dialog. (I use R# 7.1)

options.png

Looks like it's done via ConfigurableSeverityHighlighting attribute on the highlighting, but I'm not sure now - apparently some native Resharper highlightings are marked as static highlightings (eg, ModuleQualificationMissingError) but still seem to be customizable via severity settings.

For now I have a simple DaemonStageProcess which pushes highlightings into Action<DaemonStageResult> commiter. Highlighting code looks like this:

[StaticSeverityHighlighting(Severity.WARNING, WebConfigLanguage.Name, OverlapResolve = OverlapResolveKind.WARNING)]
 public class FooHighlighting : IHighlighting
 {

 public FooHighlighting()

 {

 ToolTip = "foo";

 }


 public string ToolTip { get; private set; }

 public string ErrorStripeToolTip { get { return ToolTip; } }

 public int NavigationOffsetPatch { get { return 0; } }

 public bool IsValid() { return true; }
 }



So I want severity settings for this one to appear under "Potential Code Quality Issues" for web.config inspections. What's the best way to do that?
2 comments
Comment actions Permalink

Hi Andrew. The key is to register the highlighter as configurable. You need to create an assembly level attribute using RegisterConfigurableSeverityAttribute, passing in the same id that you use in the ConfigurableSeverityHighlightingAttribute on the highlighting class. It allows you to specfiy the default severity and groups that the setting should be displayed in. And this is why ModuleQualificationMissingError is displayed in the config pages, even though the class is marked as static severity (I'm a little surprised they're different to be honest, that might be a bug).

Let me know how you get on

Thanks
Matt

0
Comment actions Permalink

Hi Matt - thanks, that worked.

0

Please sign in to leave a comment.