Different language with the same file extension

Our XML configurations have same file extension: ".xml" but quite different contents. They are located under different sub folder.

Currently all my stuffs are registered with language="XML" in plugin.xml, it works but I always need to check the file path first to distinguish the configuration type. I also have to override the default XML behavior by adding the order attribute everywhere in plugin.xml

So I'm thinking if I should create my own languages for each XML configuration type? Is that the best practice for such use case?

The next question is how can I distinguish them in FileTypeFactory? The FileTypeConsumer only check the file extension which is the same here, I need to check their parent folder name to distinguish them.

Thanks

 

4 comments

I also ran into the same issue, would be very interested in any possible solution or workaround.

 

0

I guess there should be a solution, think about the Android configuration, they are also all XMLs. I'm going to check the Android Studio source code later, maybe I can find any clue there.

0

I am in a similar situation where both mine are .cfg but vastly different. JSON like vs Perl like. Only parent folders indicate what type it truly is. Would love advice on these kinda situations....

0

Please sign in to leave a comment.