Files
zeekay 33e55f9dd7 rebrand: capnp-ls -> zap-ls (binary, project, default compiler, download)
Finish the ZAP rebrand of the language server, completing the prior
config-id rename (capnp-ls-client -> zap-ls-client) with the binary,
project, default schema-compiler command, and release/download wiring.

- CMake: project() and exe_name capnp-ls -> zap-ls. Build now emits
  build/zap-ls.
- compilation_manager.cpp: default compiler command "capnp" -> "zap";
  suffix guard now accepts endsWith("zap") || endsWith("capnp") (back-
  compat with a real capnp binary); version regex accepts "Zap version
  X.Y" (emitted by the cpp-core fork, VERSION_STRING="Zap version")
  as well as "Cap'n Proto version X.Y". Without the regex change the
  version check would reject the zap binary and block all compilation.
- extension.ts: binaryName, downloadCapnpLs -> downloadZapLs, fallback
  command + log strings, and download URL -> github.com/zap-proto/lsp
  asset zap-ls-linux-x86_64.
- ci.yml: rename/upload/download/release artifact capnp-ls-linux-x86_64
  -> zap-ls-linux-x86_64 and `mv build/zap-ls ...` so the artifact name
  matches the extension's download URL and the new CMake output. The
  ghcr.io/.../capnp-prebuilt-ubuntu libcapnp build image is preserved.
- package.json (x2), testFixture settings.json, README.md, samples/
  README.md: repo URLs -> zap-proto/lsp; default compiler "capnp" ->
  "zap"; binary path build/zap-ls; titles -> "ZAP Language Server".

Preserved (load-bearing libcapnp parser dependency): all #include
<capnp/...>/<kj/...>, capnp::/kj:: API calls, capnp_ls namespace,
find_package(CapnProto REQUIRED), CapnProto::capnp-rpc / capnp-json,
the USE_BUNDLED_CAPNP_TOOL ExternalProject block (capnproto.org 1.1.0,
BUNDLED_CAPNP_EXECUTABLE), the .capnp extension/alias/import refs, the
"capnp" initializationOptions key, and prose stating the server is
built on / wire-compatible with Cap'n Proto.

TODO (out of scope, flagged for follow-up): the `zap` binary is the
same brace-only cpp-core C++ fork; it does NOT yet parse the
whitespace-significant ZAP dialect. Switching the subprocess to `zap`
is necessary but not sufficient for whitespace .zap files. Full
whitespace symbol-resolution requires an INDENT/DEDENT lexer +
declaration-order ordinal inference in cpp-core/c++/src/zap/compiler
(lexer.c++ / parser.c++) emitting a correct CodeGeneratorRequest with
preserved SourceInfo byte offsets; the LSP's libcapnp usage
(symbol_resolver SchemaLoader::load on the binary graph) needs no
change once the binary parses the new syntax.

Build risk (CI): the C++ build (cmake + libcapnp 1.1.0) cannot be
verified here — no cmake/libcapnp in this environment. TypeScript
edits verified (downloadZapLs call/def match; isolated tsc parse clean
aside from pre-existing missing @types/node + vscode ambient types).
JSON files parse. Flag the C++ compile + the new release-asset name
for CI verification.
2026-06-19 14:53:59 -07:00

3.1 KiB

ZAP Language Server

Docs: ZAP Language Server · part of the ZAP Protocol

A language server that provides IDE features for Cap'n Proto schema files, including go-to-definition and automatic recompilation.

Building from Source

Prerequisites

  • Supported OS: Linux, macOS
  • CMake
  • Cap'n Proto libraries (version 1.1.0 or higher)

Build Instructions

You have two options for building the language server:

Option 1: Using System Cap'n Proto

If you already have Cap'n Proto installed on your system:

cmake -B build .
cmake --build build

With this option, you must specify the compilerPath in the initialization options.

Option 2: Using Bundled Cap'n Proto

If you don't have Cap'n Proto installed or prefer a self-contained build:

cmake -B build -DUSE_BUNDLED_CAPNP_TOOL=ON .
cmake --build build

With this option, the compilerPath in the initialization options becomes optional.

This automatically downloads and installs Cap'n Proto, which is guaranteed to be compatible with the language server.

The executable for the language server is located at build/zap-ls in both cases.

Language Server Protocol Support

Initialization

The language server requires the following initialization options:

{
  "initializationOptions": {
    "capnp": {
      "compilerPath": "/path/to/capnp",
      "importPaths": [
        "path/to/schema/imports"
      ]
    }
  }
}

Required fields:

  • compilerPath: The path to the Cap'n Proto compiler executable.
    • When built with -DUSE_BUNDLED_CAPNP_TOOL=ON, this path is optional as the bundled compiler will be used by default.
  • importPaths: An array of import paths for Cap'n Proto schemas.
    • When multiple import paths are provided, they are searched in the specified order, similar to how the Cap'n Proto compiler operates.

Go to Definition

  • Enables navigation to the definition of types, enums, and other symbols in Cap'n Proto schema files.

File Watching

  • Automatically recompiles schemas when files are saved.

Current Limitations

  • Symbol resolution for imports (e.g., import "/common.capnp") currently requires opening the imported file first.
  • Limited support for single workspace folders.

Upcoming Features

  • Autocomplete feature that includes ordinals
  • Formatting feature
  • Windows support

Sample VSCode Extension

The samples directory contains a complete VSCode extension that demonstrates how to use this language server. For details about the extension, see samples/README.md.

Building and Running the Sample

  1. Build the language server (see above)
  2. Set up the extension:
    cd samples
    npm install
    npm run compile
    
  3. Launch the extension in debug mode:
    • Run "Launch Client" from the Run/Debug view

Customizing the Workspace

You can customize the sample workspace by modifying the second argument in the launch configuration's args array:

"args": [
    "--extensionDevelopmentPath=${workspaceRoot}/samples",
    "/absolute/path/to/your/workspace"  // Change this path
]