feat(lsp): client-side LSP toolkit with 5 tools + integration tests

LSP client (lsp/client.rs):
- JSON-RPC framing over subprocess stdio
- Async request/response with oneshot channels
- Background read loop routing responses to pending requests
- 30s timeout per request, graceful shutdown

LSP manager (lsp/manager.rs):
- Auto-detect: Cargo.toml → rust-analyzer, package.json → tsserver,
  pyproject.toml → pyright, go.mod → gopls
- Initialize handshake, lazy textDocument/didOpen
- High-level methods: definition, references, hover, document_symbols,
  workspace_symbols
- Graceful degradation when binary not on PATH

LSP tools (tools.rs):
- lsp_definition, lsp_references, lsp_hover, lsp_diagnostics, lsp_symbols
- execute_lsp() async dispatch, is_lsp_tool() check
- All routed as ToolSide::Client in orchestrator

Tool schemas registered in Sol's build_tool_definitions() for Mistral.

Integration tests (6 new):
- Language detection for Rust project
- is_lsp_tool routing
- LSP initialize + hover on src/main.rs
- Document symbols (finds main function)
- Workspace symbols with retry (waits for rust-analyzer indexing)
- Graceful degradation with bad project path
This commit is contained in:
2026-03-24 00:58:05 +00:00
parent 73d7d6c15b
commit 8726e8fbe7
11 changed files with 1112 additions and 16 deletions

163
markdown_test_artifacts.md Normal file
View File

@@ -0,0 +1,163 @@
# markdown test artifacts
---
## 1. headers
# h1: the quick brown fox
## h2: jumps over
### h3: the lazy dog
#### h4: 42
##### h5: why not
###### h6: minimum viable header
---
## 2. text formatting
**bold**, *italic*, ***bold italic***, ~~strikethrough~~, `inline code`, ==highlight== (if supported).
---
## 3. lists
### unordered
- top level
- nested
- deeply nested
- back to top
### ordered
1. first
1. nested first
2. nested second
2. second
3. third
### task lists
- [ ] unchecked
- [x] checked
- [ ] partially done (if supported)
---
## 4. code blocks
### inline `code` example
### fenced blocks
```python
def factorial(n):
return 1 if n <= 1 else n * factorial(n - 1)
```
```bash
# shebang test
#!/bin/bash
echo "hello world"
```
```
plaintext with no language
preserves spaces and newlines
```
---
## 5. tables
| syntax | description | test |
|-------------|-------------|------|
| header | title | here |
| paragraph | text | more |
| `code` | **bold** | *italics* |
---
## 6. blockquotes
> single line
> multi-line
> continuation
>> nested blockquote
---
## 7. horizontal rules
text
---
text
***
text
___
---
## 8. links & images
[regular link](https://example.com)
[reference-style link][1]
[1]: https://example.com "title"
![image alt](https://via.placeholder.com/150 "placeholder")
---
## 9. footnotes
here's a footnote[^1].
[^1]: this is the footnote text.
---
## 10. html (if supported)
<span style="color: red">red text</span>
<br>
<button disabled>interactive (but not here)</button>
---
## 11. edge cases
### whitespace
line with irregular spaces
### unicode
emoji: 🚀 ✨ 🦊
symbols: ← ↑ → ↓ ↔ ↕ ⇄ ⇅
math: 30° ½ ¼ ¾ ± × ÷ ≠ ≤ ≥ ≈ ∞
### escapes
\*not bold\* \`not code\` \[not a link\](https://example.com)
### empty elements
[]
()
{}
---
## 12. mixed nesting
1. ordered item
> with a blockquote
> - and a nested list
2. another item
```
code block inside list
```
---
## 13. long content
lorem ipsum dolor sit amet, consectetur adipiscing elit. sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
---
## 14. definition lists (if supported)
term 1
: definition 1
term 2
: definition 2a
: definition 2b
---
## 15. math (if supported)
$E = mc^2$
$$\int_a^b f(x) dx$$