External annotators for a base language are ignored when another external annotator exists for a more specific flavor Follow
It seems that external annotators for a base language are ignored when another external annotator exists for a more specific flavor. This leads to conflicting behavior in plugins that act as external annotators, such as SonarLint, ESLint, Flow. This is a new behavior in 2016.3, there was no such problem in 2016.2.x and earlier.
For example given this scenario:
This is a regression, because up until 2016.2.5 there was no problem, all annotations were shown from these plugins.
The problem is reproducible by having the ESLint plugin together with a custom plugin registering external annotators:
<externalAnnotator language="Flow JS" implementationClass="..."/>
The annotations by ESLint will not be visible in 2016.3, even though they are visible in 2016.2.5.
I created a ticket for this: https://youtrack.jetbrains.com/issue/WEB-24475
I hope somebody can look at it soon, as not being able to use multiple plugins is hurting the efforts of developers to catch the most number of defects and bad practices, unless they downgrade to 2016.2.x.
Please sign in to leave a comment.
That's how language extension points used to work for quite a while, are you sure that you haven't started registering new annotator recently?
It's not always correct to pick language extensions (even annotators) from a parent language (e.g. not all linters can handle Flow)
> That's how language extension points used to work for quite a while, are you sure that you haven't started registering new annotator recently?
No, we haven't registered new annotators recently. My original assumption was that something changed in SonarLint at some point, so I tested versions of this year and last year against IntelliJ 2016.3. The behavior was always the same, ESLint annotations not visible. Then I repeated my tests in older IntelliJ versions, and confirmed that all annotations of all plugins are visible in 2016.2.5 and other earlier versions I tested. It seems evident that something has changed in 2016.3.
Nope, I'm suggesting the other way around: register as a less specific flavour.
Here is the link to the SonarLint plugin: https://plugins.jetbrains.com/plugin/7973
As explained by Janos, it seems that there is an important regression in IDEA 2016.3 in the way external annotators are handled. The collection of external annotators is done from bottom-up (more specific first) in the hierarchy of languages. As soon as one annotator is found for a language, all other annotators of all base languages up in the hierarchy are ignored.
This flawed strategy is defined by the following method: https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/lang/LanguageExtension.java#L76
This issue will potentially have an impact on any plugin using external annotators registered to a language which is not the most specific one, since those annotators might never be used.
I've pushed a change to master that will collect external annotators for all base languages. It will be available in the second 2017.1 EAP, let's see how it goes