Kotlin vs. Java vs. JS/TS for plugin development

Answered

Hi! I'm just starting to develop a new plugin for Sourcegraph. (I work at Sourcegraph.)

One of my first decision points is the language. I see three potential ways to go (not sure if all are valid):

  • Java
  • Kotlin
  • JavaScript/TypeScript via a WebView or similar

I want this to be a team effort: I wish to involve as many devs on my team as sensible. But we are web developers with TypeScript and Go backgrounds. No one on my team did Java or Kotlin lately (or at all).

So from a team point of view, JS/TS would be ideal. But I understand that's not a common way to go about JetBrains plugin development—if at all possible.

Kotlin seems second best because it seems more similar to TS, so I'd expect a steeper learning curve for TS developers. It also seems like a cool and convenient language.

Java seems the trickiest from a team point of view, but it looks like it's the most common way to do it. Also, we have a rudimentary existing plugin and an MVP for its advanced version, both Java.

So I'd say it's not an easy call. Any thoughts, opinions, relevant links are appreciated.

1
1 comment

Hi David,

At first, JavaScript/TypeScript is not a way to go if you want to implement a distributable plugin that will be used beyond your team. IntelliJ Platform plugins are implemented in JVM languages. It is possible to create extensions in JS (https://plugins.jetbrains.com/plugin/17669-flora-beta-) but it is not an official/supported solution and doesn't apply to the "real" plugins, but smaller project-level extensions.

Both Kotlin and Java are valid choices and it's really up to your team's knowledge and preference. You can take a look at Kotlin for Plugin Developers article:
https://plugins.jetbrains.com/docs/intellij/kotlin.html

From what you wrote it seems that Kotlin is a better choice for your team, and even if you have started your plugin development in Java, it is pretty easy to convert it to Kotlin automatically (it may require small manual adjustments in some cases):
https://kotlinlang.org/docs/mixing-java-kotlin-intellij.html#converting-an-existing-java-file-to-kotlin-with-j2k

0

Please sign in to leave a comment.