language-service icon indicating copy to clipboard operation
language-service copied to clipboard

Added behat arg detection, added related test

Open MolbioUnige opened this issue 1 year ago • 0 comments

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?

  • :zap: 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:

  • [x] I agree to respect and uphold the Cucumber Community Code of Conduct
  • [x] I've changed the behaviour of the code
    • [x] I have added/updated tests to cover my changes.
  • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
  • [x] 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.

MolbioUnige avatar Jul 18 '24 08:07 MolbioUnige