-
Notifications
You must be signed in to change notification settings - Fork 821
Add snippet stop at the end #1934
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
base: main
Are you sure you want to change the base?
Add snippet stop at the end #1934
Conversation
for more information, see https://pre-commit.ci
# $value or ${value} or ${value:default} | ||
return re.search(rf"\${variable_name}|\${{{variable_name}.*}}", body) is not None | ||
return rf"\${variable_name}|\${{{variable_name}.*?}}" |
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.
Please add a comment why we need the ? a the end
Please test what happens if you don't have a $zero stop |
Feed back from the session. Instead of having a fixed replacement name we should find the highest numerical value and pick something that's larger than that. We should probably unit test this |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Add a snippet stop at the end of every snippet that does not already have one there to allow exiting the snippet with "snip next".
I replaced .* with .*? in the regular expression to match the smallest possible match to better handle multiple instances of the same snippet stop with default values.
Someone should probably test this other than me as breaking snippets would not be fun.