I'm working on plugin for Google Protobuf and one of user created an issue for WebStorm - imports are not working there: https://github.com/protostuff/protobuf-jetbrains-plugin/issues/30
In protobuf you can import one proto file from another, using import statement. Example:
My plugin tries to resolve imports against module source roots:
VirtualFile sourceRoots = moduleRootManager.orderEntries().getAllSourceRoots()
However, this way does not work in WebStorm: if folder is marked as "Resource Root". ModuleRootManager does not have information about this folder at all.
I found a way to get "Resource Root" locations in WebStorm using com.intellij.webcore.resourceRoots.WebResourcesPathsConfiguration#getResourceRoots:
MultiMap<String, String> resourceRoots = WebResourcesPathsConfiguration.getInstance(thisModule.getProject()).getResourceRoots()
But I'm not sure that this is the right way solve this issue.
My questions are:
1. WebResourcesPathsConfiguration - it is the only way to get resource roots in WebStorm? This class is not available in IntelliJ IDEA, maybe there is something that works for all IDEs?
2. If it is the only way - is it safe to use it? I can wrap access to this class and catch ClassNotFoundException.