Skip to content

Add indexed call hierarchy navigation to LSP #5351

Description

@Widthdom

Problem and priority

P2 — posting order 8/10. Audit candidates: D09.

The LSP endpoint supports definitions/references and other navigation, while callers/callees available through CLI/MCP are not exposed as LSP call hierarchy. Adding the standard protocol surface would make recursive caller/callee exploration available directly in editors.

Observed protocol behavior

In a real initialized LSP session using the repository-built server and .cdidx/codeindex.db, definition, references, hover, completion, document symbols and semantic tokens succeeded. Initialize did not advertise call hierarchy; textDocument/prepareCallHierarchy returned:

{"code":-32601,"message":"Method not found: textDocument/prepareCallHierarchy"}

This is a feature request for an unimplemented method, not a failure of an advertised capability. The existing CLI/MCP callers/callees provide the underlying graph navigation.

Implementation instructions and cautions

Start with src/CodeIndex/Lsp/LspServer.Protocol.cs, the existing position-resolution/navigation/location helpers and shared graph query APIs.

  • Implement textDocument/prepareCallHierarchy, callHierarchy/incomingCalls and callHierarchy/outgoingCalls, then advertise callHierarchyProvider only when the surface is supported.
  • Resolve the selected callable using existing symbol identity and selection rules. Carry bounded opaque item data tied to the indexed generation; do not join by a bare leaf name or silently merge ambiguous symbols.
  • Produce protocol-correct UTF-16 range, selectionRange and call-site fromRanges with valid file URIs. Reuse existing LSP coordinate and path policy.
  • Keep unresolved/ambiguous references and incomplete graph coverage conservative. Define how the standard protocol reports unavailable/stale/partial data; an empty result must not silently claim compiler-grade completeness.
  • Account for unsaved documents, generation changes, cancellation and bounded fan-in/fan-out. Share CLI/MCP graph semantics instead of introducing new language binding or unrelated graph-accuracy changes.

Acceptance and validation

  • Use an end-to-end LSP fixture with a caller, callee, overloads/same-name symbols and repeated call sites; prepare/incoming/outgoing results identify correct symbols and ranges.
  • Cover unsupported/non-callable positions, incomplete/unresolved graphs, stale items, unsaved changes, Unicode columns, cancellation and high-degree nodes.
  • Verify capability discovery and preserve current definition/reference/document-symbol behavior. Document supported languages and the indexed-graph limitations.

Prior history

A targeted closed/open issue search found no exact call-hierarchy request. The audit did not find an advertised call-hierarchy contract that regressed.

Baseline and delivery

Observed during the 2026-09-12 dogfood audit on macOS arm64, using repository-built cdidx 1.49.0 / Debug net8.0 at 36f2e68cb0d7f17bc9591d01ad3045abe870da9b. The build passed with zero warnings/errors. The root database and workspace-manifest freshness checks were healthy, with index and reference-graph completeness true. Counts/timings describe that checkout. Validation during discovery used focused CLI/MCP/LSP reproductions, not the full test suite.

Implement one focused PR for this issue. Follow AGENT_GUIDE.md and the relevant workflows, use the repository-built cdidx for discovery, preserve supported .NET 8/.NET 9 and cross-platform behavior, and avoid new runtime dependencies outside repository policy. Add focused behavioral tests for changed contracts, update affected help/documentation, and include a bilingual changelog.d/unreleased/ fragment for user-visible changes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .NET codeenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions