Language server (kona-lsp)
kona-lsp is a small Language Server Protocol implementation for Crema. It speaks JSON-RPC with Content-Length framing over stdio — the usual shape editors expect when you configure “run this command as the language server.”
Maven coordinates: org.konaframework:kona-lsp (module modules/lsp, package org.konaframework.lsp).
Capabilities
Section titled “Capabilities”| Method | Behavior |
|---|---|
initialize / initialized |
Advertise full document sync, completion (trigger @), diagnostic provider |
shutdown / exit |
Clean teardown (exit code 0 after shutdown) |
textDocument/didOpen / didChange / didClose |
Track buffer text; publishDiagnostics on open/change |
textDocument/completion |
Suggest built-in Crema directives |
textDocument/diagnostic |
Pull-model report of unknown @directive names |
Comments {{-- … --}} are ignored when scanning for directives so examples inside comments do not warn.
Run it
Section titled “Run it”./gradlew :kona-lsp:jarjava -jar modules/lsp/build/libs/kona-lsp-*.jarOr:
./gradlew :kona-lsp:installDistmodules/lsp/build/install/kona-lsp/bin/kona-lspThe process reads LSP messages from stdin and writes responses/notifications to stdout. Do not type into it interactively — let the editor own the pipes.
From an app checkout:
./grind ide:lspprints the same instructions without starting a server.
Use from Kotlin or Java (tests / tooling)
Section titled “Use from Kotlin or Java (tests / tooling)”The public surface is usable without an editor. Kotlin:
val diags = CremaAnalyzer.diagnostics("@csrf @notReal")val items = CremaAnalyzer.completions("@for", 0, 4)val code = LspServer().serve(inputStream, outputStream)Java:
List<CremaAnalyzer.Diagnostic> diags = CremaAnalyzer.diagnostics("@csrf @notReal");List<CremaAnalyzer.CompletionItem> items = CremaAnalyzer.completions("@for", 0, 4);int code = new LspServer().serve(inputStream, outputStream);CremaDirectives.KNOWN / isKnown(name) expose the built-in directive set shared with completion and diagnostics.
What it does not do (yet)
Section titled “What it does not do (yet)”- Full Crema parsing or HTML validation
- Route-name completion from your app’s router
- Formatting or rename refactorings
Those can grow later; this milestone keeps the protocol surface small but real so editors can attach today.