zeekayandHanzo Dev 3e9586e245 Typecheck the sample client on the native compiler, keep 6 for the tools
typescript 7.0.2 is the native compiler and exports no JavaScript API, so
typescript-eslint cannot read it. It comes in aliased as tsgo and runs the
build; typescript stays on the 6 line for the tools.

The sample's tsconfigs never named strict or esModuleInterop, so TS7's defaults
turned both on and reported 7 diagnostics against code that had always compiled
loosely. They now say so: strict false, esModuleInterop true, and the CJS
namespace import of mocha becomes a default import that interop can construct.
Both compilers report 0 diagnostics.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-17 01:02:44 -07:00
2025-03-04 23:32:19 +09:00
2025-03-07 03:15:13 +09:00

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
]
S
Description
ZAP Language Server
Readme MIT
274 KiB
Languages
C++ 94.7%
CMake 4.1%
Dockerfile 1.2%