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

Added behat arg detection, added related test #228

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MolbioUnige
Copy link

The test file contains valid Behat inputs.
Detected arguments are turned into regex.

🤔 What's changed?

I have changed how phpLanguage parses step definition in context files. Behat allows to define arguments in the definition that will be passed as function parameters, see Behat doc.

I have added a test file with various valid Behat definitions and there corresponding output after parsing.

I've tested my changes in vim. I can see that the lsp detects step definitions that contains argument, which it didn't before, see corresponding screenshots in annexes . The step suggestions are also working better but not perfectly, see corresponding screenshots in annexes

⚡️ What's your motivation?

The current implementation only detects corresponding strings, that is, arguments (:arg) are not considered as variable but treated literally. That is, in my opinion, useless. Same goes for step suggestions.

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

LSP suggestions only detects step definitions on the first typed character. Adding a second one, the suggestions are gone, see corresponding screenshots.

📋 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.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

Annexes

Diagnostics

Done with the same files

Before
before_diagnostics

After
after_diagnostics

Suggestions

Before
before_suggestions

After
after_suggestions

Suggestions fails if more then one character is typed

One character typed
one_char_suggestions

Adding a second one
two_char_suggestions


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

The test file contains valid Behat inputs.
Detected arguments are turned into regex.
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.

3 participants