Skip to content

Commit 47b4b9c

Browse files
authored
Merge pull request #191 from nsolov/master
snippets
2 parents 5f1fdeb + aef1db1 commit 47b4b9c

File tree

3 files changed

+110
-1
lines changed

3 files changed

+110
-1
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@
348348
{
349349
"language": "objectscript-class",
350350
"path": "./snippets/objectscript-class.json"
351+
},
352+
{
353+
"language": "objectscript",
354+
"path": "./snippets/objectscript.json"
351355
}
352356
],
353357
"commands": [

snippets/objectscript-class.json

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,86 @@
2626
"Index": {
2727
"prefix": "Index",
2828
"body": "Index $1 On ${2:Name};"
29-
}
29+
},
30+
"Unique Index": {
31+
"prefix": "Index",
32+
"body": "Index $1 On ${2:property} [Unique];",
33+
"description": "Unique Index"
34+
},
35+
"Query": {
36+
"prefix":["Query"],
37+
"body":["Query $1($2) As %SQLQuery [ SqlProc ]","{","\t$3","}"],
38+
"description": "Based on SQL statement"
39+
},
40+
"Trigger": {
41+
"prefix": "Trigger",
42+
"body": [
43+
"Trigger $1 [Event=${2|INSERT,UPDATE,DELETE|}, Time=${3|BEFORE,AFTER|}, Foreach=${4|row/object,row,statement|}]",
44+
"{",
45+
"\t$5",
46+
"}"
47+
],
48+
"description": "Trigger"
49+
},
50+
"ForeignKey": {
51+
"prefix": "Foreignkey",
52+
"body": "ForeignKey $1 (${2:property}) References ${3:referencedClass}(${4:refIndex});",
53+
"description": "ForeignKey"
54+
},
55+
"Relationship": {
56+
"prefix": ["Relationship"],
57+
"body": "Relationship $1 As ${2:classname} [ Cardinality = ${3|one,many,parent,children|}, Inverse = ${4:correspondingProperty} ];",
58+
"description": "Relationship"
59+
},
60+
"BusinessService": {
61+
"prefix": ["BusinessService","Interoperability"],
62+
"body": ["Class ${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}.$TM_FILENAME_BASE} Extends Ens.BusinessService",
63+
"{\n",
64+
"Property Adapter As ${2:Ens.InboundAdapter};\n",
65+
"Parameter ADAPTER = \"${2:Ens.InboundAdapter}\";\n",
66+
"Method OnProcessInput(pInput As %RegisteredObject, pOutput As %RegisteredObject) As %Status",
67+
"{",
68+
"\t$3",
69+
"\tReturn \\$\\$\\$ERROR(\\$\\$\\$NotImplemented)",
70+
"}",
71+
"}"],
72+
"description": "Business Service Definition"
73+
},
74+
"BusinessOperation": {
75+
"prefix":["BusinessOperation","Interoperability"],
76+
"body": ["Class ${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}.$TM_FILENAME_BASE} Extends Ens.BusinessOperation",
77+
"{\n",
78+
"Property Adapter As ${2:Ens.OutboundAdapter};\n",
79+
"Parameter ADAPTER = \"${2:Ens.OutboundAdapter}\";\n",
80+
"Parameter INVOCATION = \"Queue\";\n",
81+
"Method SampleCall(pRequest As ${3:Ens.Request}, Output pResponse As ${4:Ens.Response} ) As %Status",
82+
"{",
83+
"\t$5",
84+
"\tReturn \\$\\$\\$ERROR(\\$\\$\\$NotImplemented)",
85+
"}\n",
86+
"XData MessageMap",
87+
"{",
88+
"<MapItems>",
89+
"\t<MapItem MessageType=\"${3:Ens.Request}\">",
90+
"\t\t<Method>SampleCall</Method>",
91+
"\t</MapItem>",
92+
"</MapItems>",
93+
"}",
94+
"}"],
95+
"description": "Business Operation Definition"
96+
},
97+
"Production": {
98+
"prefix": ["Production","Interoperability"],
99+
"body": ["Class ${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}.$TM_FILENAME_BASE} Extends Ens.Production",
100+
"{\n",
101+
"XData ProductionDefinition",
102+
"{",
103+
"\t<Production Name=\"${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}.$TM_FILENAME_BASE}\">",
104+
"\t\t<ActorPoolSize>2</ActorPoolSize>",
105+
"\t\t<Item ClassName=\"$2\" Name=\"$3\" PoolSize=\"1\"/>",
106+
"\t</Production>",
107+
"}",
108+
"}"],
109+
"description": "Production Definition"
110+
}
30111
}

snippets/objectscript.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"ForOrder": {
3+
"prefix": ["For"],
4+
"body": [
5+
"Set ${1:key} = \"\"",
6+
"For {",
7+
"\tSet ${1:key} = \\$ORDER(${2:array}(${1:key}))",
8+
"\tQuit:${1:key}=\"\"",
9+
"\t$3 // process ${2:array}(${1:key})",
10+
"}"
11+
],
12+
"description": "Looping Array with $Order"
13+
},
14+
"SQL Statement": {
15+
"prefix": ["sql"],
16+
"body": [
17+
"Set rs = ##class(%SQL.Statement).%ExecDirect(,\"SELECT * FROM\")",
18+
"While rs.%Next() {",
19+
"\twrite rs.ID, !",
20+
"}"],
21+
"description": "Prepare and execute SQL Query"
22+
}
23+
24+
}

0 commit comments

Comments
 (0)