Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index failure with partial Python parameter match #196

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

kieran-ryan
Copy link
Sponsor Member

@kieran-ryan kieran-ryan commented Apr 1, 2024

🤔 What's changed?

  • Refined tree-sitter query for Python Parameter matches

⚡️ What's your motivation?

The Parameter Type tree-sitter query for Python allowed three optional keyword arguments, 1 for the name argument and 2 for the regular expressions argument in two different formats (string and concatenated-string).

This works fine with valid parameter type definitions using the keyword arguments in the order in which they are declared. However, the query fails in the following scenarios:

  • The keyword arguments order is in reverse order. This fails to detect the parameter type but does not prevent reading from that glue file or other glue files.
  • Any Python callable with either of name or regexp as keyword arguments yields a partial match (as the query specifies more arguments as optional), however the language service requires both and yields an unhandled exception as a result which prevents reading from all glue files entirely.

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@kieran-ryan kieran-ryan self-assigned this Apr 1, 2024
@kieran-ryan kieran-ryan added the 🐛 bug Defect / Bug label Apr 1, 2024
@kieran-ryan kieran-ryan marked this pull request as ready for review April 1, 2024 11:39
@kieran-ryan kieran-ryan changed the title Fix index failure with partial Python parameter match Index failure with partial Python parameter match Apr 1, 2024
@kieran-ryan kieran-ryan merged commit e716879 into main Apr 1, 2024
6 checks passed
@kieran-ryan kieran-ryan deleted the fix-partial-param-match branch April 1, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot index Python glue files containing 'name' keyword arguments
1 participant