-
Notifications
You must be signed in to change notification settings - Fork 522
zig: add snippets #563
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?
zig: add snippets #563
Conversation
add snippets for: if statement error handling while loop while loop with continue expression for loop for loop with index function switch enum enum with type specification struct struct with defaults
add: - page allocator - fixed buffer allocator - debug allocator
snippets/zig.json
Outdated
"struct": { | ||
"prefix": "struct", | ||
"body": [ | ||
"const ${1:Name} = struct { ${2:named_field}: ${3:field_type} };" | ||
], | ||
"description": "struct" | ||
}, | ||
"struct w/ defaults": { | ||
"prefix": "structd", | ||
"body": [ | ||
"const ${1:Name} = struct { ${2:named_field}: ${3:field_type} = ${4:default_value} };" | ||
], | ||
"description": "struct with defaults" | ||
}, |
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.
These two snippets can be a single snippet by making the body have the final cursor move end here:
"const ${1:Name} = struct { ${2:named_field}: ${3:field_type} ${0:default_or_end}};"
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.
Wouldn't that leave the last =
missing?
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.
Maybe =
could be incorporated like ${0: = default_or_end}
? What do you think @OkelleyDevelopment ?
add snippets for: