Skip to content

Commit 9fa08b6

Browse files
committed
feat: add language snippets for several atomic classes
Snippet support for: `Box`, `Vector`, `Color`, `Area`, `ContentFile`, `GlobalScript` and `Exit` classes.
1 parent 473b06b commit 9fa08b6

File tree

3 files changed

+93
-0
lines changed

3 files changed

+93
-0
lines changed

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@
7575
"scopeName": "source.ccini",
7676
"path": "dist/packages/syntaxes/ccini.tmLanguage.json"
7777
}
78+
],
79+
"snippets": [
80+
{
81+
"language": "ccini",
82+
"path": "dist/packages/syntaxes/snippets.json"
83+
}
7884
]
7985
},
8086
"devDependencies": {

packages/syntaxes/project.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"commands": [
1111
"npx mkdirp \"dist/packages/syntaxes\"",
1212
"npx js-yaml packages/syntaxes/src/ccini.tmLanguage.yaml > dist/packages/syntaxes/ccini.tmLanguage.json",
13+
"cp packages/syntaxes/src/snippets.jsonc dist/packages/syntaxes/snippets.json",
1314
"cp packages/syntaxes/src/language-configuration.json dist/packages/syntaxes/language-configuration.json"
1415
],
1516
"outputPath": "dist/packages/syntaxes"

packages/syntaxes/src/snippets.jsonc

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
// Place your snippets for ccini here. Each snippet is defined under a snippet name and has a prefix, body and
3+
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
4+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
5+
// same ids are connected.
6+
// Example:
7+
// "Print to console": {
8+
// "prefix": "log",
9+
// "body": [
10+
// "console.log('$1');",
11+
// "$2"
12+
// ],
13+
// "description": "Log output to console"
14+
// }
15+
16+
"Vector": {
17+
"prefix": "Vector",
18+
"body": ["Vector", "\tX = ${1:0}", "\tY = ${2:0}", "$0"]
19+
},
20+
21+
"ContentFile": {
22+
"prefix": "ContentFile",
23+
"body": ["ContentFile", "\tFilePath = $1", "$0"]
24+
},
25+
26+
"Color": {
27+
"prefix": "Color",
28+
"body": ["Color", "\tR = ${1:0}", "\tG = ${2:0}", "\tB = ${3:0}", "$0"]
29+
},
30+
31+
"Box": {
32+
"prefix": "Box",
33+
"body": [
34+
"Box",
35+
"\tCorner = Vector",
36+
"\t\tX = ${1:0}",
37+
"\t\tY = ${2:0}",
38+
"\tWidth = ${3:0}",
39+
"\tHeight = ${4:0}",
40+
"$0"
41+
]
42+
},
43+
44+
"Area": {
45+
"prefix": "Area",
46+
"body": [
47+
"Area",
48+
"\tName = $1",
49+
"\tAddBox = Box",
50+
"\t\tCorner = Vector",
51+
"\t\t\tX = ${2:0}",
52+
"\t\t\tY = ${3:0}",
53+
"\t\tWidth = ${4:0}",
54+
"\t\tHeight = ${5:0}",
55+
"$0"
56+
]
57+
},
58+
59+
"GlobalScript": {
60+
"prefix": "GlobalScript",
61+
"body": [
62+
"GlobalScript",
63+
"\tPresetName = ${1}",
64+
"\tDescription = ${2}",
65+
"\tScriptPath = ${3}",
66+
"\tLuaClassName = ${4}",
67+
"$0"
68+
]
69+
},
70+
71+
"Exit": {
72+
"prefix": "Exit",
73+
"body": [
74+
"Exit",
75+
"\tOffset = Vector",
76+
"\t\tX = ${2:0}",
77+
"\t\tY = ${3:0}",
78+
"\tVelocity = Vector",
79+
"\t\tX = ${2:0}",
80+
"\t\tY = ${3:0}",
81+
"\tRadius = ${4:10}",
82+
"\tRange = ${5:35}",
83+
"$0"
84+
]
85+
}
86+
}

0 commit comments

Comments
 (0)