|
|
|
Maybe the Language could specify a set of suppression types, and then they are overridable by the individual inspection as well.
Now I want this for my XML inspections, so I can say "suppress for this section" where section is specfic to this file type.
Sascha, you're not thinking of XML "languages" implemented through XmlElementDescriptors and custom inspections. In this case the only option would be "suppress for line" and "suppress for file" probably, even if there is some structure in the file that the plugin providing the quickfix knows about, even though it's just an XML file.
I didn't say it shouldn't be possible for such cases, but inspections for "normal" XML would greatly benefit from a mechanism that I think IDEA should provide by default. Additionally, such a hard-coded way would possibly allow a better performance of the check whether an inspection is suppressed or not.
If your case requires additional logic, a possibility to specify certain "option" actions per ProblemDescriptor that would appear in the same menu as the "Edit Inspection Settings" and "Suppress for ..." actions could of course provide that logic. I just think that the API should not imply that these option-actions suppress anything (they could actually do anything) as you originally suggested in the request. If, however, a solution is favored that does call these actions "suppress actions", I think the API should require the imlementor of the inspection to also provide a way to determine if the inspection is suppressed: public class CustomSuppressableInspection extends LocaInspectionTool { public abstract IntentionAction[] getSuppressActions(ProblemDesciptor p); public abstract boolean isSuppressedFor(PsiElement element); } Just my 2c This has become much more important with the new Language Injection API. In an XSLT file, I want to be able to suppress an inspection for an injected XPath fragment and the suppression has to be resonably done by an XML comment. Either I need a way to tell the inspection how/where to suppress it, or I need the ability to provide a couple of IntentionActions that appear in the QuickFix'es "option menu". I don't like the thought of having to provide these suppress-actions as additional quickfixes because that's totally against established UI conventions in IDEA.
Maxim, can we please get some feedback whether this will make it into the final 6.0 and how the solution might look like? Please excuse that even though this issue is currently in IDEADEV, the discussion here has been kind of a one-way street so far and I fear that any moment it will get the dreaded "Next Version" tag...
Thanks, Well, I really like your CustomSuppressableInspection API and will do my best to implement this in Demetra.
Awesome. Thanks a lot for the heads up Maxim.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
There are actually different way of implementing things like generalizing suppression stuff, which will allow meaningful suppression means for custom languages (like javascript) or in contrary the ability to hook into standard "java-level" suppression, which you're requesting AFAIK.
So, would you please describe a real use case demand you're willing to support?