Disable custom language plugin in certain cases / depending on language version

I'm writing a plugin for a custom language. I need to make sure that the plugin is only loaded for certain versions of the language so that it does not show false positive errors (and other things) for unsupported versions of the language.

I found some threads that say that a plugin cannot be disabled programmatically. I tried to circumvent this problem by checking the language in a startup activity (I can do this by analyzing the project's libraries), storing the result in a field and then making the functionality of instances like the annotator, completion provider, highlight visitor etc. depend on this field.

But this approach does not work for all cases. Is there any solution to this problem?

Comment actions Permalink

Simon, that's exactly the approach I can recommend you for that case. Storing such information in the projectService would make it available for all of your parts of the plugin.

Which problematic cases do you exactly mean?

Comment actions Permalink

Jakub, thanks for the quick response!

I'm looking at implementations of ParserDefinition, SyntaxHighlighterFactory, Commenter, and the fileType EP. With everything else disabled I still get syntax errors in the files (when viewing a project with an incompatible version of the language).


Please sign in to leave a comment.