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

Add support for Python (Behave) #49

Closed
aslakhellesoy opened this issue May 23, 2022 · 10 comments · Fixed by #69
Closed

Add support for Python (Behave) #49

aslakhellesoy opened this issue May 23, 2022 · 10 comments · Fixed by #69

Comments

@aslakhellesoy
Copy link
Contributor

See CONTRIBUTING.md for details.

@mrkaiser
Copy link
Contributor

Hi! I am actively working on this.

@aslakhellesoy
Copy link
Contributor Author

Excellent! Shout out if you need help.

@aslakhellesoy
Copy link
Contributor Author

How is ot going @mrkaiser? Anything I can do to help?

@mrkaiser
Copy link
Contributor

mrkaiser commented Jun 7, 2022

Hi!

I have gotten the tests passing. I'm currently cleaning up my implementation and doing testing to make sure the experience actually works. I'm also working on updating some of the documentation since there were some call outs that I figured out after the fact (one example: There are specific aliases to use for the expressions in the the tree sitter queries. I chose my own and things did not work ) that I think would be helpful for future implementers.

Thanks

@aslakhellesoy
Copy link
Contributor Author

Thanks - looking forward to seeing it! And thanks for helping out with the contributor guide too.

@mrkaiser
Copy link
Contributor

mrkaiser commented Jun 10, 2022

Hi,

Testing is going to take more time than originally anticipated. Currently autocomplete and go to definition is not working and I'm not sure why and I'm about to go on vacation next week.

@aslakhellesoy Do you have any thoughts as to where to look? All the tests are currently passing in the language-service. I have the correct capturing nodes and some steps are not underlined. I don't have any logs since the contributing guidelines say to run without debugging.

Thanks!

@aslakhellesoy
Copy link
Contributor Author

Hi @mrkaiser if you submit a draft pull request I can take a look.

Logs are still available in non-debug mode. All the debug mode gives you is ability to set breakpoints.

See https://github.com/cucumber/vscode/blob/main/CONTRIBUTING.md#console-output for details.

mrkaiser added a commit to mrkaiser/language-service that referenced this issue Jun 12, 2022
This attempts to solve cucumberGH-49. It adds python support via `behave`
only. This is still a WIP. The tests pass but after building with
changes in `language-server` and `vscode`, functionality in real world
applications is severely diminished. Go To Definition and Autocomplete
are currently missing.
@mrkaiser
Copy link
Contributor

Hi @aslakhellesoy

After much debugging, I figured out what my initial issues were. They were not code related, but rather local build related (through some process I never got the appropriate WASM executable for python and thus tree-sitter could not parse the python files).

After manually copying the executable into the appropriate directory, the plugin did start working. I used a real world repo to verify and test functionality inside of vscode. Many step definitions worked as expected with auto-complete and go-to definition working as expected.

However many step definitions did not work. Here is one such example:

[Error - 9:51:21 PM] * Step Definition errors: This Cucumber Expression has a problem at column 36:

approximately \(~\) is defined as \+/- (?P<margin>\d+\.?\d*) (?P<units>{regex_of_approximate_parameters_units}) for (?P<parameter_name>{regex_of_approximate_parameters_names})
                                   ^
Only the characters '{', '}', '(', ')', '\', '/' and whitespace can be escaped.
If you did mean to use an '\' you can use '\\' to escape it

I believe this expression likely should use Parameter Types, however it is unclear after spending time looking at the behave documentation (i.e use_step_matcher) and the documentation for parameter types how to use them with each other.

A little stuck here and would like to find either workarounds on the repo side, or a way to support it within the IDE before calling the python work complete.

@aslakhellesoy
Copy link
Contributor Author

Behave does not support Cucumber Expressions or parameter types. See behave/behave#968.

The error you are seeing is from the JavaScript Cucumber Expressions library.
It's failing to parse a Regular Expression as a Cucumber Expression.
This is to be expected, they are two different languages, with different syntax and grammar.

I have left another review on #69 with some more details.

@mrkaiser
Copy link
Contributor

I made further updates on #69. It should be ready for merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants