Language Server Protocol

GraalVM supports Language Server Protocol (LSP) for guest languages. It provides features like code-completion, find usages and alike for the client tools – IDEs like VSCode.

Note: GraalVM Language Server is offered as a technology preview and requires to pass the --experimental-options option for its activation.

To start the GraalVM Language Server, pass the --lsp option to the command line launcher as in the following example with a Node.js application:

$ node --experimental-options --lsp app.js
[Graal LSP] Starting server and listening on localhost/
Example app listening on port 3000!

GraalVM provided code completion for R script, part of node.js Polyglot application.

The GraalVM Language Server itself does not provide the static data usually gathered by parsing the application sources (as these data are sometimes fuzzy in case of dynamic languages). Instead, the GraalVM Language Server was designed to provide the accurate dynamic data gathered form the application runtime.

However, the GraalVM Language Server could delegate to the existing language servers written specially for the particular languages (using the --lsp.Delegates launcher option) and merge the static data returned from these servers with its own dynamic data to a single result.

More information about the GraalVM Language Server and its usage in GraalVM VSCode Extensions is on VSCode Marketplace documentation.