Skip to content

Commit fd6f432

Browse files
authored
feat: VS Code snippets (#757)
Closes #756 ### Summary of Changes Various snippets for program elements with lengthy syntax.
1 parent f1a052a commit fd6f432

File tree

2 files changed

+89
-1
lines changed

2 files changed

+89
-1
lines changed

packages/safe-ds-vscode/package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@
8686
"editor.wordSeparators": "`~!@#%^&*()-=+[]{}\\|;:'\",.<>/?»«",
8787
"files.trimTrailingWhitespace": true
8888
}
89-
}
89+
},
90+
"snippets": [
91+
{
92+
"language": "safe-ds",
93+
"path": "./snippets/safe-ds.json"
94+
}
95+
]
9096
},
9197
"type": "module",
9298
"main": "dist/extension/mainClient.cjs",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"Import": {
3+
"prefix": ["from", "import"],
4+
"body": ["from $1 import $0"],
5+
"description": "Import of declarations from a package."
6+
},
7+
"Minimal Annotation": {
8+
"prefix": ["minimal-annotation"],
9+
"body": ["annotation ${0:MyAnnotation}"],
10+
"description": "A minimal annotation."
11+
},
12+
"Annotation": {
13+
"prefix": ["annotation"],
14+
"body": ["annotation ${1:MyAnnotation}${2:($3)} ${4:where {$0\\}}"],
15+
"description": "An annotation."
16+
},
17+
"Attribute": {
18+
"prefix": ["attribute"],
19+
"body": ["${1|static |}attr ${2:myAttribute}: $0"],
20+
"description": "An attribute."
21+
},
22+
"Minimal Class": {
23+
"prefix": ["minimal-class"],
24+
"body": ["class ${0:MyClass}"],
25+
"description": "A minimal class."
26+
},
27+
"Class": {
28+
"prefix": ["class"],
29+
"body": ["class ${1:MyClass}${2:<$3>}${4:($5)} ${6:sub $7} ${8:where {$9\\}} ${10:{$0\\}}"],
30+
"description": "A class."
31+
},
32+
"Enum": {
33+
"prefix": ["enumeration"],
34+
"body": ["enum ${1:MyEnum} {", " $0", "}"],
35+
"description": "An enumeration."
36+
},
37+
"Minimal Function": {
38+
"prefix": ["minimal-function"],
39+
"body": ["fun ${1:myFunction}($0)"],
40+
"description": "A minimal function."
41+
},
42+
"Function": {
43+
"prefix": ["function", "method"],
44+
"body": ["${1|static |}fun ${2:myFunction}${3:<$4>}($5) ${6:-> ($7)} ${8:where {$0\\}}"],
45+
"description": "A function."
46+
},
47+
"Schema": {
48+
"prefix": ["schema"],
49+
"body": ["schema ${1:MySchema} {", " $0", "}"],
50+
"description": "A schema."
51+
},
52+
"Pipeline": {
53+
"prefix": ["pipeline"],
54+
"body": ["pipeline ${1:MyPipeline} {", " $0", "}"],
55+
"description": "A pipeline."
56+
},
57+
"Segment": {
58+
"prefix": ["segment"],
59+
"body": ["${1|internal ,private |}segment ${2:mySegment}($3) ${4:-> ($5)} {", " $0", "}"],
60+
"description": "A segment."
61+
},
62+
"Block Lambda": {
63+
"prefix": ["block-lambda"],
64+
"body": ["($1) -> {", " $0", "}"],
65+
"description": "A lambda that executes a list of statements."
66+
},
67+
"Expression Lambda": {
68+
"prefix": ["expression-lambda"],
69+
"body": ["($1) -> $0"],
70+
"description": "A lambda that returns a single expression."
71+
},
72+
"Block Comment": {
73+
"prefix": ["block-comment"],
74+
"body": ["/*", " * $0", " */"],
75+
"description": "A block comment."
76+
},
77+
"Documentation Comment": {
78+
"prefix": ["documentation-comment"],
79+
"body": ["/**", " * $0", " */"],
80+
"description": "A documentation comment."
81+
}
82+
}

0 commit comments

Comments
 (0)