--- id: SLICE-0009 type: slice status: done 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 Done at commit `e77ddd4` and verified again at `38794cf` with `cargo test -p hemx-lsp`: protocol tests cover initialize capabilities, shutdown, unknown request errors, diagnostics lifecycle, completion, and hover framing.