Kotlin programming language is supported in a number of ways:
- Kotlin plugin donated by JetBrains (obsolete)
- Kotlin Language Server
JetBrains Kotlin plugin (obsolete)
Donated by JetBreains.
Original URL: https://github.com/JetBrains/kotlin-netbeans
It can be found inside contrib
folder of Apache NetBeans source code:
https://github.com/JetBrains/kotlin-netbeans/issues/137
https://github.com/apache/netbeans/pull/1398
Steps to build it:
- The
pom.xml
requires some dependencies that are not in the central maven repository. These are:asm-all.jar, idea-formatter.jar, intellij-core.jar, kotlin-converter.jar, kotlin-formatter.jar, kotlin-ide-common.jar, openapi-formatter.jar
.intellij-core.jar
artifact can be directly taken from: https://www.jetbrains.com/intellij-repository/releases. The other artifacts can be found at https://github.com/JetBrains/kotlin-eclipse project inside thekotlin-bundled-compiler
folder. Once you have collected all these libraries, create alib
folder insidekotlin-netbeans
project and paste them inside there. - In NetBeans, click on Tools → Plugins → Settings tab and add a new plugin Portal: Name: NetBeans 8.2 Plugin Portal, URL: http://updates.netbeans.org/netbeans/updates/8.2/uc/final/distribution/catalog.xml.gz. Make it active.
Once you build the project, all Java and NetBeans dependencies should be resolved. However, the project also contains a lot of Kotlin code which throws a lot of compilation errors. The plugin contains Kotlin code that needs to be built/migrated to the latest Kotlin compiler version and all the compilation errors need to be fixed.
Language Feature Support | Status |
File type recognition | √ |
Project type | |
Semantic syntax highlighting | √ |
Formatting | √ |
Braces matching | √ |
Error Hints/Fixes/Suggestions | |
Code completion | |
Code templates | |
Refactoring | |
Debugging |
Kotlin LSP
With the support of Microsoft's Language Server Protocol since NetBeans 12.x, java/kotlin.editor
module provides some basic support for Kotlin.
- Syntax highlighting (with the help of Kotlin.tmLanguage.json) (see this JavaDoc for more information or this wiki page)
- Code completion, navigation etc. (with the help of Kotlin Language Server)
One can open a .kt
file via the Windows→Favourites tab. Syntax highlighting and bracket matching should be available.
The first time that you open a.kt
file, a hint will appear on the top left of the editor that will prompt you to install the Kotlin LSP.
Do so in order to add features like code completion and navigation to your editor.
Language Feature Support | Status |
File type recognition | √ |
Project type | |
Semantic syntax highlighting | √ |
Formatting | √ |
Braces matching | √ |
Code completion | √ |
Error Hints/Fixes/Suggestions | |
Code templates | |
Refactoring | |
Debugging |