Access Cache for external Resources 关注
IntelliJ has the ability to download XML schema for imported namespaces when I select "Fetch external resource". These files are downloaded into a cache folder. Can I somehow access this cache or even trigger the fetch from my plugin?
So far I found:
DeprecatedVirtualFileSystem fileSystem = (DeprecatedVirtualFileSystem) VirtualFileManager.getInstance().getFileSystem("http");
VirtualFile virtualFile = fileSystem.findFileByPath(uri.toString());
But using something with deprecated in its name feels wrong, and also it clearly doesn't use the same cache files as the IDE.
The “Fetch external resource” action is implemented in:
You can analyze the class code and see the details. It seems that files are stored in the path returned from
getExternalResourcesPath(). Please note that this is an internal implementation detail (see https://plugins.jetbrains.com/docs/intellij/explore-api.html#25-refrain-from-using-internal-classes), and relying on it may break in the future.
Thanks! I should have thought of looking into the source code myself.
If I decide to use this method, would a break be detected by the automatic "compatibility verification"?
Currently, it shouldn’t raise an error. You can check it by running the Gradle IntelliJ Plugin’s