Add inlay hints showing step binding info (F23) - #43
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #23. Adds a
textDocument/inlayHinthandler for.featurefiles showing what each step is bound to, without leaving the feature file.→ CalculatorSteps.AddNumbers, with the full signature (declaring type + parameter types) in the hint's tooltip.→ 2 matches, tooltip lists every candidate.FeatureBindingMatchSet.FromTagsmerges all rows into oneMatchResult):→ 2 bindings, distinguished from true ambiguity in both wording and a newGherkinInlayHintKind.Templated.Hints refresh after edits via a debounced
workspace/inlayHint/refresh, gated on the client advertisingworkspace.inlayHint.refreshSupport(mirrorsSemanticTokensRefreshHandler).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:inlayHint/resolve— the tooltip (method name + parameter types) is cheap to compute, so it's built eagerly rather than deferred.textDocument/inlayHintthe 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 coveringGherkinInlayHintService(defined/undefined/ambiguous/templated/multiple-steps)dotnet test tests/LSP/Reqnroll.IdeSupport.LSP.Server.Tests— 527 passed, 8 new coveringFeatureInlayHintHandler(empty match set, position/label/tooltip, viewport-range filtering, registration options) andInlayHintRefreshHandler(capability gating, debounce)🤖 Generated with Claude Code