Is there a reference website/manual that documents the structure of the .iml, .iws and .ipr files from intellij? - intellij-idea

As the title suggests, is there any documentation that describes what the content of the configuration files should be? anything from an xsd to a reference manual regarding it's structure would be helpful.
I am researching how to automate the setup of my idea workspace using gradle's idea plugin.

After some correspondence with JetBrains Staff, I discovered that the XSD files are not available for public viewing.
an excerpt from the email:
"There is no complete references or XSD for these files. The format is internal and is not > designed for others to reuse."
If you want to generate projects, consider using Maven or Gradle, generate the files for these tools that IDEA will be able to import them.
Either that means JetBrains don't want you playing with their configuration files (I don't know how Gradle knows what to do) or the structure is subject to change and shouldn't be modified for backwards compatibility purposes (Say intellij updates their IDE and the config files are modified with a new structure, any programs designed to modify according to a previous structure may be invalid).

Related

Modify IntelliJ custom properties in plugin tests

I develop plugin for IntelliJ. How can I modify custom properties for my plugin tests?
For example I want to set idea.max.content.load.filesize property to, say, 100MiB
These are system properties, so java.lang.System#setProperty
Depending on the properties you wish to modify, you may be able to use idea.properties, which contains the "default properties used to run IntelliJ IDEA" (per the link you provided). To modify the file, you go to Help > Edit Custom Properties... (see these steps).
For example, I used this approach to address a problem where my machine's security software was blocking plugins that used IntelliJ's default config directory (C:\Users<user>\AppData...).
This is the Windows OS default Application Data directory and is included in the paths scanned by the security software. By moving my idea.properties file to a different directory (c:/development/idea/caches/), not automatically scanned by the security software, my plugins were no longer blocked.
It's a different use case from what you're describing, but may be an approach worth looking into.

How to share (VCS) run configurations templates with IntelliJ IDEA

I've dug a lot and learned how to share the run configurations in IntelliJ IDEA CE (presently using 2019.3.4) via the in .idea/runConfigurations/*.xml files. When we check those file into VCS (Git) others get them and all works as expected.
The question is related to sharing the templates for JUnit and Application configurations. When created manually they end up in .idea/workspace.xml which is not meant for or suitable for sharing (often modified, has personal preferences and even screen locations, ...).
I could not find any mention of how to do this so I tried extracting the relevant <component ...>...</component> fragments into standalone files inside .idea/runConfigurations/. This seemed to work but weird things started happening - IDEA renamed the files from my original names (whatever they were, forgot), to:
.idea/_template__of_JUnit.xml and
.idea/_template__of_Application.xml
I was happy with that and submitted those to Git but then other people commented how IDEA keeps renaming those files further.
What is the proper way to accomplish this?
Thanks!
IntelliJ IDEA doesn't support sharing run/debug configuration defaults at the moment.

How to add Kotlin PSI source files to IDEA Plugin project configuration

I am trying to add support for kotlin for one of the IDEA plugins.
So far, I found this page and understood that I need to work with kotlin PSI files, such as KtClass and others.
When I was setting up my project I added idea source files to sdk(by cloning this repo), to make it easier to debug + see documentation.
However it seems that these idea source files doesn't include kotlin source files, such as mentioned KtClass and others, which I use in my project. Currently I see only decompiled version of these files.
Is there any way to add them like with other IDEA source files?
Those source files belongs to the Kotlin plugin, which is not strictly a part of IntelliJ IDEA distribution. You need to add the Kotlin plugin source to the project as well as the IDEA source.
There're two modules needed:
https://github.com/JetBrains/kotlin/tree/master/idea
https://github.com/JetBrains/kotlin/tree/master/compiler/psi/src/org/jetbrains/kotlin

Is it possible to configure file types mapping in Idea via gradle 'idea' plugin

A little intro:
I work on a project with legacy codebase witch uses internal xml based descriptors with specific file extensions (about may be 10 extensions).
Let it be *.desc, *.check etc.
To have code highlighting for such a files I can configure Idea to consider these types of files as XML.
It's available through:
Preferences / Editor / File types
And then add all custom extensions to 'Recognized file types': 'XML'
Our project uses gradle as build tool
and my question is:
Is it possible to make same configuration via dsl of gadle 'idea' plugin?
The short answer is: No.
One could create a custom Gradle task that will modify IDE file type preferences XML file in the config directory. While it's possible to run such task automatically on the project refresh in IntelliJ IDEA, it will most likely not work since you can't modify IDE configuration when IDE is running (the changes will be reverted). So, you will have to run it from the command line, outside of IntelliJ IDEA when IDE is not running.
It's probably not what you want, but if documented, can be used by the team as the manual step to make this configuration change easier.
Using gradle idea is not recommended anyway.
A better way might be to provide your own IDE plug-in that will associate these file extensions with XML file type and instruct the team to install this plug-in.

xml files are not copied to target intellij idea

I have some xml files within the source folder along with the java files.
Intellij Idea is not copying them to the target folder.
I want those xml files to be along with the classes in the target.
Eclipse does this fine.
Can anyone please tell how to achieve this in Intellij Idea?
If, like me, the other answer didn't solve your problem -
If IDEA thinks your project is a Maven module (or once was), and it isn't, it'll behave like this. You can fix this by closing the project, editing the .iml file to remove the isMavenModule property, reopening, and rebuilding:
<moduleorg.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true"type="JAVA_MODULE" version="4">
In its default configuration, IDEA should copy any xml file that are in a source directory into the target directory. Other build tools may not. So this answer is assuming you are making the project via IDEA's internal build/make. If using maven (or gradle), you should place your resources in src/main/resources and not src/main/java as Engineer Dollery mentions in his/her comment.
If you are using the IDEA builds and it is still not copying them over, there is a setting you can check. Go into Settings > Build, Execution, Development > Compiler. On the Compiler settings dialog at the top is a "Resource Patterns" text field. This will define what files IDEA will and will not copy over. The default entry is:
!?*.java
!?*.form
!?*.class
!?*.groovy
!?*.scala
!?*.flex
!?*.kt
!?*.clj
!?*.aj
It is just a set of negation patterns of things not to copy over. So XML files should be copied. Check this setting and see if there is something in it to prevent xml files from being copied.