Skip to content

Commit

Permalink
feat: VS Code snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Nov 11, 2023
1 parent f1a052a commit 21eb520
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/safe-ds-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@
"editor.wordSeparators": "`~!@#%^&*()-=+[]{}\\|;:'\",.<>/?»«",
"files.trimTrailingWhitespace": true
}
}
},
"snippets": [
{
"language": "safe-ds",
"path": "./snippets/safe-ds.json"
}
]
},
"type": "module",
"main": "dist/extension/mainClient.cjs",
Expand Down
82 changes: 82 additions & 0 deletions packages/safe-ds-vscode/snippets/safe-ds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"Import": {
"prefix": ["from", "import"],
"body": ["from $1 import $0"],
"description": "Import of declarations from a package."
},
"Minimal Annotation": {
"prefix": ["minimal-annotation"],
"body": ["annotation ${0:MyAnnotation}"],
"description": "A minimal annotation."
},
"Annotation": {
"prefix": ["annotation"],
"body": ["annotation ${1:MyAnnotation}${2:($3)} ${4:where {$0\\}}"],
"description": "An annotation."
},
"Attribute": {
"prefix": ["attribute"],
"body": ["${1|static |}attr ${2:myAttribute}: $0"],
"description": "An attribute."
},
"Minimal Class": {
"prefix": ["minimal-class"],
"body": ["class ${0:MyClass}"],
"description": "A minimal class."
},
"Class": {
"prefix": ["class"],
"body": ["class ${1:MyClass}${2:<$3>}${4:($5)} ${6:sub $7} ${8:where {$9\\}} ${10:{$0\\}}"],
"description": "A class."
},
"Enum": {
"prefix": ["enumeration"],
"body": ["enum ${1:MyEnum} {", " $0", "}"],
"description": "An enumeration."
},
"Minimal Function": {
"prefix": ["minimal-function"],
"body": ["fun ${1:myFunction}($0)"],
"description": "A minimal function."
},
"Function": {
"prefix": ["function", "method"],
"body": ["${1|static |}fun ${2:myFunction}${3:<$4>}($5) ${6:-> ($7)} ${8:where {$0\\}}"],
"description": "A function."
},
"Schema": {
"prefix": ["schema"],
"body": ["schema ${1:MySchema} {", " $0", "}"],
"description": "A schema."
},
"Pipeline": {
"prefix": ["pipeline"],
"body": ["pipeline ${1:MyPipeline} {", " $0", "}"],
"description": "A pipeline."
},
"Segment": {
"prefix": ["segment"],
"body": ["${1|internal ,private |}segment ${2:mySegment}($3) ${4:-> ($5)} {", " $0", "}"],
"description": "A segment."
},
"Block Lambda": {
"prefix": ["block-lambda"],
"body": ["($1) -> {", " $0", "}"],
"description": "A lambda that executes a list of statements."
},
"Expression Lambda": {
"prefix": ["expression-lambda"],
"body": ["($1) -> $0"],
"description": "A lambda that returns a single expression."
},
"Block Comment": {
"prefix": ["block-comment"],
"body": ["/*", " * $0", " */"],
"description": "A block comment."
},
"Documentation Comment": {
"prefix": ["documentation-comment"],
"body": ["/**", " * $0", " */"],
"description": "A documentation comment."
}
}

0 comments on commit 21eb520

Please sign in to comment.