Skip to content

Commit 8a3e018

Browse files
committed
feat: introduces the WDL TextMate grammar and snippets
1 parent f65b0c9 commit 8a3e018

File tree

4 files changed

+697
-189
lines changed

4 files changed

+697
-189
lines changed

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
],
2424
"preview": true,
2525
"main": "./out/extension.js",
26-
"activationEvents": [
27-
],
26+
"activationEvents": [],
2827
"contributes": {
2928
"languages": [
3029
{
@@ -43,7 +42,16 @@
4342
{
4443
"language": "wdl",
4544
"scopeName": "source.wdl",
46-
"path": "./syntaxes/wdl.tmGrammar.json"
45+
"path": "./syntaxes/wdl.tmGrammar.json",
46+
"embeddedLanguages": {
47+
"meta.embedded.block.shellscript": "shellscript"
48+
}
49+
}
50+
],
51+
"snippets": [
52+
{
53+
"language": "wdl",
54+
"path": "./snippets/wdl.code-snippets"
4755
}
4856
],
4957
"commands": [

snippets/wdl.code-snippets

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
{
2+
"Create a new struct": {
3+
"prefix": "struct",
4+
"body": [
5+
"struct ${TM_SELECTED_TEXT:${1:MyStruct}} {",
6+
" ${2|Array,Boolean,Directory,File,Float,Int,Map,Object,Pair,String|} ${3:name}",
7+
"}"
8+
],
9+
"description": "Create a new struct"
10+
},
11+
"Create a new task": {
12+
"prefix": "task",
13+
"body": [
14+
"task ${TM_SELECTED_TEXT:${1:my_task}} {",
15+
"",
16+
" command <<<",
17+
" echo \"Hello, world!\"",
18+
" >>>",
19+
"",
20+
" requirements {",
21+
" container: \"ubuntu:latest\"",
22+
" }",
23+
"}"
24+
],
25+
"description": "Create a new task"
26+
},
27+
"Create a new meta section": {
28+
"prefix": "meta",
29+
"body": [
30+
"meta {",
31+
" description: \"${1: This is a description.}\"",
32+
"}"
33+
],
34+
"description": "Create a new meta section"
35+
},
36+
"Create a new parameter meta section": {
37+
"prefix": "parameter-meta",
38+
"body": [
39+
"parameter_meta {",
40+
"}"
41+
],
42+
"description": "Create a new parameter meta section"
43+
},
44+
"Create a new input section": {
45+
"prefix": "input",
46+
"body": [
47+
"input {",
48+
" ${1|Array,Boolean,Directory,File,Float,Int,Map,Object,Pair,String|} ${2:name}",
49+
"}"
50+
],
51+
"description": "Create a new input section"
52+
},
53+
"Create a new output section": {
54+
"prefix": "output",
55+
"body": [
56+
"output {",
57+
" ${1|Array,Boolean,Directory,File,Float,Int,Map,Object,Pair,String|} ${2:name} = $0",
58+
"}"
59+
],
60+
"description": "Create a new output section"
61+
},
62+
"Create a new requirements section": {
63+
"prefix": "requirements",
64+
"body": [
65+
"requirements {",
66+
" container: ${1:\"*\"}",
67+
" cpu: ${2:1}",
68+
" memory: ${3:\"2 GiB\"}",
69+
" gpu: ${4:false}",
70+
" fpga: ${5:false}",
71+
" disks: ${6:\"1 GiB\"}",
72+
" max_retries: ${7:0}",
73+
" return_codes: ${8:0}",
74+
"}"
75+
],
76+
"description": "Create a new requirements section"
77+
},
78+
"Create a new runtime section": {
79+
"prefix": "runtime",
80+
"body": [
81+
"runtime {",
82+
" container: ${1:\"*\"}",
83+
" cpu: ${2:1}",
84+
" memory: ${3:\"2 GiB\"}",
85+
" gpu: ${4:false}",
86+
" fpga: ${5:false}",
87+
" disks: ${6:\"1 GiB\"}",
88+
" max_retries: ${7:0}",
89+
" return_codes: ${8:0}",
90+
"}"
91+
],
92+
"description": "Create a new runtime section"
93+
},
94+
"Create a new hints section": {
95+
"prefix": "hints",
96+
"body": [
97+
"hints {",
98+
" max_cpu: ${1:32}",
99+
" max_memory: ${2:\"32 GiB\"}",
100+
" disks: ${3:\"500 GiB\"}",
101+
" gpu: ${4:0}",
102+
" fpga: ${5:0}",
103+
" short_task: ${6:false}",
104+
" localization_optional: ${7:false}",
105+
" # inputs: TODO (e.g., `input { name: hints { min_length: 3 } }`)",
106+
" # outputs: TODO (e.g., `output { name: hints { max_length: 5 } }`)",
107+
"}"
108+
],
109+
"description": "Create a new hints section"
110+
},
111+
"Create a new complete task": {
112+
"prefix": "complete-task",
113+
"body": [
114+
"task ${TM_SELECTED_TEXT:${1:my_task}} {",
115+
" meta {",
116+
" description: \"${2:This task greets the name passed to the input.}\"",
117+
" }",
118+
"",
119+
" parameter_meta {",
120+
" name: \"${3:The name to say 'hello' to.}\"",
121+
" }",
122+
"",
123+
" input {",
124+
" String name",
125+
" }",
126+
"",
127+
" command <<<",
128+
" echo \"Hello, \\${name}\"",
129+
" >>>",
130+
"",
131+
" output {}",
132+
"",
133+
" requirements {",
134+
" container: \"*\"",
135+
" cpu: 1",
136+
" memory: \"2 GiB\"",
137+
" gpu: false",
138+
" fpga: false",
139+
" disks: \"1 GiB\"",
140+
" max_retries: 0",
141+
" return_codes: 0",
142+
" }",
143+
"",
144+
" hints {",
145+
" max_cpu: 32",
146+
" max_memory: \"32 GiB\"",
147+
" disks: \"500 GiB\"",
148+
" gpu: 0",
149+
" fpga: 0",
150+
" short_task: false",
151+
" localization_optional: false",
152+
" # inputs: TODO (e.g., `input { name: hints { min_length: 3 } }`)",
153+
" # outputs: TODO (e.g., `output { name: hints { max_length: 5 } }`)",
154+
" }",
155+
"}"
156+
],
157+
"description": "Create a new complete task"
158+
},
159+
"Create a call statement": {
160+
"prefix": "call",
161+
"body": [ "call ${0:a_task} {}"],
162+
"description": "Create a call statement"
163+
},
164+
"Create an if statement": {
165+
"prefix": "if",
166+
"body": [
167+
"if (${1:foo}) {",
168+
" $0",
169+
"}"
170+
],
171+
"description": "Create an if statement"
172+
},
173+
"Create a scatter statement": {
174+
"prefix": "scatter",
175+
"body": [
176+
"scatter (${1:foo} in ${2:foos}) {",
177+
" $0",
178+
"}"
179+
],
180+
"description": "Create a scatter statement"
181+
},
182+
"Create a new workflow": {
183+
"prefix": "workflow",
184+
"body": [
185+
"workflow ${TM_SELECTED_TEXT:${1:my_workflow}} {",
186+
"",
187+
"inputs {",
188+
" $1",
189+
"}",
190+
"",
191+
"call ${2:a_task} {",
192+
" $3",
193+
"}",
194+
"",
195+
"",
196+
"outputs {",
197+
" $4",
198+
"}",
199+
],
200+
"description": "Create a new task"
201+
},
202+
"Create a new except comment": {
203+
"prefix": "#@",
204+
"body": ["#@ except: $0"],
205+
"description": "Create a new except comment"
206+
},
207+
}

0 commit comments

Comments
 (0)