Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: VS Code snippets #757

Merged
merged 1 commit into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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."
}
}