Skip to content

bbannier/zeek-language-server

Repository files navigation

Language server for Zeek script

This project implements a language server for Zeek script.

This is alpha-quality software, especially regarding type resolution. While it already now provides useful results, not all of Zeek script is resolved; we do however strive to either correctly resolve symbols or not at all, i.e., if a result is presented it should be correct.

Installation

In order to see symbols from Zeek system scripts, Zeek needs to be installed and zeek-config should be in PATH.

For optional formatting support zeek-format should be in PATH.

Configuration

The server interprets the following initializationOptions:

  • check_for_updates (default: true): Whether to check for newer releases during startup

  • inlay_hints_parameters (default: true): Whether to show inlay hints for function call parameters

  • inlay_hints_variables (default: true): Whether to show inlay hints for variable declarations

  • references (default: false): Whether to enable Go To References.

  • rename (default: false): Whether to enable Rename.

    WARNING: Since typically Zeek scripts have incomplete @load statements the provided list is very likely incomplete. Use a tool like grep to search for all references of an identifier.

Editor setup

vscode

We provide a minimal extension for vscode which is published to the vscode marketplace. Additionally, an extension VSIX file is created for each release. On startup the extension will automatically download the server binary for the release.

Other editors

We provide binaries for releases for x86_64 Darwin or Linux systems. You should then set up your client to use this binary. A list of editor plugins can be found e.g., here.

Building from source

This project requires Rust to build which can be set up e.g., with rustup and tree-sitter CLI tools.

The project can then be installed with

# Also available in many distribution repositories.
cargo install tree-sitter-cli

# Install actual server.
cargo install --git https://github.com/bbannier/zeek-language-server.git

This installs a binary zeek-language-server which provides the full server.

Debugging

See these instructions for VS Code setup and the list of features (some of which are VS Code specific).