--- id: SLICE-0009 type: slice status: ready parent: NS-0002 title: Harden LSP protocol behavior refs: - hemx-lsp/src/main.rs - docs/editor-support.md - REQUIREMENTS.md --- ## Objective Make `hemx-lsp` predictable as an LSP server: initialize capabilities, document sync, completion, hover, diagnostics, shutdown, and unknown request errors should have focused protocol tests. ## Authority `hemx-lsp/src/main.rs` implements the protocol loop; `docs/editor-support.md` names the editor-facing command surface. ## Close when - Tests cover `initialize`, `didOpen`, `didChange`, `didSave`, `didClose`, `completion`, `hover`, `shutdown`, and unknown requests. - The tests assert JSON-RPC framing and response IDs, not just helper functions. - The server keeps normal HTML/tree-sitter tooling assumptions and does not add editor-provider policy. ## Verification - `cargo test -p hemx-lsp` - `cargo run -p hemx-lsp -- help` ## Non-goals - Do not add async runtime or background watchers unless protocol tests prove sync IO is insufficient. - Do not publish editor extensions in this slice. ## Evidence The current LSP loop is small and testable through in-memory readers/writers.