Skip to content
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

Field with Transformations is Sticky #1206

Open
axbycc-mark opened this issue Feb 1, 2025 · 0 comments
Open

Field with Transformations is Sticky #1206

axbycc-mark opened this issue Feb 1, 2025 · 0 comments

Comments

@axbycc-mark
Copy link

Consider this snippet.

# -*- mode: snippet -*-
# name: example
# key: example
# --

${1:variable} ${2:$$(unless yas-modified-p (format "++%s" (yas-field-value 1)))}
$0       

The default expansion is variable ++variable. The intended usage is in defining a c-style loop snippet. Usually when you first enter into a tab stop, typing x will remove the placeholder and replace it with x. However, on the second tab stop in this snippet, typing x will leave you with variable ++variablex instead of the more consistent variable x.

Hence, making a field value with a transform makes it "sticky" and it doesn't behave like other fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant