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, code actions, pull diagnostics, code lenses, and call hierarchy — and extends them with 29 custom sqry/* methods. Those custom methods expose the code graph through semantic search, hierarchical search, relation queries, direct 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 for command-style actions. 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 automatically rebuild the graph for every query. Rebuild the index after significant code changes with sqry index --force ., or let an editor invoke the sqry.index execute-command when you explicitly request an index rebuild.
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.
Use the root CLI form sqry --workspace <path> lsp --stdio to override workspace resolution before the lsp subcommand runs. For the standalone LSP binary or direct subcommand options, --index-root <path> remains available as a legacy override, but in-band workspace signals from editor initialization (initializationOptions.sqry.workspace or initializationOptions.sqry.indexRoot) are preferred and make --index-root redundant. For daemon-backed LSP, use sqry lsp --daemon; --daemon owns stdio and is mutually exclusive with --stdio and --socket.
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 serves pull diagnostics through textDocument/diagnostic under three diagnostic codes:
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 29 custom methods in the sqry/ namespace. They are sent as JSON-RPC requests with the method name sqry/<name>:
- Indexing:
sqry/indexStatus,sqry/workspaceStatus - Search:
sqry/search,sqry/hierarchicalSearch,sqry/patternSearch,sqry/similarSymbols - Relations:
sqry/references,sqry/directCallers,sqry/directCallees,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
Full call hierarchy is exposed through the standard LSP 3.17 textDocument/prepareCallHierarchy, callHierarchy/incomingCalls, and callHierarchy/outgoingCalls methods.
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, path, limit | Structured symbol search with all query predicates |
sqry/hierarchicalSearch | query, path, maxFiles, maxSymbolsPerFile, maxTotalSymbols, includeContainerContext, languages, symbolKinds, scoreMin | RAG-optimized search grouped by file and container |
sqry/patternSearch | pattern, path, limit | Substring and wildcard matching (*, ?) |
sqry/similarSymbols | filePath, symbolName, path, maxResults, similarityThreshold | Find symbols similar to a reference symbol |
Relation methods
| Method | Parameters | Description |
|---|---|---|
sqry/references | relation, target, path, limit | Query a relation type (callers, callees, imports, exports, returns) |
sqry/directCallers | symbol, path, limit | Single-hop callers only |
sqry/directCallees | symbol, path, limit | Single-hop callees only |
sqry/batchCallerCalleeCount | symbols[], path | 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, path, maxHops, maxPaths, minConfidence, crossLanguage | Find all call paths between two symbols |
sqry/subgraph | symbols, path, maxDepth, maxNodes, includeCallers, includeCallees, includeImports | Focused subgraph around seed symbols |
sqry/graphExport | path, filePath, symbolName, format, maxDepth, maxResults, includeCalls, includeImports, verbose | Export as DOT, D2, Mermaid, or JSON |
sqry/listCrossLanguageRelations | path, offset, limit, sort_order, source_language, target_language | FFI, HTTP, gRPC boundaries |
sqry/graphStats | path | Node/edge counts by language and file |
sqry/showDependencies | filePath, path, symbolName, maxDepth, maxResults | Dependency tree for a file or symbol |
sqry/dependencyImpact | symbol, path, maxDepth, includeIndirect | Reverse dependency analysis |
Code quality methods
| Method | Parameters | Description |
|---|---|---|
sqry/listUnusedSymbols | path, scope, limit | Dead code detection |
sqry/listCircularDependencies | path, circular_type, limit, should_include_self_loops | Cycle detection (calls, imports, modules) |
sqry/listDuplicateGroups | path, duplicate_type, limit | Duplicate code detection |
sqry/isNodeInCycle | symbol, path, cycleType, showCycle | Check if a symbol is in a cycle |
sqry/complexityMetrics | path, target, minComplexity, sortByComplexity, maxResults | Cyclomatic complexity analysis |
Indexing and introspection methods
| Method | Parameters | Description |
|---|---|---|
sqry/indexStatus | path | Index metadata and validation stats |
sqry/workspaceStatus | workspace_id | Aggregate WorkspaceIndexStatus across all source roots |
sqry/listFiles | path, offset, limit | All indexed files |
sqry/listSymbols | path, offset, limit, kind | All indexed symbols |
sqry/listFilesByLanguage | language, path, offset, limit | Files filtered by language |
sqry/getInsights | path | Codebase health indicators |
Diff, NL, and explain methods
| Method | Parameters | Description |
|---|---|---|
sqry/semanticDiff | base, target, path, includeUnchanged, maxResults, filters | Structural changes between git refs |
sqry/ask | query, path, modelDir, allowUnverifiedModel, allowModelDownload | Natural language → sqry command translation |
sqry/explainSymbol | filePath, symbolName, path, includeContext, includeRelations | Symbol explanation with context |
All custom methods return JSON-RPC responses. They use LSP-specific request schemas, not the MCP tool schemas; method names and payload fields are shown above in their wire casing.