Added behat arg detection, added related test #228
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?
♻️ 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:
Annexes
Diagnostics
Done with the same files
Before
After
Suggestions
Before
After
Suggestions fails if more then one character is typed
One character typed
Adding a second one
This text was originally generated from a template, then edited by hand. You can modify the template here.