Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Download the LSP implementation for the language you wish to add support for. See a list of Language Server implementations and another list of Language Server Implementations.For example, to add support for Kotlin programming language, download and build kotlin-language-server.
  2. Add the following module dependencies to your module, as described in the previous chapter: "LSP Client" and "MIME Lookup API".
  3. Create a new class that implements LanguageServerProvider.

See for example, ShellClient or java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/lsp/KotlinLSPServer. E.g. for Kotlin, you will need to provide the path to kotlin-language-server/server/build/install/server/bin/kotlin-language-server inside the overriden startServer() method of this 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("kotlin-language-server/server/build/install/server/bin/kotlin-language-server");
        try {
            return LanguageServerDescription.create(p.getInputStream(), p.getOutputStream(), p);
        } catch (IOException ex) {
            LOG.log(Level.FINE, null, ex);
            return null;
}
}
}

Important note! It is yet to be decided where to install and how to access the (pre-)built language servers. 

...