alexkrechik / VSCucumberAutoComplete

Cucumber (Gherkin) Full Support Extension for VSCode
https://marketplace.visualstudio.com/items?itemName=alexkrechik.cucumberautocomplete
MIT License
331 stars 80 forks source link

fix: regex of word and string cucumber expressions #418

Closed olenitsj closed 2 years ago

olenitsj commented 2 years ago

Enchanced the implementation of cucumber expressions. Added support for {word} and updated the {string} implementation.

JornWildt commented 2 years ago

Nice :-)

But this one needs some attention as it does not allow single quotes in double quotes and vice versa - it will accept "xx' as well as 'xx" as strings and will fail on "This is a 'quoted' word":

step = step.replace(/{string}/g, '[\"|\'].*[\"|\']');

A better solution is this (which has parenthesis for fetching the content, which is most likely not useful here):

(?:"|')([^\1]*)(?:"|')

maybe this is better (I haven't tested it myself):

("|')[^\1]*\1

which uses the back-reference "\1" to say "everything but the character at the beginning - and ending with the same character as in the beginning".

olenitsj commented 2 years ago

@JornWildt Perhaps Thank you, nice!

I will check this out in the weekend.

tommarien commented 2 years ago

@olenitsj Any update on this?

olenitsj commented 2 years ago

@tommarien , @JornWildt

I have updated the PR with the implementation proposed by @JornWildt and it works as expected.

olenitsj commented 2 years ago

@alexkrechik any chance we could get this merged?

olenitsj commented 2 years ago

@alexkrechik Thank you for the feedback. I have processed it.

TechFounder commented 2 years ago

Hi @alexkrechik, any update on this change? When can we expect it to be merged? Thanks!

joshjm commented 2 years ago

This would be great to get merged. Not having support for single quotes is quite a hold up for my team, as we don't want to convert old tests to double quotes from single for the sake of an extension

TechFounder commented 2 years ago

@alexkrechik thanks for merging this! So what happens now? How long before this change is reflected in the VS Code extension? Is there a way to manually update it on our VS Code? Thanks again.

alexkrechik commented 2 years ago

@alexkrechik thanks for merging this! So what happens now? How long before this change is reflected in the VS Code extension? Is there a way to manually update it on our VS Code? Thanks again.

Sorry for the long response. I'll merge all the security PR's and create a new version.

JCTD commented 2 years ago

Hi @alexkrechik, the new version is still not reflected in the marketplace or on VS Code. Any ideas on why? Thanks.

alexkrechik commented 2 years ago

Unfortunately, I got some errors during the attempt to publish an extension - looks like the rules were a little bit changed after I did last publish.

TechFounder commented 2 years ago

@alexkrechik FYI, still not seeing the update yet. Thanks.

alexkrechik commented 2 years ago

Actually, I have problem like this:

Screenshot 2022-02-04 at 18 52 38

I'll work with support on it.

Also, looks like I should do extension bundling - this will solve one more potential problem. Planning to complete this next week.

TechFounder commented 2 years ago

Hi @alexkrechik, this merge still hasn't shown up on the marketplace yet. Do you know if the issues you experienced will be resolved soon? Thanks!