Skip to content

Instantly share code, notes, and snippets.

@gsporto
Forked from henryhamon/cacheobjectscript.json
Last active October 21, 2019 13:23
Show Gist options
  • Save gsporto/8143a3372154d424d7b43a95d1f3fdf1 to your computer and use it in GitHub Desktop.
Save gsporto/8143a3372154d424d7b43a95d1f3fdf1 to your computer and use it in GitHub Desktop.
vscode cos snippets
{
"CreateClass": {
"prefix": "cc",
"body": [
"Class ${TM_DIRECTORY/.*src[\\/\\\\](([^\\/\\\\]*)([\\/\\\\])?)|([\\/\\\\])([^\\/\\\\]*)/$2${3:+.}${5:+.}$5/g}.${TM_FILENAME_BASE} Extends ${1|%Persistent,Ens.BusinessOperation,Ens.Request,%SOAP.WebClient|} ",
"{",
"\t${2:/*Remember to do TDD Leopoldo*/}",
"}"
],
"description": "Create an auto-named class"
},
"ClassName": {
"prefix": "cn",
"body": [
"${TM_DIRECTORY/.*src[\\/\\\\](([^\\/\\\\]*)([\\/\\\\])?)|([\\/\\\\])([^\\/\\\\]*)/$2${3:+.}${5:+.}$5/g}.${TM_FILENAME_BASE}"
],
"description": "Load the class name"
},
"$$$ThrowOnError": {
"prefix": "toe",
"body": "$$$$THROWONERROR(tSC, ${1:/*You Better be right*/})",
"description": "Throw On Error Macro"
},
"$TryCatch": {
"prefix": "try",
"body": [
"Set tSC = $$$$OK",
"Try {",
"\t${1:/*I have a bad feeling about this.*/}",
"} Catch tException {",
"\tSet:$$$$ISOK(tSC) tSC = tException.AsStatus()",
"}",
"Quit tSC"
],
"description": "Try Catch"
},
"##class": {
"prefix": "cls",
"body": "##class(${1:/*Where??*/}).${2:/*I.dont.know*/}",
"description": "Caché Class"
},
"#open": {
"prefix": "open",
"body": [
"##class(${1:/*Where??*/}).%OpenId(${2:/*Id*/},${3:/*🎵Remember 0 for read, 4 to write🎵*/},.tSC)",
"Throw:$$$ISERR(tSC)"
],
"description": "Caché Open Class"
},
"#new": {
"prefix": "new",
"body": "##class(${1:/*Where??*/}).%New()",
"description": "Caché New Class"
},
"%OnNew": {
"prefix": "onnew",
"body": [
"Method %OnNew() As %Status [ Private, ServerOnly = 1 ]",
"{",
"Set tSC = $$$$OK",
"Try {",
"\t${1:/*I have a bad feeling about this.*/}",
"} Catch tException {",
"\tSet:$$$$ISOK(tSC) tSC = tException.AsStatus()",
"}",
"\tQuit tSC",
"}"
],
"description": "OnNew"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment