Introducing the Systemtap Language-server

Ryan Goldberg rgoldber@redhat.com
Fri Feb 3 20:06:52 GMT 2023


Hi all,

A new language-server [0] mode has recently been added to systemtap. The
language-server, which runs as a child of an lsp-client [1], serves up
code-completion suggestions.

The language-server-protocol uses jsonrpc [2] and we developed our own C++
SDK which both implements jsonrpc and allows for the creation of
language-servers.

We use systemtap's pass 1 machinery in order to lex and parse
code-completion requests and then use the termination state to determine
the completion results as well as some metadata (such as the result type).
Further deriving these allows us to provide additional context-specific
completion results such as context variables within applicable probe
statement blocks or string completions within probe components. The server
also provides completions for globals, functions and macros from both
within the script and from the tapsets.

The language server can be run with "stap --language-server" and should be
started by a language-server client as the data is currently transferred
via stdin/stdout. We have currently been testing with vim, emacs, vscode,
jupyter and eclipse. Take a look at language-server/README.md for client
specific usage instructions.

For more information I'll be releasing a blog post later this year
describing the jupyter-notebook use case of the language-server. If you
have any feedback, I'd be happy to hear it.

All the best,

Ryan (rgoldber)

[0] -
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/

[1] -
https://microsoft.github.io/language-server-protocol/implementors/tools/

[2] - https://www.jsonrpc.org/specification


More information about the Systemtap mailing list