BRAIDGROUP
RESEARCH & DEV
35. Documentation

LSP Features

braid-lsp Overview

The braid-lsp server is written in Rust and implements the Language Server Protocol over stdio transport. It is defined in tools/bstudio/braid-lsp/ and uses the lsp-server crate for protocol handling.

Supported Features

FeatureCapabilityStatus
Go-to-definitiontextDocument/definitionImplemented (stub returns current line)
Hover type infotextDocument/hoverPlanned
AutocompletetextDocument/completionImplemented (keywords: fn, let, import, struct, enum, match, if, else, while, return)
DiagnosticstextDocument/publishDiagnosticsImplemented (brace matching, syntax validation)
Text synctextDocument/didOpen/didChangeFull sync mode (sync kind 1)

Starting the LSP Server

Build and run braid-lsp from the source directory:

cd tools/bstudio
cargo build --bin braid-lsp
./target/debug/braid-lsp

The server listens on stdio. It will output diagnostic messages to stderr and communicate JSON-RPC messages on stdout. To test manually:

echo '{'{'}
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {'{'}
        "processId": null,
        "capabilities": { '{'}{'}' }
    {'}'}
{'}'}' | ./target/debug/braid-lsp

LSP Protocol Support

The server announces these capabilities during initialize:

{'{'}
    "capabilities": {'{'}
        "textDocumentSync": 1,
        "completionProvider": {'{'}
            "resolveProvider": false,
            "triggerCharacters": ["."]
        {'}'},
        "definitionProvider": true
    {'}'}
{'}'}
  • Text sync: Full document sync (value 1) — the server requests the entire document content on change
  • Completion: Triggered on . character; provides keyword completions with item kind classification
  • Definition: Go-to-definition support with URI and range response
  • Diagnostics: Published automatically on document open and change, checking for unmatched braces