Skip to content
Joe Curlee (w4ffl35) edited this page Feb 19, 2026 · 6 revisions

Curlee LSP (current commitments)

Curlee ships a deterministic Language Server Protocol (LSP) server over stdio.

Feature commitments

Curlee currently commits to these LSP features:

  • textDocument/publishDiagnostics (parse/type/resolve diagnostics on open/change)
  • textDocument/hover
  • textDocument/definition
  • textDocument/completion (baseline)
  • textDocument/rename (baseline workspace edits)
  • textDocument/semanticTokens/full (baseline legend + full-document tokens)
  • textDocument/codeAction (baseline)

Capabilities advertised by initialize are intentionally minimal and stable for v1:

  • textDocumentSync = 1 (full-document sync)
  • hoverProvider = true
  • definitionProvider = true
  • completionProvider present (resolveProvider = false)
  • renameProvider = true
  • semanticTokensProvider present (with stable legend)
  • codeActionProvider = true

Semantic token legend (baseline)

Current legend order is stable and used for token type indexes:

  1. keyword
  2. function
  3. variable
  4. type
  5. number
  6. string

Diagnostics schema and span consistency

LSP diagnostics are published with stable machine-readable metadata:

  • source: "curlee"
  • code: "curlee.diagnostic"
  • data.schema: "curlee.diag.v1"
  • data.file: <source path>
  • data.span: {start,end} byte offsets when available (or null)

LSP diagnostics also include the standard LSP range (line/character) derived from the same source span. CLI JSON diagnostics continue to publish byte offsets (span.start, span.end) so both surfaces are aligned on underlying span coordinates.

Formatter stability and compatibility policy (v1)

curlee fmt is the supported formatter entrypoint for v1.

v1 policy:

  • Formatting output for supported inputs is intended to be stable across v1 patch/minor releases.
  • Formatting is idempotent: formatting an already-formatted file should not change it.
  • curlee fmt --check is the compatibility-safe CI mode:
    • exits non-zero when formatting changes are needed,
    • exits zero when the file is already in canonical format.

If formatter output needs to change in a user-visible way, that should be treated as a compatibility-affecting change and called out in release notes.

End-to-end editor workflow (validated)

Validated workflow for a typical editor integration:

  1. Send initialize and cache capabilities.
  2. Send textDocument/didOpen with full file text.
  3. Consume textDocument/publishDiagnostics notifications.
  4. Request language features as needed:
    • textDocument/hover
    • textDocument/definition
    • textDocument/completion
    • textDocument/rename
    • textDocument/semanticTokens/full
    • textDocument/codeAction
  5. Send textDocument/didChange (full-document sync mode), then consume refreshed diagnostics.

This workflow is exercised by in-repo tests:

  • curlee_lsp_internal_tests
  • curlee_lsp_hover_golden_tests

Incremental check performance budget

Curlee currently uses full-document sync (textDocumentSync = 1) and re-checks on change. For editor responsiveness, the current baseline budget is:

  • curlee check average wall time for representative passing samples should stay at or under 0.20s.

Validation command:

python3 scripts/benchmark.py --curlee build/linux-debug/curlee --runs 5 --dirs tests/run

Latest validation snapshot:

  • samples=8 runs=5 avg_seconds=0.0788

This keeps the current baseline comfortably within budget.

Hover behavior

  • Hovering an expression shows its inferred type.
  • Hovering a function call shows the callee signature, its requires clauses, parameter refinements, and a short obligations summary (instantiated at the call site when possible).

Build

cmake --preset linux-debug
cmake --build --preset linux-debug --target curlee_lsp

Run

The server speaks LSP over stdio:

./build/linux-debug/curlee_lsp

Configure your editor to launch the executable above as an LSP server.

Manual test recipe

  1. Start the server in a terminal:
    ./build/linux-debug/curlee_lsp
  2. Send an initialize request over stdin:
    Content-Length: 65
    
    {"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}
    
  3. Open a Curlee document:
    Content-Length: 142
    
    {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///tmp/test.curlee","text":"fn main() { return 1 + 2; }"}}}
    
  4. Request hover:
    Content-Length: 136
    
    {"jsonrpc":"2.0","id":2,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///tmp/test.curlee"},"position":{"line":0,"character":20}}}
    

You should receive JSON-RPC responses with capability info (see Glossary), diagnostics, and hover content.

Clone this wiki locally