Skip to content

Show colliding step bindings when hovering an ambiguous step - #39

Merged
clrudolphi merged 1 commit into
masterfrom
fix/ambiguous-step-hover-lists-bindings
Jul 4, 2026
Merged

Show colliding step bindings when hovering an ambiguous step#39
clrudolphi merged 1 commit into
masterfrom
fix/ambiguous-step-hover-lists-bindings

Conversation

@clrudolphi

Copy link
Copy Markdown
Collaborator

Summary

Fixes #18: hovering an ambiguous step in both VS and VS Code now lists the step definitions that collide, instead of a generic "Ambiguous step definition." message.

Root cause

There's no custom hover handler in this repo — hover tooltips for step diagnostics come from the standard textDocument/publishDiagnostics message, which both editors render on hover by default. DiagnosticsAggregator was building the ambiguous diagnostic from a hardcoded constant ("Ambiguous step definition."), discarding the detailed message that MatchResult.CreateMultiMatch already assembles — a "Ambiguous steps:" header followed by every colliding binding's ToString() (step type, expression, and implementing method). That's the same logic the legacy Reqnroll.VisualStudio extension used to get its ambiguous-step tooltip, so this brings the new LSP-based server back to parity with it.

Change

DiagnosticsAggregator.Aggregate now uses step.Result.GetErrorMessage() (falling back to the old generic message only if that's somehow null) when building the diagnostic for each ambiguous step.

Test plan

  • dotnet test tests/LSP/Reqnroll.IdeSupport.LSP.Core.Tests — 429 passed, 1 skipped (pre-existing, unrelated)
  • dotnet test tests/LSP/Reqnroll.IdeSupport.LSP.Server.Tests — 521 passed
  • Updated Ambiguous_step_produces_Error_diagnostic_with_correct_message_and_source to assert the message lists every colliding binding rather than pinning the old generic string

🤖 Generated with Claude Code

DiagnosticsAggregator reported a hardcoded "Ambiguous step definition."
message for every ambiguous step, even though MatchResult.CreateMultiMatch
already builds a detailed error message listing every colliding binding
(the same logic the legacy VS extension used). Since the diagnostic
message is what both VS and VS Code show on hover, ambiguous steps only
ever surfaced the generic one-liner instead of the matches causing the
ambiguity.

Use step.Result.GetErrorMessage() for the ambiguous diagnostic so hover
lists the colliding step definitions, matching the legacy VS extension's
behavior.

Fixes #18

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@clrudolphi
clrudolphi merged commit 679252f into master Jul 4, 2026
8 checks passed
@clrudolphi
clrudolphi deleted the fix/ambiguous-step-hover-lists-bindings branch July 4, 2026 14:07
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.

VS: hovering over an ambiguous step should show matches

1 participant