Skip to content

Instantly share code, notes, and snippets.

@wtokuno
Last active August 2, 2023 16:28
Show Gist options
  • Save wtokuno/a51dd19f723bc1f0108bed3bd3f0e3df to your computer and use it in GitHub Desktop.
Save wtokuno/a51dd19f723bc1f0108bed3bd3f0e3df to your computer and use it in GitHub Desktop.
{
"Include Guard": {
"scope": "c,cpp",
"isFileTemplate": true,
"prefix": [
"include-guard",
"#ifndef"
],
"body": [
"#ifndef ${WORKSPACE_NAME/(.*)/${1:/upcase}/}_${RELATIVE_FILEPATH/(?:^src[\\/\\\\])?(\\w+)(\\W*)/${1:/upcase}${2:+_}/g}_",
"#define ${WORKSPACE_NAME/(.*)/${1:/upcase}/}_${RELATIVE_FILEPATH/(?:^src[\\/\\\\])?(\\w+)(\\W*)/${1:/upcase}${2:+_}/g}_",
"",
"$0",
"",
"#endif /* !${WORKSPACE_NAME/(.*)/${1:/upcase}/}_${RELATIVE_FILEPATH/(?:^src[\\/\\\\])?(\\w+)(\\W*)/${1:/upcase}${2:+_}/g}_ */"
],
"description": "Code snippet for include guard"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment