-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
An initial go at Python Support #69
An initial go at Python Support #69
Conversation
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.
@@ -31,14 +32,17 @@ If your contribution is to add support for a new programming language, follow th | |||
6. Add the name of the new language to the `LanguageName` type | |||
7. Update `languageByName` in `src/language/language.ts` | |||
8. Update `src/tree-sitter-node/NodeParserAdapter.ts` | |||
9. Run tests | |||
9. Update `test/language/ExpressionBuilder.test.ts` to include the new language if it supports Cucumber Expressions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work @mrkaiser! I'm impressed how you've managed to navigate the codebase - everything looks very good.
I like to do a manual test within VSCode (as explained here: https://github.com/cucumber/language-service/blob/main/CONTRIBUTING.md#manual-testing)
Do you know of an online repo that would have some behave code (with custom parameter types) I could use as a test subject?
In hindsight, I should've made this a draft. |
@aslakhellesoy I am currently working on the PR comments. Something has broken the tests. I am going on a much needed vacation. I will pick this back up next week. I appreciate the understanding. |
* Update CONTRIBUTING.md to include snippet information * Fixed package.json * Reordered languages to alphabetical order * Fixed indentation on tree-sitter queries * Cleaned up python includes (.python-version and .mypy in .gitignore)
Hi @aslakhellesoy , while working on the updates to the PR and trying to test vscode, I noticed that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you have been working with the assumption that Cucumber Expressions (and Parameter Types) are supported by Behave. Unfortunately they are not.
Someone has ported the Cucumber Expressions library to Python, but nobody has yet integrated it into Behave.
Until that happens I think it's best if we assume all Behave step definitions use regular expressions.
I'm sorry I didn't catch this before - it would probably have saved you some time.
As discussed - here is how Cucumber Expressions for Java decides whether an expression string should be interpreted as CukeExp or RegExp: https://github.com/cucumber/cucumber-expressions/blob/main/java/src/main/java/io/cucumber/cucumberexpressions/ExpressionFactory.java |
Removed and Reverted ParameterType support. Added basic checks for regexes to support _some_ level of "cucumber expression" support (i.e only plain text) to get some go to definitions working Added a better blurb.
Not sure why there are conflict with |
@aslakhellesoy As discussed I have migrated to only regexp. In some instances I choose to just return the string. This works well in practice because "plain ol" strings are also always valid Cucumber Expressions. I do basic checks. This allows some level of go to definition functionality. I have tested with my changes in the Thanks |
Hi @mrkaiser, Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾 In return for this generous offer we hope you will:
On behalf of the Cucumber core team, |
Hi @mrkaiser , I will reach out to you on the cucumber Slack... ping |
This attempts to solve GH-49. It adds python support via
behave
only. This is still a WIP. The tests pass but after building with
changes in
language-server
andvscode
, functionality in real worldapplications is severely diminished. Go To Definition and Autocomplete
are currently missing.
🤔 What's changed?
There is python support via the
behave
library⚡️ What's your motivation?
Fixes #49
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
The tests currently pass. Functionality in an editor (testing with vscode) is however extremely broken, providing no go to definition or autocomplete.
📋 Checklist:
This text was originally generated from a template, then edited by hand. You can modify the template here.