Disable custom language plugin in certain cases / depending on language version
Completed
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?
Please sign in to leave a comment.
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?
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).
Simon, sorry for the late reply – this thread got lost in a queue. Did you manage to handle it?
No problem, Jakub. I didn't find any solution and just decided to ignore it for now. Some parts (the ones for the basic handling of the language features like parsing, etc.) are still enabled but I show a dialog that they should be ignored. I remove the build process hook that prevents a successful build with compile errors which is hacky but (for now) good enough for an internal plugin.
All right, thanks for the reply. I'll close this thread and in case of any further questions, don't hesitate to create a new one.