My current job uses 🧑💻️ Kotlin as the main backend programming language. At the same time, I’m also a huge fan of VSCode. So the logical conclusion would be to attempt to set up Kotlin in VSCode, which I can only assume many other developers tried doing too. I very quickly concluded that Kotlin just begs to use IntelliJ. That is not so strange though because JetBrains is the company behind Kotlin and the creator of IntelliJ.
Even though it already felt like swimming against the stream from the start, I still attempted to get a usable setup in VSCode.
VSCode extensions
There are many articles to be found online that discuss using VSCode for Kotlin development, such as:
- Programming with Kotlin in Visual Studio Code
- Learning Kotlin: Programming with Visual Studio Code
- Setup VSCode for Kotlin Development
And the list goes on…
These articles refer to the extension Kotlin Language by mathiasfrohlich. Additionally, another extension called Kotlin by fwcd is also available in the Visual Studio Code Marketplace. Both have a high number of downloads, which looks very promising.
The extension by mathiasfrohlich provides support for minimal programming features such as syntax highlighting and code snippets. That list of features is extremely minimal and won’t be sufficient to do any complex programming as that would require debugging support for example. Luckily, the other extension by fwcd does provide additional features, including debugging!
The articles would make you think that it would work out of the box, but that was far from my experience. Although it might be due to misconfiguration on my part, I never managed to get the debugger to work on anything but a toy example.
JetBrains’ stance
A quick online search showed that I’m not the only person wondering about Kotlin support in other editors. This makes a lot of sense to me. Developers get used to a specific editor and tend to stick to that one and on top of that often feel very strongly about their editor of choice. It also doesn’t help that most languages have decent support in most editors, only making it more normal to stick to one editor.
Part of the reason the support isn’t great is that these Kotlin extensions are made by open-source developers. That is not on them though, it’s not reasonable to expect perfect support from developers who are doing this in their free time. I would expect proper support to come from JetBrains.
Unfortunately, we can’t expect any official support for Kotlin within VSCode soon or ever. JetBrains has a clear stance on official support. They don’t want to officially support VSCode and they don’t even want to support the Language Server Protocol.
Quoting from those two pages:
We can develop our product far more efficiently if we can build the features we need as part of our product directly, not as extensions to a third-party protocol. Also, the quality of experience of people developing Kotlin in IntelliJ IDEA is far more important to us than the usefulness of our open source code to the community of developers not using IntelliJ IDEA.
and
(…) the desire to use VS Code rather than IntelliJ IDEA is a matter of personal preference, nothing else, and we do not want to encourage people whose personal preference is not to use JetBrains development tools.
While I understand that JetBrains is a commercial company and has to make money from its products, I do think it’s a pity that getting more people to use IntelliJ is more important than the ubiquity of the language. Especially because it is the opposite approach that many other languages seem to make.
Conclusion
While I do love VSCode and I like Kotlin as a language, I can’t get them to play nicely together. Maybe one day the open-source projects will improve significantly enough to be usable, but right now they are not. This means that JetBrains gets what it wants and I’ll be using IntelliJ anyway.