AppCode plugin development: How to run/debug from Idea CE

Answered

I was about to post a question on how to run/debug a plugin I'm playing with for AppCode, since the default plugin run config crashes during startup.

However, since I just figured it out, I'll post it as a tip instead.


This assumes that you have the plugin project loaded in IntelliJ IDEA (Community edition or Ultimate).

1. Ensure that you have the IDEA Plugin SDK for the project set to use your AppCode installation

2. Create a Plugin run configuration for your plugin

3. Add the following to the VM parameters field for your new run configuration:
-Didea.paths.selector=appCode10 -Didea.platform.prefix=CIDR


That allowed me to run my plugin from IDEA, which means you can have your plugin running in the integrated debugger instead of using the old debug-by-println method.

6 comments

As a followup, adding the following options in addition to the ones above will ensure that the test environment has enough memory to actually do something instead of locking up due to lack of memory:

-d32 -Xms128m -Xmx512m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=64m

These are the same settings that AppCode ships with (except of -d32 to force 32 bit mode), but they're not automatically picked up by the normal plugin launcher, so we need to add them to the VM arguments are manually.

0

Is the flags still working, the ones you indicated? -Didea.paths.selector=appCode10 -Didea.platform.prefix=CIDR . 

I was trying to use it in my project, but Intellij Idea is opening instead of AppCode? 

Is there another way now to debug a AppCode plugin?

0

The correct platform prefix for AppCode is "AppCode", but I think there are other problems with your project. Did you perform the very first step from Maarten's post? "Ensure that you have the IDEA Plugin SDK for the project set to use your AppCode installation".

0

Thank you for message.

That's my path to SDK used for the whole project.

/Users/alex/Library/Application Support/JetBrains/Toolbox/apps/AppCode/ch-0/181.4892.43/AppCode.app/Contents

I followed all the steps required, and I'm sure the setup is working because in plugin.xml file I can add this line 

<depends>com.intellij.modules.appcode</depends>

And there is no error. I double checked to indicate to AppCode installation location. Maybe the
problem is that I'm using Gradle to create the plugin?

Some logs when starting debug:

11:38:52: Executing task ':runIde -Didea.paths.selector=AppCode -Didea.platform.prefix=CIDR'...

Download https://www.jetbrains.com/~urlswitch/intellij-repository/snapshots/com/jetbrains/intellij/idea/ideaIC/LATEST-EAP-SNAPSHOT/ideaIC-LATEST-EAP-SNAPSHOT.zip
Download https://www.jetbrains.com/~urlswitch/intellij-repository/snapshots/com/jetbrains/intellij/idea/ideaIC/LATEST-EAP-SNAPSHOT/ideaIC-LATEST-EAP-SNAPSHOT-sources.jar
:compileJava
:patchPluginXml
:processResources
:classes
0

Yes, the problem is in the gradle configuration. Unfortunately, developing AppCode plugins with gradle-intellij-plugin is not supported at the moment.

1

You are a life saver. I will try DevKit and will make a post as soon as I'm getting done. Thank you very much Vyacheslav! 

0

Please sign in to leave a comment.