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

[vs-code-extension] add basic snippets for typespec #4737

Merged
merged 11 commits into from
Oct 23, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- typespec-vscode
---

Add basic snippets for typespec
1 change: 1 addition & 0 deletions packages/typespec-vscode/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ dist/test/
!ThirdPartyNotices.txt
!LICENSE
!icons/
!snippets.json
9 changes: 8 additions & 1 deletion packages/typespec-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"publisher": "typespec",
"displayName": "TypeSpec for VS Code",
"categories": [
"Programming Languages"
"Programming Languages",
"Snippets"
],
"type": "module",
"main": "./dist/src/extension.cjs",
Expand Down Expand Up @@ -141,6 +142,12 @@
}
}
}
],
"snippets": [
{
"language": "typespec",
"path": "./snippets.json"
}
]
},
"scripts": {
Expand Down
37 changes: 37 additions & 0 deletions packages/typespec-vscode/snippets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"Alias": {
"prefix": "alias",
"body": "alias ${1:AliasName} = ${0:Expression};",
timotheeguerin marked this conversation as resolved.
Show resolved Hide resolved
archerzz marked this conversation as resolved.
Show resolved Hide resolved
"description": "Alias definition"
},
"Enum": {
"prefix": "enum",
"body": "enum ${1:EnumName} {\n ${0:Value},\n}",
RodgeFu marked this conversation as resolved.
Show resolved Hide resolved
"description": "Enum definition"
},
"Interface": {
"prefix": "interface",
"body": "interface ${1:InterfaceName} {\n ${2:member}(${3:parameters}): ${0:ReturnType};\n}",
"description": "Interface definition"
},
"Model": {
"prefix": "model",
"body": "model ${1:ModelName} {\n ${2:propertyName}: ${0:propertyType};\n}",
"description": "Model definition"
},
"Namespace": {
"prefix": "namespace",
"body": "namespace ${1:NamespaceName} {\n ${0:member}\n}",
RodgeFu marked this conversation as resolved.
Show resolved Hide resolved
"description": "Namespace definition"
},
"Operation": {
"prefix": ["op", "operation"],
"body": "operation ${1:OperationName}(${2:parameters}): ${0:ReturnType};",
archerzz marked this conversation as resolved.
Show resolved Hide resolved
"description": "Operation definition"
},
"Union": {
"prefix": "union",
"body": "union ${1:UnionName} = ${2:Variant1} | ${0:Variant2};",
"description": "Named union definition"
}
}
Loading