Find Ruby step definitions when defined by a step() method#297
Open
henrahmagix wants to merge 1 commit into
Open
Find Ruby step definitions when defined by a step() method#297henrahmagix wants to merge 1 commit into
step() method#297henrahmagix wants to merge 1 commit into
Conversation
Turnip defines steps with the method `step`, it doesn't (currently) support Given/When/Then/etc. Also those method names aren't Ruby-like because they start with a capital letter, so even aliasing them doesn't _feel_ great, though it is a workaround. It'd be lovely if the Cucumber language service could find these `step '...' do; end` definitions =)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Turnip defines steps with the method
step, it doesn't (currently) support Given/When/Then/etc. Also those method names aren't Ruby-like because they start with a capital letter, so even aliasing them doesn't feel great, though it is a workaround.It'd be lovely if the Cucumber language service could find these
step '...' do; enddefinitions =)🤔 What's changed?
stephas been added to the list of method names matched by thedefineStepDefinitionQueriesin the Ruby language.⚡️ What's your motivation?
This allows the Cucumber LSP to find step definitions in a repo using https://github.com/jnicklas/turnip, e.g.
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
It'd be lovely if this expression could be passed in by configuration, so we can easily match our own definitions in our own usages☺️
📋 Checklist:
Sorry, I just made this through GitHub's fork-and-edit. Is it worth adding to the tests, when it's an addition of a method name to a regexp? Also I'm not sure if this should be documented.
I'm happy to do all that if it's necessary; so far this is fixing just my own situation, I don't know how prevalent VS Code + Cucumber extension + Ruby repo + Turnip gem usage is, and therefore how important it is to document this.
Perhaps I could work on a refactor to get this pattern into configuration, if y'all would accept that? That would definitely be important to document and test. Might be a bit of work to acquaint myself with the language-service repo and the language-server repo, like which provides configuration and how it gets passed through, and how to provide the current pattern as a default from the vscode repo =)
Thanks in advance, snance,
Henry