cucumber / language-service

Cucumber Language Service
MIT License
12 stars 21 forks source link

Fix/tree sitter parsing expression failure #186

Open helgardferreira opened 2 months ago

helgardferreira commented 2 months ago

πŸ€” What's changed?

A helper function stripBlacklistedExpressions to help with tree-sitter's parsing in certain edge cases where parsing is currently erroneous.

⚑️ What's your motivation?

We're currently using playwright-bdd so that we can use playwright as our test runner and cucumber for BDD. Unfortunately, the language server is currently not working for the decorator syntax for playwright-bdd which can be found here.

The reason for this seems to be that the version of tree-sitter that is used by @cucumber/language-service is unable to parse TypeScript files that contain decorators for classes. This PR is an interim fix for that until either tree-sitter addresses the issue (if the issue is on their behalf - I'm not sure) or until @cucumber/language-service changes the tree-sitter parsing to work as expected.

🏷️ What kind of change is this?

♻️ Anything particular you want feedback on?

πŸ“‹ Checklist:


This text was originally generated from a template, then edited by hand. You can modify the template here.

barrymichaeldoyle commented 1 month ago

Is anyone going to review this? As it stands right now Helgard's unofficial cucumber extension on VSCode marketplace is the only one that works for our project.

kieran-ryan commented 1 month ago

@helgardferreira, the here link appears to be broken. Would you be able to provide an updated link or according example?

helgardferreira commented 1 month ago

@kieran-ryan Oh sorry, I think the docs might have gotten updated. I've updated the link which can be found here: https://vitalets.github.io/playwright-bdd/#/writing-steps/decorators

kieran-ryan commented 1 month ago

@kieran-ryan Oh sorry, I think the docs might have gotten updated. I've updated the link which can be found here: https://vitalets.github.io/playwright-bdd/#/writing-steps/decorators

Cheers, those examples appear to work for me; is there perhaps a variation of other code combined with these decorators that's causing the issue; if any examples? Would be great to get the different cases added to the unit tests as a test data source.

image

helgardferreira commented 1 month ago

I can definitely make examples. The current specific issue we're running into is in a proprietary codebase but I'll create an environment to demonstrate the issue πŸ™‚