What do you think about an IntelliJ plugin for Moqui that will automatically configure the XSD schema?
I’ve just thought about how annoying it is to setup the XSD fschema or each different moqui file that you use and an IntelliJ plugin that would automatically configure the XSD schema automatically.
Maybe the simplest way to solve this problem is by creating a simple gradle task like setupIdeaCatalog that parses the catalog and apply it automatically to misc.xml. It’s relatively easy to do and keeps the solution inside moqui (avoiding yet another thing to download / learn). Gradle / groovy also comes with all the XML parsing you need to build the catalog settings so you won’t need to import / add anything.
@taher So are you saying that IntelliJ will automatically inherit the gradle / groovy parsing settings, and one of the settings for gradle / groovy is where the XSD schema is defined?
If so, that shouldn’t be difficult at all.
Another simpler solution would be to find the easiest way to setup XSD schema globally (currently I have to setup the XSD schema for each moqui project that I have and it gets annoying.
What I mean is simply calling a task that generates a .idea/misc.xml and hence your auto-complete from XSDs would work. I’ve already implemented such a task and thus I don’t need to touch the catalog settings. I just run ./gradlew setupIntellij and I’m good. The whole task is around like 20 lines of code and uses XmlSlurper with StreamingMarkupBuilder to do the job.
If you find such a feature useful I’d gladly do a PR or submit the code in whatever form you like. I actually have 2 tasks, one for intellij and one for visual studio code (both of which are awesome editors).
I’d love it if you would submit a PR to the moqui organization repositories that are needed, and I’d also like it if I you could send me the code / fork that you have sooner rather than later so that I can use it.
No worries. I added your code to the end of my moqui-framework build.gradle file and when I ran gradle setupIntelliJ IntelliJ got the external schemas, but the URLs are invalid.
Hmm could be a bug somewhere in my submitted code, I’ll review it and fix it. Might as well just do a PR based on all of that and get it out of the way
One thing I noticed when I tried this is that it kills an existing misc.xml file, so if used on an existing IntelliJ project it will clear settings like the JDK selected, etc.
It would get the logic a little bigger, but I can make it append the catalogs instead of replacing the entire misc file if you believe that this is a better approach?
This is an updated version (I need to get rid of a little copy-paste) that does not destroy misc.xml if it already exists and just rebuilds the resources. WDYT?