AGENTS.md
src/tools/lsp/AGENTS.mdAGENTS.md
Quality
74/100
Scores the file, not the repository.Length
543 words
16 headings · 6 code blocksRepository
38k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1<!-- Parent: ../AGENTS.md -->2<!-- Generated: 2026-01-28 | Updated: 2026-01-28 -->34# lsp56Language Server Protocol (LSP) client implementation providing IDE-like code intelligence.78## Purpose910This directory implements the LSP client that enables agents to:11- Connect to language servers (TypeScript, Python, Rust, Go, etc.)12- Get type information, documentation, and signatures13- Find definitions, references, and symbols14- Perform refactoring operations (rename, code actions)15- Collect diagnostics (errors, warnings)1617## Key Files1819| File | Description |20|------|-------------|21| `index.ts` | Module exports - re-exports client, servers, utils |22| `client.ts` | `LspClient` class - JSON-RPC 2.0 over stdio communication |23| `servers.ts` | `LSP_SERVERS` config - known language server definitions |24| `utils.ts` | Formatting utilities for LSP responses |2526## For AI Agents2728### Working In This Directory2930#### LSP Client Architecture3132```33┌─────────────────┐ JSON-RPC 2.0 ┌──────────────────┐34│ LspClient │◄────────────────────►│ Language Server │35│ │ stdio │ (tsserver, etc.) │36│ - connect() │ │ │37│ - hover() │ │ │38│ - definition() │ │ │39│ - references() │ │ │40│ - diagnostics() │ │ │41└─────────────────┘ └──────────────────┘42```4344#### Client Manager4546`lspClientManager` is a singleton that pools connections:4748```typescript49// Get client for a file (auto-selects appropriate server)50const client = await lspClientManager.getClientForFile('src/index.ts');5152// Client is reused for same workspace/server combo53const key = `${workspaceRoot}:${serverConfig.command}`;54```5556#### Server Configuration5758Each server in `LSP_SERVERS` has:59```typescript60interface LspServerConfig {61 name: string; // Human-readable name62 command: string; // Executable command63 args: string[]; // Command arguments64 extensions: string[]; // File extensions handled65 installHint: string; // Installation instructions66}67```6869### Common Patterns7071**Request/Response:**72```typescript73// All requests use JSON-RPC 2.0 format74const request = {75 jsonrpc: '2.0',76 id: this.requestId++,77 method: 'textDocument/hover',78 params: { textDocument: { uri }, position: { line, character } }79};8081// Wrapped in Content-Length header82const message = `Content-Length: ${content.length}\r\n\r\n${content}`;83```8485**Notification handling:**86```typescript87// Server pushes diagnostics via notifications88if (notification.method === 'textDocument/publishDiagnostics') {89 this.diagnostics.set(params.uri, params.diagnostics);90}91```9293### Testing Requirements9495LSP tests require language servers to be installed:96```bash97# Install TypeScript server98npm i -g typescript-language-server typescript99100# Run tests101npm test -- --grep "lsp"102```103104## Dependencies105106### Internal107- None108109### External110| Package | Purpose |111|---------|---------|112| `vscode-languageserver-protocol` | LSP type definitions |113| `child_process` | Spawning language servers |114| `fs`, `path` | File operations |115116## Supported Language Servers117118This table documents catalog/discovery support. Runtime semantic quality still depends on installing and correctly configuring the underlying language server.119120| Language | Server | Command | Extensions |121|----------|--------|---------|------------|122| TypeScript/JS | typescript-language-server | `typescript-language-server` | .ts, .tsx, .js, .jsx |123| Python | ty | `ty server` | .py, .pyw |124| Rust | rust-analyzer | `rust-analyzer` | .rs |125| Go | gopls | `gopls` | .go |126| C/C++ | clangd | `clangd` | .c, .h, .cpp, .cc, .hpp |127| Java | jdtls | `jdtls` | .java |128| JSON | vscode-json-language-server | `vscode-json-language-server` | .json, .jsonc |129| HTML | vscode-html-language-server | `vscode-html-language-server` | .html, .htm |130| CSS | vscode-css-language-server | `vscode-css-language-server` | .css, .scss, .less |131| Vue | vue-language-server | `vue-language-server --stdio` | .vue |132| YAML | yaml-language-server | `yaml-language-server` | .yaml, .yml |133134<!-- MANUAL: -->135
Also in Yeachan-Heo/oh-my-claudecode
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Yeachan-Heo/oh-my-claudecode.github/CLAUDE.md · 38k | CLAUDE.md | setupbuildstylegit+2 | 79/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodeAGENTS.md · 38k | AGENTS.md | setuplint-formatstyletypes+4 | 45/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodeskills/AGENTS.md · 38k | AGENTS.md | teststylearchdependencies+1 | 66/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/AGENTS.md · 38k | AGENTS.md | buildteststylearch+2 | 77/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/agents/AGENTS.md · 38k | AGENTS.md | teststylearchdependencies+1 | 66/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/features/AGENTS.md · 38k | AGENTS.md | teststylearchdependencies | 74/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/hooks/AGENTS.md · 38k | AGENTS.md | setupteststylearch+2 | 74/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/tools/AGENTS.md · 38k | AGENTS.md | setupteststylearch+1 | 86/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/tools/diagnostics/AGENTS.md · 38k | AGENTS.md | teststylearchtypes+2 | 77/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodeCLAUDE.md · 38k | CLAUDE.md | setupbuildstylegit+1 | 65/100 | 3 days ago |
Diff against .github/CLAUDE.md Diff against AGENTS.md Diff against skills/AGENTS.md Diff against src/AGENTS.md Diff against src/agents/AGENTS.md Diff against src/features/AGENTS.md Diff against src/hooks/AGENTS.md Diff against src/tools/AGENTS.md Diff against src/tools/diagnostics/AGENTS.md Diff against CLAUDE.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago |
