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.

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 serves pull diagnostics through textDocument/diagnostic under three diagnostic codes:

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

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

MethodParametersDescription
sqry/searchquery, path, limitStructured symbol search with all query predicates
sqry/hierarchicalSearchquery, path, maxFiles, maxSymbolsPerFile, maxTotalSymbols, includeContainerContext, languages, symbolKinds, scoreMinRAG-optimized search grouped by file and container
sqry/patternSearchpattern, path, limitSubstring and wildcard matching (*, ?)
sqry/similarSymbolsfilePath, symbolName, path, maxResults, similarityThresholdFind symbols similar to a reference symbol

Relation methods

MethodParametersDescription
sqry/referencesrelation, target, path, limitQuery a relation type (callers, callees, imports, exports, returns)
sqry/directCallerssymbol, path, limitSingle-hop callers only
sqry/directCalleessymbol, path, limitSingle-hop callees only
sqry/batchCallerCalleeCountsymbols[], pathCaller and callee counts for many symbols in one round-trip (used by code lenses)

Graph analysis methods

MethodParametersDescription
sqry/tracePathfromSymbol, toSymbol, path, maxHops, maxPaths, minConfidence, crossLanguageFind all call paths between two symbols
sqry/subgraphsymbols, path, maxDepth, maxNodes, includeCallers, includeCallees, includeImportsFocused subgraph around seed symbols
sqry/graphExportpath, filePath, symbolName, format, maxDepth, maxResults, includeCalls, includeImports, verboseExport as DOT, D2, Mermaid, or JSON
sqry/listCrossLanguageRelationspath, offset, limit, sort_order, source_language, target_languageFFI, HTTP, gRPC boundaries
sqry/graphStatspathNode/edge counts by language and file
sqry/showDependenciesfilePath, path, symbolName, maxDepth, maxResultsDependency tree for a file or symbol
sqry/dependencyImpactsymbol, path, maxDepth, includeIndirectReverse dependency analysis

Code quality methods

MethodParametersDescription
sqry/listUnusedSymbolspath, scope, limitDead code detection
sqry/listCircularDependenciespath, circular_type, limit, should_include_self_loopsCycle detection (calls, imports, modules)
sqry/listDuplicateGroupspath, duplicate_type, limitDuplicate code detection
sqry/isNodeInCyclesymbol, path, cycleType, showCycleCheck if a symbol is in a cycle
sqry/complexityMetricspath, target, minComplexity, sortByComplexity, maxResultsCyclomatic complexity analysis

Indexing and introspection methods

MethodParametersDescription
sqry/indexStatuspathIndex metadata and validation stats
sqry/workspaceStatusworkspace_idAggregate WorkspaceIndexStatus across all source roots
sqry/listFilespath, offset, limitAll indexed files
sqry/listSymbolspath, offset, limit, kindAll indexed symbols
sqry/listFilesByLanguagelanguage, path, offset, limitFiles filtered by language
sqry/getInsightspathCodebase health indicators

Diff, NL, and explain methods

MethodParametersDescription
sqry/semanticDiffbase, target, path, includeUnchanged, maxResults, filtersStructural changes between git refs
sqry/askquery, path, modelDir, allowUnverifiedModel, allowModelDownloadNatural language → sqry command translation
sqry/explainSymbolfilePath, symbolName, path, includeContext, includeRelationsSymbol 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.

Editor Setup →

Section Pages

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