Skip to content

snippets #191

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

Merged
merged 1 commit into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@
{
"language": "objectscript-class",
"path": "./snippets/objectscript-class.json"
},
{
"language": "objectscript",
"path": "./snippets/objectscript.json"
}
],
"commands": [
Expand Down
83 changes: 82 additions & 1 deletion snippets/objectscript-class.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,86 @@
"Index": {
"prefix": "Index",
"body": "Index $1 On ${2:Name};"
}
},
"Unique Index": {
"prefix": "Index",
"body": "Index $1 On ${2:property} [Unique];",
"description": "Unique Index"
},
"Query": {
"prefix":["Query"],
"body":["Query $1($2) As %SQLQuery [ SqlProc ]","{","\t$3","}"],
"description": "Based on SQL statement"
},
"Trigger": {
"prefix": "Trigger",
"body": [
"Trigger $1 [Event=${2|INSERT,UPDATE,DELETE|}, Time=${3|BEFORE,AFTER|}, Foreach=${4|row/object,row,statement|}]",
"{",
"\t$5",
"}"
],
"description": "Trigger"
},
"ForeignKey": {
"prefix": "Foreignkey",
"body": "ForeignKey $1 (${2:property}) References ${3:referencedClass}(${4:refIndex});",
"description": "ForeignKey"
},
"Relationship": {
"prefix": ["Relationship"],
"body": "Relationship $1 As ${2:classname} [ Cardinality = ${3|one,many,parent,children|}, Inverse = ${4:correspondingProperty} ];",
"description": "Relationship"
},
"BusinessService": {
"prefix": ["BusinessService","Interoperability"],
"body": ["Class ${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}.$TM_FILENAME_BASE} Extends Ens.BusinessService",
"{\n",
"Property Adapter As ${2:Ens.InboundAdapter};\n",
"Parameter ADAPTER = \"${2:Ens.InboundAdapter}\";\n",
"Method OnProcessInput(pInput As %RegisteredObject, pOutput As %RegisteredObject) As %Status",
"{",
"\t$3",
"\tReturn \\$\\$\\$ERROR(\\$\\$\\$NotImplemented)",
"}",
"}"],
"description": "Business Service Definition"
},
"BusinessOperation": {
"prefix":["BusinessOperation","Interoperability"],
"body": ["Class ${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}.$TM_FILENAME_BASE} Extends Ens.BusinessOperation",
"{\n",
"Property Adapter As ${2:Ens.OutboundAdapter};\n",
"Parameter ADAPTER = \"${2:Ens.OutboundAdapter}\";\n",
"Parameter INVOCATION = \"Queue\";\n",
"Method SampleCall(pRequest As ${3:Ens.Request}, Output pResponse As ${4:Ens.Response} ) As %Status",
"{",
"\t$5",
"\tReturn \\$\\$\\$ERROR(\\$\\$\\$NotImplemented)",
"}\n",
"XData MessageMap",
"{",
"<MapItems>",
"\t<MapItem MessageType=\"${3:Ens.Request}\">",
"\t\t<Method>SampleCall</Method>",
"\t</MapItem>",
"</MapItems>",
"}",
"}"],
"description": "Business Operation Definition"
},
"Production": {
"prefix": ["Production","Interoperability"],
"body": ["Class ${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}.$TM_FILENAME_BASE} Extends Ens.Production",
"{\n",
"XData ProductionDefinition",
"{",
"\t<Production Name=\"${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}.$TM_FILENAME_BASE}\">",
"\t\t<ActorPoolSize>2</ActorPoolSize>",
"\t\t<Item ClassName=\"$2\" Name=\"$3\" PoolSize=\"1\"/>",
"\t</Production>",
"}",
"}"],
"description": "Production Definition"
}
}
24 changes: 24 additions & 0 deletions snippets/objectscript.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"ForOrder": {
"prefix": ["For"],
"body": [
"Set ${1:key} = \"\"",
"For {",
"\tSet ${1:key} = \\$ORDER(${2:array}(${1:key}))",
"\tQuit:${1:key}=\"\"",
"\t$3 // process ${2:array}(${1:key})",
"}"
],
"description": "Looping Array with $Order"
},
"SQL Statement": {
"prefix": ["sql"],
"body": [
"Set rs = ##class(%SQL.Statement).%ExecDirect(,\"SELECT * FROM\")",
"While rs.%Next() {",
"\twrite rs.ID, !",
"}"],
"description": "Prepare and execute SQL Query"
}

}