Skip to content

Add inlay hints showing step binding info (F23) - #43

Merged
clrudolphi merged 1 commit into
masterfrom
feature/inlay-hints-binding-info
Jul 4, 2026
Merged

Add inlay hints showing step binding info (F23)#43
clrudolphi merged 1 commit into
masterfrom
feature/inlay-hints-binding-info

Conversation

@clrudolphi

Copy link
Copy Markdown
Collaborator

Summary

Fixes #23. Adds a textDocument/inlayHint handler for .feature files showing what each step is bound to, without leaving the feature file.

  • Binding hint — at the end of a defined step line: → CalculatorSteps.AddNumbers, with the full signature (declaring type + parameter types) in the hint's tooltip.
  • Ambiguous step (same step text matches more than one binding): → 2 matches, tooltip lists every candidate.
  • Templated step (a Scenario Outline/Background row resolves to more than one distinct binding across its example rows, without any single row being ambiguous on its own — FeatureBindingMatchSet.FromTags merges all rows into one MatchResult): → 2 bindings, distinguished from true ambiguity in both wording and a new GherkinInlayHintKind.Templated.
  • Undefined step: no hint — the existing diagnostic already covers it.

Hints refresh after edits via a debounced workspace/inlayHint/refresh, gated on the client advertising workspace.inlayHint.refreshSupport (mirrors SemanticTokensRefreshHandler).

Scope

There's a fuller draft plan at docs/InlayHints-Implementation-Plan.md (parameter-type hints, settings surface, resolve-deferred tooltips, VS capability-verification gate). Per discussion before starting, this PR is intentionally scoped down:

  • No parameter-type hints — issue asks for binding info (class/method/signature), not parameter types; can be a follow-up.
  • No settings surface — hint is always on; editors' own "disable inlay hints" gesture is the opt-out for now.
  • No inlayHint/resolve — the tooltip (method name + parameter types) is cheap to compute, so it's built eagerly rather than deferred.
  • No VS-specific gating — this is standard LSP; if a client doesn't consume textDocument/inlayHint the feature is simply dormant there (rendering is entirely client-side, same as any other pull feature — there's no server-side workaround either way).

Test plan

  • dotnet test tests/LSP/Reqnroll.IdeSupport.LSP.Core.Tests — 435 passed (1 pre-existing skip), 5 new covering GherkinInlayHintService (defined/undefined/ambiguous/templated/multiple-steps)
  • dotnet test tests/LSP/Reqnroll.IdeSupport.LSP.Server.Tests — 527 passed, 8 new covering FeatureInlayHintHandler (empty match set, position/label/tooltip, viewport-range filtering, registration options) and InlayHintRefreshHandler (capability gating, debounce)

🤖 Generated with Claude Code

New textDocument/inlayHint handler for .feature files: shows the bound
step definition's method name at the end of each step line, with the
full signature (declaring type + parameter types) in the hint's
tooltip. Reuses the existing binding-match cache, no new discovery
work.

- GherkinInlayHintService (LSP.Core) projects a FeatureBindingMatchSet
  into hints, independent of any protocol/IDE types so the projection
  logic is directly unit-testable.
- FeatureInlayHintHandler (LSP.Server) resolves the match set for the
  requesting document's primary owner and filters hints to the
  requested viewport range.
- InlayHintRefreshHandler asks the client to re-pull hints after a
  match-cache change, debounced and gated on the client's advertised
  workspace.inlayHint.refreshSupport — mirrors SemanticTokensRefreshHandler.

Special cases called out in the issue:
- Undefined step: no hint (the diagnostic already covers it).
- Ambiguous step (same text matches >1 binding): "N matches" hint
  listing every candidate in the tooltip.
- Templated step (a Scenario Outline/Background row-merged match
  resolving to >1 *distinct* binding across rows, without any single
  row being ambiguous on its own): "N bindings" hint, distinguished
  from true ambiguity.

Scoped down from the fuller draft plan (docs/InlayHints-Implementation-Plan.md)
per discussion: no parameter-type hints, no settings surface (hint is
always on), no resolve deferral (tooltip is built eagerly — signature
computation is cheap, so there's no need for inlayHint/resolve), and no
VS-specific capability-gating (this is standard LSP; if a client
doesn't consume it the feature is simply dormant there, same as any
other pull feature).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@clrudolphi
clrudolphi merged commit cefd536 into master Jul 4, 2026
8 checks passed
@clrudolphi
clrudolphi deleted the feature/inlay-hints-binding-info branch July 4, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Inlay hints to display binding info

1 participant