# lsp > Code intelligence for large codebases. LSP (30+ languages) for definitions, references, call hierarchy, rename. ast-grep for structural search/replace. - Author: Parker Hancock - Repository: SanctionedCodeList/lsp-skill - Version: 20260126211538 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/SanctionedCodeList/lsp-skill - Web: https://mule.run/skillshub/@@SanctionedCodeList/lsp-skill~lsp:20260126211538 --- --- name: lsp description: "Code intelligence for large codebases. LSP (30+ languages) for definitions, references, call hierarchy, rename. ast-grep for structural search/replace." hooks: PreToolUse: - matcher: ".*" command: "${CLAUDE_PLUGIN_ROOT}/skills/lsp/install.sh" once: true --- # LSP Skill Query language servers for code intelligence. Supports 37 languages. ## Quick API ```typescript import { hover, definition, references, symbols } from "${CLAUDE_PLUGIN_ROOT}/src/simple"; const info = await hover("src/main.py", 10, 5); // Type info + docs const def = await definition("src/main.py", 10, 5); // Jump to definition const refs = await references("src/main.py", 10, 5); // Find all usages const syms = await symbols("src/main.py"); // File outline ``` Positions are 0-indexed (line, character). Servers are cached automatically. ## Available Functions | Function | Returns | Use | |----------|---------|-----| | `hover(file, line, col)` | Hover | Type info + docs | | `definition(file, line, col)` | Location[] | Jump to definition | | `references(file, line, col)` | Location[] | Find all usages | | `symbols(file)` | Symbol[] | File outline | | `rename(file, line, col, newName)` | WorkspaceEdit | Rename across workspace | | `typeDefinition(file, line, col)` | Location[] | Go to type definition | | `implementation(file, line, col)` | Location[] | Find implementations | | `workspaceSymbols(query)` | Symbol[] | Search symbols by name | | `closeAll()` | void | Cleanup all servers | ## Full API (Advanced) For call hierarchy or custom queries, use ts-lsp-client directly: ```typescript import { JSONRPCEndpoint, LspClient } from "ts-lsp-client"; import { getServer, fileUri } from "${CLAUDE_PLUGIN_ROOT}/src/client"; const conn = await getServer(process.cwd(), "typescript"); const endpoint = new JSONRPCEndpoint(conn.writer, conn.reader); const client = new LspClient(endpoint); // ... initialize, query, cleanup ``` ## Structural Search: ast-grep For pattern-based search/replace across codebases, use `ast-grep`: ```bash # Find pattern ast-grep -p 'console.log($$$)' --lang ts src/ # Find and replace ast-grep -p 'assert($A == $B)' -r 'assertEqual($A, $B)' --lang python # Interactive mode ast-grep scan --interactive ``` Pattern syntax: `$A` matches single node, `$$$` matches multiple. See https://ast-grep.github.io/ ## Supported Languages Grep `SERVERS.md` in plugin root for full list. Supports 30+ languages including Python, TypeScript, Rust, Go, C/C++, Java, Ruby, PHP, Swift, Lua, Haskell, and more. ```bash grep -i "python\|rust\|go" ${CLAUDE_PLUGIN_ROOT}/SERVERS.md ``` ## LSP Specification Full protocol: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/