...
- Kotlin plugin donated by JetBrains (obsolete)
- Kotlin Language Server
JetBrains Kotlin plugin (obsolete)
Donated by JetBreains.
Original URL: https://github.com/JetBrains/kotlin-netbeans
...
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 and later already provide some basic support in the , java/kotlin.editor
module . With this plugin one can open a .kt
file via the Windows→Favourites tabprovides 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.
- Download and build Kotlin Language Server with JDK 11 using the command:
./gradlew :server:installDist
(how can we addkotlin-language-server/server/build/install/server/bin/kotlin-language-server
) - Open
netbeans/java/kotlin.editor
module in NetBeans IDE - Add a new class:
package org.netbeans.modules.kotlin.editor.lsp;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.netbeans.api.editor.mimelookup.MimeRegistration;
import org.netbeans.modules.lsp.client.spi.LanguageServerProvider;
import org.openide.util.Lookup;@MimeRegistration(mimeType="text/x-kotlin", service=LanguageServerProvider.class)
public class KotlinLSPServer implements LanguageServerProvider {
private static final Logger LOG = Logger.getLogger(KotlinLSPServer.class.getName());
@Override
public LanguageServerDescription startServer(Lookup lookup) {
File server = new File("<path_to_>/kotlin-language-server/server/build/install/server/bin/kotlin-language-server");
//InstalledFileLocator.getDefault().locate("typescript-lsp/node_modules/typescript-language-server/lib/cli.js", null, false);
try {
Process p = new ProcessBuilder(new String[] {server.getAbsolutePath()}).directory(server.getParentFile().getParentFile()).redirectError(ProcessBuilder.Redirect.INHERIT).start();
return LanguageServerDescription.create(p.getInputStream(), p.getOutputStream(), p);
} catch (IOException ex) {
LOG.log(Level.FINE, null, ex);
return null;
}
}
}
Language Feature Support | Status |
File type recognition | √ |
Project type | |
Semantic syntax highlighting | √ |
Formatting | √ |
Braces matching | √ |
Code completion | √ |
Error Hints/Fixes/SuggestionsCode completion | |
Code templates | |
Refactoring | |
Debugging |