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.
Related
We have a Java project in small team, all developers use Intellij IDEA.
I need to setup code style so that
some settings (for example use tabs instead of spaces, import order, threshold for asterisk import etc.) are common for all developers, these settings are obligatory and versioned in Git
tab size setting is up to each developer since it affects only appearance on his screen and not source code. It should not be versioned. Technically it should override common setting (actually its value should not be among obligatory values at all).
How to achieve it?
My attempts:
I am aware of "Stored in Project" vs "Stored in IDE" configuration where the first one is recommended to be in VCS. However, if I define common settings as "Project" configuration, user can define custom "IDE" setting and activate it instead of the "Project" configuration, not on top of it.
We also have .editorconfig file in project root with some common settings. Since the file is versioned in Git there would be great to have something like .editorconfig-gitignored file with custom settings (or put .editorconfig one level down into each subfolder, which is clumsy)
Since Intellij Idea can override project settings with .editorconfig settings, it seems to be a solution to define common settings in Idea and custom setting in (newly gitignored) .editorconfig file. Unfortunately some properties in .editorconfig are mandatory as well so I feel it would be downgrade at this moment.
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.
It's easy to share run configurations instances in IDEA - simply instantiate a configuration and check "Share":
I'm already version controlling the resulting files in .idea/runConfigurations (in the relevant project) and part of ~/.IntelliJIdea* (for puppetising desktops). However, I can't find where IDEA stores the configuration defaults - it doesn't seem to be in either of these places. They must obviously be persisting it somewhere, because it works across restarts. The official documentation is unusually unhelpful in this case:
This check box is not available when editing the run/debug configuration defaults.
The particular use case is that I'd like all future "Behave" configurations to have the environment variable DISPLAY set to :1 to run browser tests in VNC rather than in the foreground.
Defaults (the ones that you configure under Defaults node from your screenshot) are per-project .. and therefore stored together with other non-shared configs in .idea/workspace.xml (which is not supposed to be stored under VCS as it contains developer/computer specific settings).
You can find such entries in the aforementioned file under <component name="RunManager" node. Default entries will have default="true" attribute.
There is no defaults of defaults for run/debug configs that you can edit/provision (configs that would be applied to any new projects). They are not stored in separate config file(s) on IDE level but initiated directly from plugin code .
To execute my application, or run or debug unit tests, I need to enable various VM options, include -javaagent:<aspectjweaver-path> or -Djava.library.path=<some native lib path>
I can see how to change these configurations manually in IntelliJ IDEA under "Edit Configurations..."
What, if anything, do I need to check in to my VCS to share these settings with other members of my team, and ensure they pick them up automatically whenever someone changes them in the VCS?
Alternatively is there a way to set these automatically in IntelliJ without even touching the edit configurations? Especially the aspectjweaver. When I build/test my project from the command line using maven this is all handled for me by specifying argLine arguments to the surefire plugin, but IntelliJ doesn't respect these settings. Perhaps there are alternative plugins that can help me out?
First, you need to share your run configuration. It's simply done by checking the Share box right to the configuration name in the run configuration dialog:
Your run configuration will then be saved to .idea/runConfiguration (or whatever your settings folder name is).
From Jetbrains Web Help:
If this check box is selected, the run/debug configurations become available to the other team members.
The shared run/debug configurations are kept in separate xml files under .idea\runConfigurations folder, while the local run/debug configurations are kept in the .idea\workspace.xml.
This field does not appear for the default run/debug configurations.
I can configure a main file to use natives needed, but in my project there are multiple main functions so I need all the files to to use the JVM option when I can choose to debug whichever one I want without having to create a configuration for each one
You can change the configuration under Defaults node (Templates in the new versions), all the new configurations will inherit its settings. Make sure to change the correct default configuration type, Application is most likely what you need.
Refer to the documentation for details.