You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(lsp-phase-d): JSON-RPC LSP server (affinescript server --stdio)
Add a full Language Server Protocol 3.17 server as a new `server`
subcommand. The server runs entirely in-process — no child processes
are spawned for each request.
lib/lsp_server.ml (new, ~310 LOC):
- Content-Length framing: read_message / write_message
- Document store (URI → source text) + pipeline cache (URI → symbols,
refs, diagnostics)
- run_pipeline: writes in-memory source to a temp file, runs the full
compile pipeline (parse → resolve → typecheck → borrow → quantity),
fixes up span file paths to match the editor URI, returns diagnostics
+ symbol table + references
- lsp_range: converts 1-based compiler spans to 0-based LSP ranges
- diag_to_lsp / publish_diagnostics: push diagnostics on open/change
- Handlers: initialize (declares hover + definition + completion),
didOpen/didChange (pipeline + cache + push), didClose (clear),
textDocument/hover (markdown with type + quantity),
textDocument/definition (URI + range),
textDocument/completion (items with LSP CompletionItemKind mapping)
- MethodNotFound reply for unknown requests; exceptions caught so the
server loop never dies on a bad message
bin/main.ml: server_cmd wired into the default command group.
test/test_e2e.ml: 4 new tests — uri_to_path, lsp_range 0-based
conversion, valid source produces no diagnostics, broken source
produces at least one diagnostic.
105 total tests, 0 regressions.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .machine_readable/6a2/STATE.a2ml
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ project = "affinescript"
6
6
version = "0.1.0"
7
7
last-updated = "2026-04-11"
8
8
status = "active"
9
+
session-note-2026-04-11-h = "STAGE 5 (AFFINATEA DRIVES SCENE) COMPLETE: teaDrive(engine, msgTag) is the single entry point from all 4 button handlers — update → applyView → navigate. applyView reads selected_tag via getSelected() and alpha-pulses the chosen button (0.65 → animate 1.0 over 0.22s). teaBridge loaded asynchronously on first show; graceful fallback to direct ReScript navigation when bridge is None. resize handler calls AffineTEA.setScreen(tea, width, height) to keep screen_w/h in sync with canvas. Button handlers reduced to single teaDrive call each. Navigation decision comes FROM Wasm state (selected_tag), not from button identity. Credits button wired (msgCredits) with TODO screen. IDApTIK TitleScreen is fully AffineTEA-driven for Stages 4+5."
0 commit comments