Tons of doubts with plugin development help

I want to get into the plugin development world and decided to go through the docs in order to understand the porcess. Every paragraph I read, a new doubt I had.

So: I'll ask here for tons of doubts, then when everything is clear I'll submit all the lacks as a documentation improvement request.

@replier when answering you may refer to the questions by its number

Here we go!
Googled for "intellij idea plugin development"
First result: http://confluence.jetbrains.com/display/IDEADEV/PluginDevelopment
Click on setting up environment:
http://www.jetbrains.org/display/IJOS/Writing+Plug-ins

== 1 ==

IMO I think that the most common scenario is starting from scratch with NO PROJECT CREATED so this page should be refocused to start from the "new project" wizard: http://www.jetbrains.org/display/IJOS/Writing+Plug-ins


== 2 ==
maybe seems a bit stupid, but this

Check out the sources of IntelliJ IDEA Community Edition as described in Check Out & Build Community Edition

gives an impression that you must checkout it and compile it. suggestion: "Check out the sources of intellij idea community edition. If you need help for doing that please refer to the "Checking Out the Code" section on [this document] <- link there, with no title"


== 3 ==
on the "Check Out & Build Community Edition" page

The master branch currently contains the code for the development version of IntelliJ IDEA 13.x. Source code of older releases of IntelliJ IDEA can be found in the following branches:


What sould I do if I have installed an EAP for which there is no community edition available (happens sometimes with newest eaps)? Or even what if I have already checked out an old version? Can I use it anyway?

Also, must the version checked out match your IDE version (example: I am developing on IDEA 13) or the target version (I want to make sure my plugin works also on version 14)?


== 4 ==

Create an SDK of type "IntelliJ IDEA SDK" and specify your installation of IntelliJ IDEA Community Edition as the home path. (You can use IDEA Ultimate as well, but debugging the core code will only work with the Community Edition.)

Now it's "IntelliJ Platform Plugin SDK", am I wrong?


== 5 ==

Create an SDK of type "IntelliJ IDEA SDK" and specify your installation of IntelliJ IDEA Community Edition as the home path. (You can use IDEA Ultimate as well, but debugging the core code will only work with the Community Edition.)

Wich is it really debugging the core? can you be more specific about that so I can make a decision? Which are the real advantages of this when it comes to plugin development?


== 6 ==

Create an SDK of type "IntelliJ IDEA SDK" and specify your installation of IntelliJ IDEA Community Edition as the home path. (You can use IDEA Ultimate as well, but debugging the core code will only work with the Community Edition.)

So if I am happy with my ultimate setup and I  have it already configured as I like... etc. Can I select the  instalation path of a community edition as the sdk FROM an ultimate  edition? Can I debug the core this way?


== 7 ==

In the Sourcepath tab of the SDK settings, press the "Add..." button and specify the directory into which you have checked out the sources of the Community Edition


I've followed a webinar writing a plugin, skipped this step and completed the webinar with success: compiled the the plugin and debugged it. What is this useful for?
If that has any advantage, can I add them also if I chose an IDEA Ultimate source as sdk? What about if you select a PhpStorm installation as target sdk?


== 8 ==

In the Sourcepath tab of the SDK settings, press the "Add..." button and specify the directory into which you have checked out the sources of the Community Edition

A dialog appears with lots of srcs directories and checkboxes. Are all needed?


== 9 ==

Now I'm following instructions for developing plugins for PhpStorm: http://confluence.jetbrains.com/display/PhpStorm/Setting-up+environment+for+PhpStorm+plugin+development
It says I can use PhpStorm or IDEA Ultimate as target platform.
So: when developing plugins for phpstorm I have no chance to get the debugging advantages of using community edition?

== 10 ==

Following instructions for developing plugins for PhpStorm:  http://confluence.jetbrains.com/display/PhpStorm/Setting-up+environment+for+PhpStorm+plugin+development

Find and select php-openapi.jar. It's located in <your_installation_of_PhpStorm/plugins/php/lib.
[...]

  1. Open plugin.xml in the directory META-INF
  2. Add two <depends> items to plugin.xml:
    <depends>com.jetbrains.php</depends>

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

Doing that,

<depends>com.jetbrains.php</depends>

showed as unresolved in my code

Adding also php.jar located in <your_installation_of_PhpStorm/plugins/php/lib.
solved the problem

Is it right what I have done?

0
11 comments

Just wanted to say. That the source code is the real documentation. That is why it is important for you to check it out, you need to read it and become familar with it because it contains examples of how to do almost anything you would want to do. It is a living example of how to use the API's.

Attaching sources to your IDEA SDK is essential because you will want to look at the interfaces and classes you will be working with. Attaching the RIGHT sources is also essential. If you are developing for IDEA 12, you dont want to attach the sources from the master branch to your SDK for obvious reasons. The checked out sources must match your SDK version - which is typically your IDE version. They should match exactly ir possible.

I don't really understand why they say to develop with the community edition, I have always used Ultimate to test my plugins, but when stepping through code in the SDK things like local variables are unavailable. I don't really know if they would be had I tried debugging against the community edition.

JB obfuscates some of the code in the Ultimate Edition. This is probably why they say to use the community edition.

You can build the community edition from source if you want - I never have myself.

0
Avatar
Permanently deleted user

Thanks for the advice about using the source code as the best documentation available. And for your answer about versions mix up!!

1, 2: not a question
3. answered
4. pending
5, 6, 7. any Jetbrainer with an accurate answer?
8, 9, 10. pending

0

Look at the difference between debugging IJ Ultimate and Community
UvsC.png
But it is possible to develop with Ultimate just fine, just the debugging is not very pleasant even when you attach sources:
U.png

0

Yep, I developed my plugin with the debugging experience you show for Ultimate. i just had to infer what the obfuscated variables were from the source. I probably made my job much harder than it should have been by doing that.

Thanks for showing the difference. That was really helpful to see. Maybe I might use CE to debug in the future IDK. I think now I have done it long enough that the obfuscation doesn't confuse me, but for someone new - I see why you should use the CE now.

I think JB should add your screenshot to their documentation to illustrate why one should use the CE.

0

BTW, #6 is definately yes. If you point your SDK at the CE it will run the CE to test your plugin. This is also true of any other IDE. Like webstorm or phpstorm. Also, when you test your plugin it is a separately configured instance of the IDE, it is not your current IDE configuration even if you point the SDK to your current IDE.

You will notice what I mean, the first time you try to test your plugin, you have to configure the IDE as if it were run for the first time. This is because it gets its configuration from the system/plugin-sandbox directory not the usual config directory.


#8 yes

#9 yes because the php plugin is not open source, so you can only load it in the ultimate edition.

#10 yes, we have had to do that with idea.jar for a while, but lately they have fixed that. They probably haven't yet for php storm.

0
Avatar
Permanently deleted user

Thank you for such an useful answer.

So, let me resume for clarification:
1. Choosing community edition as sdk shows real name variables on the debugger
2. Choosing community edition or ultimate edition as developing IDE makes no difference on the clarity of the debugger
3. We still don't know which debugging advantage we have when attaching sources as they recommend.

Is all that right?

0

There is one thing, evaluate expression(alt+left click) does not work well, as those variables and fields have obfuscated names, so you try to evaluate something which does not exist. Do you need any more disadvantages?

0
Avatar
Permanently deleted user

Vojtěch Krása thank you, I agree with the disadvantages, I just have the concepts a bit messed up and I'm trying to get everything clear.
The evaluate expression problem  you are mentioning works bad when you debug the ultimate edition or when you don't attach sources to the SDK?
thank you for your patience

0

There's no advantage at all to using the Ultimate Edition for development except for final testing, or if your plugin uses features only present in Ultimate Edition. If you're not sure if that's the case, it's not - it's pretty complicated to do, in general.

0

Debugging Ultimate Edition with sources.
Have you ever tried debugging without sources? It can be done, decompiled classes help a little bit, but otherwise it is a desperate thing to do, even more so on obfuscated classes.

0
Avatar
Permanently deleted user

Okay, thank you all participants!!!

0

Please sign in to leave a comment.