LSP Integration
Overview
sqry ships a full Language Server Protocol (LSP) server. It implements the standard LSP capabilities editors already know — go to definition, find references, hover, document symbols, workspace symbols, and call hierarchy — and extends them with 32 custom sqry/* methods. Those custom methods expose everything in the code graph: semantic search, hierarchical search, relation queries, callers and callees, workspace status, graph export, trace path, subgraph extraction, cross-language edges, dependency impact, duplicate detection, cycle detection, unused-symbol analysis, complexity metrics, semantic git diff, and natural language query translation. The server also advertises an executeCommand capability, publishes sqry::unused, sqry::cycle, and sqry::duplicate diagnostics, and emits caller-count code lenses above each definition. Any editor or tool that speaks LSP can connect to sqry and use both the standard and extended capabilities.
Prerequisites
Run sqry index . in your project directory before starting the LSP server. The server reads the index sqry builds; it does not index on demand. Rebuild the index after significant code changes with sqry index --force ..
cd /path/to/your/project
sqry index .
Start the server
sqry LSP supports two transport modes.
stdio (recommended for most editors) — the editor spawns the server as a child process and communicates over stdin/stdout:
sqry lsp --stdio
socket (useful when multiple editor windows should share one running server) — the server binds to a TCP address and editors connect to it:
sqry lsp --socket 127.0.0.1:9257
Always bind to localhost (127.0.0.1 or ::1) when using socket mode. Binding to 0.0.0.0 exposes your source code and symbol graph to the network without authentication. See the security guide for remote development scenarios.
Pass --workspace <path> to override workspace resolution. The flag follows the same precedence sqry-mcp uses: explicit --workspace wins, then file-bearing arguments, MCP roots, last-resolved workspace, and finally legacy environment/CWD fallback.
Standard capabilities
These methods work with any LSP-compatible editor without any extra configuration.
| Capability | LSP Method |
|---|---|
| Go to Definition | textDocument/definition |
| Find References | textDocument/references |
| Hover | textDocument/hover |
| Document Symbols | textDocument/documentSymbol |
| Workspace Symbols | workspace/symbol |
| Prepare Call Hierarchy | textDocument/prepareCallHierarchy |
| Incoming Calls | callHierarchy/incomingCalls |
| Outgoing Calls | callHierarchy/outgoingCalls |
Workspace commands
sqry advertises an LSP executeCommand capability with four workspace commands. Editors invoke them via workspace/executeCommand:
| Command | Effect |
|---|---|
sqry.index | Trigger an index rebuild for the active workspace |
sqry.showCallers | Show direct callers of the symbol at the cursor |
sqry.showReferences | Show all references to the symbol at the cursor |
sqry.explainSymbol | Open the symbol explanation panel (signature, doc, callers, callees) |
Diagnostics
sqry publishes structural diagnostics on document open and save under three source IDs:
sqry::unused— flagged unused symbols (functions, methods, types, constants)sqry::cycle— symbols participating in a call or import cyclesqry::duplicate— duplicate symbol groups detected by the graph
Code lenses
sqry emits a caller-count code lens above each definition: N callers. Clicking the lens runs the sqry.showCallers command for that symbol.
Custom sqry methods
sqry adds 32 custom methods in the sqry/ namespace. They are sent as JSON-RPC requests with the method name sqry/<name>:
- Indexing:
sqry/index,sqry/indexStatus,sqry/workspaceStatus - Search:
sqry/search,sqry/hierarchicalSearch,sqry/patternSearch,sqry/similarSymbols - Relations:
sqry/relation,sqry/references,sqry/directCallers,sqry/directCallees,sqry/callHierarchy,sqry/batchCallerCalleeCount - Graph analysis:
sqry/tracePath,sqry/subgraph,sqry/graphExport,sqry/listCrossLanguageRelations,sqry/graphStats,sqry/showDependencies,sqry/dependencyImpact - Code quality:
sqry/listUnusedSymbols,sqry/listCircularDependencies,sqry/listDuplicateGroups,sqry/isNodeInCycle,sqry/complexityMetrics - Introspection:
sqry/listFiles,sqry/listSymbols,sqry/listFilesByLanguage,sqry/getInsights - Diff:
sqry/semanticDiff - Natural language:
sqry/ask - Explain:
sqry/explainSymbol
Editor integrations can call these methods directly or surface them as commands. The sqry VSCode extension and the Neovim and Helix configurations below wire the most common ones to keybindings and command palettes.
Custom method reference
Search methods
| Method | Parameters | Description |
|---|---|---|
sqry/search | query, limit, kind, lang, file | Structured symbol search with all query predicates |
sqry/hierarchicalSearch | query, maxFiles, maxSymbolsPerFile, languages, symbolKinds | RAG-optimized search grouped by file and container |
sqry/patternSearch | pattern, limit | Substring and wildcard matching (*, ?) |
sqry/similarSymbols | filePath, symbolName, maxResults, similarityThreshold | Find symbols similar to a reference symbol |
Relation methods
| Method | Parameters | Description |
|---|---|---|
sqry/relation | relation, target, limit | Query any relation type (callers, callees, imports, exports, returns) |
sqry/references | symbol, path, limit | All reference locations across the workspace |
sqry/directCallers | symbol, limit | Single-hop callers only |
sqry/directCallees | symbol, limit | Single-hop callees only |
sqry/callHierarchy | symbol, direction, maxDepth | Full call tree (incoming or outgoing) |
sqry/batchCallerCalleeCount | symbols[] | Caller and callee counts for many symbols in one round-trip (used by code lenses) |
Graph analysis methods
| Method | Parameters | Description |
|---|---|---|
sqry/tracePath | fromSymbol, toSymbol, maxHops, maxPaths | Find all call paths between two symbols |
sqry/subgraph | symbols, maxDepth, maxNodes | Focused subgraph around seed symbols |
sqry/graphExport | format, symbolName, maxDepth | Export as DOT, D2, Mermaid, or JSON |
sqry/listCrossLanguageRelations | sourceLanguage, targetLanguage, limit | FFI, HTTP, gRPC boundaries |
sqry/graphStats | path | Node/edge counts by language and file |
sqry/showDependencies | filePath, symbolName, maxDepth | Dependency tree for a file or symbol |
sqry/dependencyImpact | symbol, maxDepth, includeIndirect | Reverse dependency analysis |
Code quality methods
| Method | Parameters | Description |
|---|---|---|
sqry/listUnusedSymbols | scope, limit | Dead code detection |
sqry/listCircularDependencies | circularType, limit | Cycle detection (calls, imports, modules) |
sqry/listDuplicateGroups | duplicateType, limit | Duplicate code detection |
sqry/isNodeInCycle | symbol, cycleType, showCycle | Check if a symbol is in a cycle |
sqry/complexityMetrics | target, minComplexity, maxResults | Cyclomatic complexity analysis |
Indexing and introspection methods
| Method | Parameters | Description |
|---|---|---|
sqry/index | path, force | Trigger an index build (returns when complete) |
sqry/indexStatus | path | Index metadata and validation stats |
sqry/workspaceStatus | workspace | Aggregate WorkspaceIndexStatus across all source roots |
sqry/listFiles | path, offset, limit | All indexed files |
sqry/listSymbols | kind, offset, limit | All indexed symbols |
sqry/listFilesByLanguage | language, limit | Files filtered by language |
sqry/getInsights | path | Codebase health indicators |
Diff, NL, and explain methods
| Method | Parameters | Description |
|---|---|---|
sqry/semanticDiff | base, target, filters | Structural changes between git refs |
sqry/ask | query | Natural language → sqry command translation |
sqry/explainSymbol | filePath, symbolName, includeContext, includeRelations | Symbol explanation with context |
All custom methods return JSON-RPC responses. Parameters follow the same schema as the corresponding MCP tools.