Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 19, 2025

When scenario call expansion fails (missing feature/scenario, exceptions), the original call line was left in the generated output, appearing as an undefined step (purple) in tooling. Users received only a generic warning without understanding why expansion failed.

Changes

  • Remove undefined call lines: Original scenario call lines are now excluded from output when expansion fails, preventing undefined step errors
  • Diagnostic messages: Return specific error context instead of null:
    • Feature file not found: includes search path guidance
    • Scenario not found: suggests checking spelling/case
    • Exceptions: surfaces the error message
  • New method: FindScenarioStepsWithDiagnostics returns (steps, diagnosticMessage) tuple instead of just steps

Example

Before:

Scenario: Test
    Given I call scenario "Missing" from feature "Unknown"
    # Warning: Could not expand scenario call
    Then I continue

The undefined call line remains, causing purple highlighting.

After:

Scenario: Test
    # ERROR: Could not find feature file for "Unknown". Ensure the feature file exists in the project or referenced projects.
    Then I continue

Call line removed, actionable diagnostic provided.

Original prompt

This section details on the original issue you should resolve

<issue_title>Scenario call line remains purple (undefined) due to missing/failed expansion</issue_title>
<issue_description>Lines like Given I call scenario "OpgaveDieEenDetailRegelBevatOpenen" from feature "Opgave" remain highlighted in purple in the editor, indicating the line is considered an undefined step.

Current situation:

  • The design intent of this plugin is that scenario call lines are expanded at generation/preprocessing time, so that the call line itself should not require a step definition.
  • If expansion fails (e.g., scenario not found, feature not found, dialect mismatch, unsupported context such as Background, etc.), the original call line can remain in the generated/processed output and therefore appears as “undefined” (purple) in tooling.

Expected functionality:

  • Scenario call lines should either:
    • Always expand (so the call line never remains), OR
    • If expansion cannot be performed, produce a very explicit diagnostic explaining why (feature not found, scenario not found, language mismatch, background limitation, etc.) so users can fix it quickly.

References (where expansion happens / fails):

Implementation hint:

  • Add a “strict mode” option (or default behavior) that fails generation when a scenario call cannot be resolved, rather than leaving the original call line behind.
  • Alternatively, append a detailed comment right above the unexpanded line with the exact resolution failure reason.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 19, 2025 08:17
Co-authored-by: jgerits <6541449+jgerits@users.noreply.github.com>
Co-authored-by: jgerits <6541449+jgerits@users.noreply.github.com>
Co-authored-by: jgerits <6541449+jgerits@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix scenario call line highlighting due to expansion issues Replace undefined scenario call lines with detailed diagnostic errors Dec 19, 2025
Copilot AI requested a review from jgerits December 19, 2025 08:29
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.

Scenario call line remains purple (undefined) due to missing/failed expansion

2 participants