lekemula / solargraph-rspec

Solargraph plugin supporting RSpec code completion
MIT License
35 stars 1 forks source link

Support for rspec-given? #5

Closed mskog closed 2 months ago

mskog commented 3 months ago

Our team uses the rspec-given gem as originally created by Jim Weirich: https://github.com/jimweirich/rspec-given

Now maintained here: https://github.com/rspec-given/rspec-given

Essentially all we need to do to get this working is to add "Then" and "And" keywords to work as example methods. Or allow keyword example method definition as well like the "let_methods" configuration option perhaps.

Is this something that you would accept in this project? I can add it myself if you want!

lekemula commented 3 months ago

Hey @mskog thanks for the suggestion! This is the first time I have seen this gem but looks interesting.

Definitely, I'm looking forward to adding support for RSpec 3rd party plugins as much as possible in the future, and I think rspec-given gem would also be a good fit here.

Or allow keyword example method definition as well like the "let_methods" configuration option perhaps.

I like this idea, as this would make it extensible for other customizations too. I'm pretty sure there are others out there adding custom example methods in their project so this would be very beneficial.

As this is a very "good first issue" and you seem already interested in it and came up with a great idea, feel free to give it a try! To give you some hints, this is the test that you probably will need to fiddle with:

https://github.com/lekemula/solargraph-rspec/blob/c86ff344daba1dd8d70432f8ee4e174b954a8139/spec/solargraph/rspec/convention_spec.rb#L559-L606

and here's how the current let_methods configuration comes into play:

https://github.com/lekemula/solargraph-rspec/blob/c86ff344daba1dd8d70432f8ee4e174b954a8139/lib/solargraph/rspec/spec_walker/node_types.rb#L36

I believe we would need something similar here:

https://github.com/lekemula/solargraph-rspec/blob/c86ff344daba1dd8d70432f8ee4e174b954a8139/lib/solargraph/rspec/spec_walker/node_types.rb#L29

Let me know if you face any hurdles!

PS. Please assign this issue yourself if you decide to work on it, and unassign it if you can't find enough time.

mskog commented 3 months ago

I don't think that I have permission to assign issues, but I've added a PR in https://github.com/lekemula/solargraph-rspec/pull/6