Extending Properties language
Hello,
I'm making plugin for our internal framework.
In our framework we use extended properties files - they have a hierarchy(child can have many parents). Of course child inherit all properties from parents.
I need replace meaning(PSI) of some(not all - only in certain scope) ".properties" files - similar like Maven or Ant or Spring plugins doing for their xml configs.
I looked at Maven and Ant plugins, but they use DOM "sugar" extension points provided by the platform.
I make my FileType and Language, but I don't konow how to register language and annotate .properties files with this language only in certain scope.
Standard FileTypeFactory extension point does not suits me, because FileTypeConsumer provides only name of a file, without file path(which I need to distinguish nls files - our custom properties).
I also tried to use LanguageSubstitutor and LanguageProvider extension points - my implementation of first one is not called, and second interface is not used anywhere in IDEA sources.
The best variant for me is to extend Properties language so that nls-files will act as normal properties files, but if I need I'll be able to get
extended PSI(for example to make custom completion contributor). But I don't want to modify Properties plugin sources - I want make plugin on top of Properties plugin.
Can you suggest starting points or examples for this?
Thanks in advance.
请先登录再写评论。
LanguageSubstitutor is the correct API to use for this scenario. How did you register your implementation?
Thanks Dmitry, but it's really strange - method com.intellij.psi.LanguageSubstitutors#substituteLanguage is called for Properties language, but my extension not loaded, don't know why.
I'm really sorry - I found cause of my problems:
Plugin was disabled :) - stupid bug.
Answered, thanks.