idea-php-annotation-plugin icon indicating copy to clipboard operation
idea-php-annotation-plugin copied to clipboard

Warnings on non-imported annotations

Open mnapoli opened this issue 11 years ago • 10 comments

Depending on the configuration, you sometimes don't need to import annotations. However the plugin will add warnings on every not-imported annotation.

Would it be possible to disable this behavior, or make an option to disable it?

mnapoli avatar Jun 25 '14 08:06 mnapoli

so highlighting should be moved from annotation extension itself to inspections, so then it can be disabled. also thinking of add whitelist ui in settings, also getting some failreports on drupal8

Haehnchen avatar Jul 28 '14 18:07 Haehnchen

Would also be interested in seeing this fixed. As you say, this occurs quite often in Drupal 8. Having an inspection setting for this ("Warn about missing annotation imports") would be perfect! Also, the warning has only the label "Import" and currently links to "General » Annotator" – the former a bit monosyllabic, the latter pretty confusing.

(See also: http://youtrack.jetbrains.com/issue/WI-24731)

drunken-monkey avatar Sep 09 '14 12:09 drunken-monkey

Yeah I keep getting missing import as well whereas its not needed .. highly annoying as it highlights all the annotations..

davidsielert avatar Nov 21 '14 05:11 davidsielert

Ideally, the warning should be smart enough not to warn when the annotations are used in a Drupal 8 context, but to warn in more typical situations where they are needed. This probably needs a degree of cooperation with the Drupal support plugin.

fgm avatar Nov 29 '15 11:11 fgm

Is there any update on this?

acelayawonnova avatar Apr 04 '16 14:04 acelayawonnova

Chiming in here as well to see if any progress been made. Happy to help if given some guidance :)

sylus avatar Aug 15 '16 18:08 sylus

The warning is created here, I would guess it should be possible to find out whether the inspection defined as localInspection groupPath="PHP" shortName="AnnotationMissingUseInspection" displayName="Missing Import" etc is enabled or not and change this to createInfoAnnotation when not.. A bit shooting in the dark as I am not particularly familiar with the class hierarchy of IDEA but getting there. @sylus is this enough to start?

chx avatar Oct 24 '16 07:10 chx

Given a scenario where both types of annotations are used: How should this plugin decide which annotation needs importing and which does not?

donquixote avatar Aug 09 '17 18:08 donquixote

Given a scenario where both types of annotations are used: How should this plugin decide which annotation needs importing and which does not?

If fixing this just for Drupal 8 (don't know whether import-less annotations exist in other projects and, if so, how common they are), it might be possible to either cooperate with the "Drupal" plugin, or to just look whether an annotation with that classname exists in some sub-namespace of \Drupal. However, only a single person here has actually requested this, I think the much more typical case is just wanting to disable the warnings completely. Also, currently I can't even reproduce the problem anymore. I have enabled the new PHP > Annotation > Missing Import inspection, but I still don't get any warnings for them. That actually seems like a new bug caused by this. But in general, with this setting now present, it looks like this is resolved as far as my requirements are concerned. So thanks a lot for that!

drunken-monkey avatar Aug 13 '17 09:08 drunken-monkey

only a single person here has actually requested this

Make this +1 :) I am working on something where I would have a Drupal module which uses Drupal and non-Drupal annotations.

I think the much more typical case is just wanting to disable the warnings completely.

Problem is, those annotations that do require an import won't work without it. So for those I really would appreciate the warning.

or to just look whether an annotation with that classname exists in some sub-namespace of \Drupal

Maybe implement this for a start, and then if the question pops up again, make these namespaces somehow configurable.

donquixote avatar Aug 13 '17 14:08 donquixote