-
Notifications
You must be signed in to change notification settings - Fork 79
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
Fix puretext and add option FavoriteQuoteChar (for string snippet) #474
Conversation
Bumps [debug](https://github.com/debug-js/debug) to 4.3.4 and updates ancestor dependency [mocha](https://github.com/mochajs/mocha). These dependencies need to be updated together. Updates `debug` from 2.6.8 to 4.3.4 - [Release notes](https://github.com/debug-js/debug/releases) - [Commits](debug-js/debug@2.6.8...4.3.4) Updates `mocha` from 3.5.3 to 10.2.0 - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](mochajs/mocha@v3.5.3...v10.2.0) --- updated-dependencies: - dependency-name: debug dependency-type: indirect - dependency-name: mocha dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com>
also fix when smartSnippets is set to false
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.
The code looks great. I have some doubts around needing to add a new cucumberautocomplete setting to provide this functionality, rather than having it as something that runs in the background.
@@ -359,7 +358,12 @@ export default class StepsHandler { | |||
//We can replace some outputs, ex. strings in brackets to make insert strings more neat | |||
res = res.replace(/\"\[\^\"\]\+\"/g, '""'); |
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.
In other areas of the code, we are returning double quotes without some conditional logic to return double or single quotes.
Do we want to introduce a new cucumberautocomplete setting to give the user the option of double/single quotes or do we just want to return double quotes every time with no additional cucumberautocomplete setting?
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's fine to not have this option. My concerne was to not change current habits of users if they want to
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.
Is there some use case for the following scenarios:
![image](https://private-user-images.githubusercontent.com/138122895/280670556-3dc47cfd-ff81-4f75-bab8-a83b98a616fd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExOTkyOTcsIm5iZiI6MTcyMTE5ODk5NywicGF0aCI6Ii8xMzgxMjI4OTUvMjgwNjcwNTU2LTNkYzQ3Y2ZkLWZmODEtNGY3NS1iYWI4LWE4M2I5OGE2MTZmZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxN1QwNjQ5NTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03YjYxYzdmYTRiOTY5Y2MzZWU0ODU3Mzc3OGFmYmEzZWVhYTJhYTY1YmZjMzgxMjdmMWMwMTcyODVmODk1YmU3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.yGWKbfkujolTuSWLGyKCKEZfM6KU_q27cJFc4CUQKLk)
This always seemed like a bug to me rather than desirable functionality.
I guess it lets the user know that they can use double or single quotes but maybe this could be highlighted in the documentation rather than every time a string is autocompleted.
Happy to discuss this further as, like you say, we don't want to change current user habits if they are actually benefitting from the current implementation.
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.
This always seemed like a bug to me rather than desirable functionality.
Same for me.
Can we just generate When I click the ""
?
@@ -130,6 +130,8 @@ By default, all the `' ' "` symbols will be used do define start and the end of | |||
**`cucumberautocomplete.pureTextSteps`** - Some frameworks using gherkin steps as a text with just support for the cucumber expression instead of RegExp. This differs from the default extension behaviour, example: | |||
`When('I give 5$ and * items')` step would be handled as `/I give 5$ and * items/` RegExp without this option enabled and as `/^I give 5\$ and \* items$/` RegExp with it (`^` and `$` symbols were added to the reg ex and also all the special regex symbols were handled as regular text symbols). | |||
|
|||
**`favoriteQuoteChar`** - could be `'` or `"`. Quote char used during auto-completion of `{string}` parameters. It provides a better typing experience with smartSnippets. |
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.
Does favoriteQuoteChar have a dependency on smartSnippets? Or does it just complement smartSnippets?
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 work without smartSnippets set to true
if smartSnippets is set to false it produces "[^"]*"
if smartSnippets is set to true it produces "${1:}"
|
||
|
||
const favQuote = this.settings.cucumberautocomplete.favoriteQuoteChar; | ||
if (favQuote){ |
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.
If you don't provide the favoriteQuoteChar setting, is it set to "\""
by default, or is it set to null?
Isn't this functionality the type that the entire user base could benefit from? Rather than users having to update their cucumberautocomplete settings before they can benefit from it?
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 is set to null.
and produces usual output : ("|')${1:}\1
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.
oh sorry by default favoriteQuoteChar is set to """
I think it's time to suppress this option so
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.
If we remove this setting then this if statement is redundant, yes!
@RealByron do you have the capacity to make the changes above? If not, I can maybe extend your PR but it will need to be re-reviewed. |
:( |
better for this complain
#470
and allow cucumber parameter in pureTextStep