Skip to content

Instantly share code, notes, and snippets.

@erayerdin
Last active January 17, 2020 14:44
Show Gist options
  • Save erayerdin/31ea4d8df937b387f946f331246150b1 to your computer and use it in GitHub Desktop.
Save erayerdin/31ea4d8df937b387f946f331246150b1 to your computer and use it in GitHub Desktop.
Rust VSCode Snippets
{
// Place your snippets for rust here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Log": {
"prefix": "log",
"body": [
"${1:debug}!(\"$2\");"
],
"description": "Print some logs."
},
"Trace Log": {
"prefix": "trace",
"body": ["trace!(\"$1: {}\", $2);"],
"description": "To trace a variable."
},
"Use": {
"prefix": "use",
"body": ["use $1;"],
"description": "Use."
},
"Use Super": {
"prefix": "use super",
"body": ["use super::*;"],
"description": "Uses all uses in super."
},
"Mod": {
"prefix": "mod",
"body": ["mod ${1:test} {$2}"],
"description": "Creates a module."
},
"Option": {
"prefix": "option",
"body": ["Option<$1>"],
},
"Result": {
"prefix": "result",
"body": ["Result<$1, $2>"],
},
"Ok": {
"prefix": "ok",
"body": "Ok($1)"
},
"Err": {
"prefix": "err",
"body": "Err($1)"
},
"Some": {
"prefix": "some",
"body": "Some($1)"
},
"None": {
"prefix": "none",
"body": "None"
}
}
@erayerdin
Copy link
Author

It seems broken because JSON normally does not allow comments, yet VSCode parses comments as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment