Closed bodiam closed 4 years ago
Hi Erik, do you have the latest version of the Kotlin Plugin enabled? I could be mistaken, but that should be the only requirement.
edit: Just saw you have the Kotlin plugin. Let me try installing it from scratch. From what I remember, you may need to add the libraries in idear/lib to your dependencies manually.
I think so, I'm using the bundled version of IntelliJ 15. (see screenshot)
1) I checked out the repo, 2) changed the project SDK to IDEA IC-139.224.1 (Java 8),
and that's it. Maybe step two is incorrect? I can find the IntelliJ classes, but just not the Kotlin ones, and I see no option to add it. Creating a new project with Kotlin support is no problem.
Hmm, that's unusual. It should automatically detect the Kotlin classes when your IDE loads the project. I was able to successfully build the project on a clean install of IntelliJ IDEA CE 143.382. When first launching the IDE, I added a JDK, and the IntelliJ Platform Plugin SDK (as described in the SDK Docs), then it was able to detect the Kotlin files and build the project with no further configuration required.
There must be some reason why it does not detect the Kotlin files in your project, however you can still try to force IntelliJ IDEA to recognize them. What happens when you select Tools | Kotlin | Configure Kotlin in Project?
I recently untracked the idear/.idea/workspace.xml
file, but when the project is sucessfully configured, that file should contain a section that looks like this. If all else fails, you could try pasting it into your .idea/workspace.xml
file directly, but normally we don't recommend editing the .idea/*
files directly as they can easily become corrupted.
<configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="idear" />
<envs />
<method />
</configuration>
edit: When IntelliJ IDEA CE first loads the project, I can see the following popup:
After clicking Configure 'idear' module in 'idear' project as Kotlin (Java) module, the following dialog appears:
After generating the compiler bundle, it placed a few files under idear/lib
, which I have checked into git, under 1d31f794d9cace238da01de276e99b7e456418d9. Please let me know if it's still giving you trouble.
Ah, yes, there it is! If I do Tools -> Kotlin -> Configure Kotlin
, then it fixes most of the issues; now the Kotlin code is found.
However, there is still one issue left now, and that is that the code doesn't compile. I think I know why that is. This is caused by the AceJumpAction:
Error:(35, 13) Kotlin: Class 'AceJumpAction' must be declared abstract or implement abstract base class member public abstract fun actionPerformed(@org.jetbrains.annotations.NotNull p0: com.intellij.openapi.actionSystem.AnActionEvent): kotlin.Unit defined in com.intellij.openapi.project.DumbAwareAction
So, I guess this code doesn't work with IntelliJ 14, but only with 15?
Based on your prior screenshot, it looks like we're on the same version of the Kotlin plugin, which means we're also using the same compiler. It might be an issue with IntelliJ IDEA 14*, but in theory it shouldn't matter which version of IntelliJ IDEA you are using, as long as it uses the same compiler.
*Have you applied for an Open Source license to IntelliJ IDEA 15? Surely you must be eligible...
I think you are right that it shouldn't matter, but this is the problem:
override public fun actionPerformed(p0: AnActionEvent?) {
IntelliJ tells me this doesn't override anything, so I thought the actionPerformed method was only added in a later version of IntelliJ. However, that's not the case. The real method to override is this:
override public fun actionPerformed(@NotNull p0: AnActionEvent) {
So, the @NotNull
is the issue here. The same for the update
method. I don't know why this is, and why you are not affected by it. If I change the signature, this class compiles, but I run into a new issue, and that is that the Logger cannot be found. It doesn't seem to be included in the lib folder either, but this is actually a separate issue.
It seems I won't apply for an Open Source license:
Limited to non-commercial open-source development.
I use IntelliJ every day for commercial development. I don't know how to combine that.
Thanks for the tip anyway!
Now I know what's going on: we're using different SDKs. These method signatures recently changed in IntelliJ IDEA 15, and that's why you're seeing the override error. Furthermore, slf4j was only recently added to the platform, so you don't yet have that dependency.
I've just added gradle support in dca38a97f797eea2bd29b32a64fe483b5f347ae5, so that (hopefully) we don't have to worry about the SDK environment. To run the plugin, you just need to execute gradlew runIdea
from the root directory. I'm using Gradle 2.9 running on Java 1.8.0_45 - which is sort of the same problem as before, although marginally better. ;)
I'm giving up, this is going nowhere.
I did a fresh clone, ran gradle runIdea
, "works". Works as in: starts up. I haven't managed to let IntelliJ recognize a single command.
Then I opened the project in IntelliJ 15, and nothing is working. I don't have a Project SDK, the code is not compiling, etc. I was hoping the Gradle support would fix it and I could just open the project in IntelliJ, but it seems I ran into the same problems as before, and it gets a little frustrating.
And this is the result of running './gradlew runIdea': https://www.youtube.com/watch?v=rQlgH9D2rJA
@bodiam you should not just open
the project, you should select create from sources
option and later import that from gradle.
Will take a look at the problem tonight.
Hi @alexeykudinkin , thanks for the help, but what's the difference?
I tried your suggestion, and while I lost my run configuration and the project is imported with the wrong language level, it seems to work now. At least the code compiles, and manually adding the gradle run configuration works.
The plugin itself doesn't work, though I see my shouting in the logs, the stacktraces still happen, and nothing else. Also this message is a bit weird:
@bodiam seems weird, will investigate.
@alexeykudinkin Thanks! If I need to check something, please let me know!
Closing this ticket, as the project setup has significantly improved since 2015. Feel free to open a new issue if you encounter any new issues. Thanks!
Hi @breandan, I'm trying to make this project work in IntelliJ 15, but I have no idea how to enable the Kotlin code. It seems to be missing the Kotlin SDK/libraries, but how do I fix that?