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.

CapabilityLSP Method
Go to DefinitiontextDocument/definition
Find ReferencestextDocument/references
HovertextDocument/hover
Document SymbolstextDocument/documentSymbol
Workspace Symbolsworkspace/symbol
Prepare Call HierarchytextDocument/prepareCallHierarchy
Incoming CallscallHierarchy/incomingCalls
Outgoing CallscallHierarchy/outgoingCalls

Workspace commands

sqry advertises an LSP executeCommand capability with four workspace commands. Editors invoke them via workspace/executeCommand:

CommandEffect
sqry.indexTrigger an index rebuild for the active workspace
sqry.showCallersShow direct callers of the symbol at the cursor
sqry.showReferencesShow all references to the symbol at the cursor
sqry.explainSymbolOpen the symbol explanation panel (signature, doc, callers, callees)

Diagnostics

sqry publishes structural diagnostics on document open and save under three source IDs:

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>:

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

MethodParametersDescription
sqry/searchquery, limit, kind, lang, fileStructured symbol search with all query predicates
sqry/hierarchicalSearchquery, maxFiles, maxSymbolsPerFile, languages, symbolKindsRAG-optimized search grouped by file and container
sqry/patternSearchpattern, limitSubstring and wildcard matching (*, ?)
sqry/similarSymbolsfilePath, symbolName, maxResults, similarityThresholdFind symbols similar to a reference symbol

Relation methods

MethodParametersDescription
sqry/relationrelation, target, limitQuery any relation type (callers, callees, imports, exports, returns)
sqry/referencessymbol, path, limitAll reference locations across the workspace
sqry/directCallerssymbol, limitSingle-hop callers only
sqry/directCalleessymbol, limitSingle-hop callees only
sqry/callHierarchysymbol, direction, maxDepthFull call tree (incoming or outgoing)
sqry/batchCallerCalleeCountsymbols[]Caller and callee counts for many symbols in one round-trip (used by code lenses)

Graph analysis methods

MethodParametersDescription
sqry/tracePathfromSymbol, toSymbol, maxHops, maxPathsFind all call paths between two symbols
sqry/subgraphsymbols, maxDepth, maxNodesFocused subgraph around seed symbols
sqry/graphExportformat, symbolName, maxDepthExport as DOT, D2, Mermaid, or JSON
sqry/listCrossLanguageRelationssourceLanguage, targetLanguage, limitFFI, HTTP, gRPC boundaries
sqry/graphStatspathNode/edge counts by language and file
sqry/showDependenciesfilePath, symbolName, maxDepthDependency tree for a file or symbol
sqry/dependencyImpactsymbol, maxDepth, includeIndirectReverse dependency analysis

Code quality methods

MethodParametersDescription
sqry/listUnusedSymbolsscope, limitDead code detection
sqry/listCircularDependenciescircularType, limitCycle detection (calls, imports, modules)
sqry/listDuplicateGroupsduplicateType, limitDuplicate code detection
sqry/isNodeInCyclesymbol, cycleType, showCycleCheck if a symbol is in a cycle
sqry/complexityMetricstarget, minComplexity, maxResultsCyclomatic complexity analysis

Indexing and introspection methods

MethodParametersDescription
sqry/indexpath, forceTrigger an index build (returns when complete)
sqry/indexStatuspathIndex metadata and validation stats
sqry/workspaceStatusworkspaceAggregate WorkspaceIndexStatus across all source roots
sqry/listFilespath, offset, limitAll indexed files
sqry/listSymbolskind, offset, limitAll indexed symbols
sqry/listFilesByLanguagelanguage, limitFiles filtered by language
sqry/getInsightspathCodebase health indicators

Diff, NL, and explain methods

MethodParametersDescription
sqry/semanticDiffbase, target, filtersStructural changes between git refs
sqry/askqueryNatural language → sqry command translation
sqry/explainSymbolfilePath, symbolName, includeContext, includeRelationsSymbol explanation with context

All custom methods return JSON-RPC responses. Parameters follow the same schema as the corresponding MCP tools.

Editor Setup →

Section Pages

Editor Setup
Configure sqry LSP in VSCode, Neovim, and Helix.