-
Notifications
You must be signed in to change notification settings - Fork 207
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
base: main
Are you sure you want to change the base?
[vs-code-extension] add basic snippets for typespec #4737
Conversation
- add snippets for typespec basic constructs - package snippets within vs code extension part of microsoft#4559
All changed packages have been documented.
|
You can try these changes here
|
- typespec-vscode | ||
--- | ||
|
||
feat(vscode): add basic snippets for typespec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please don't name things like that this ends up in the changelog. THis should be descriptive markdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for the pr title in general we don't use that git changelog system so its not really necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated changeset and pr title accordingly
{ | ||
"Alias": { | ||
"prefix": "alias", | ||
"body": "alias ${1:AliasName} = ${0:Expression};", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know much about snippet but shouldn't those numbers be in order? Do they not map to which one gets filled first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sequence starts from 1
, 2
...
0
is a special index which is always the last one to reach. And when you press Tab
to 0
, the iteration ends.
If there is no 0
, then pressing Tab
can start over again when you reach the last placeholder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put 0
in all snippets, because those snippets have placeholders which may require free-style input, not just a single construct. For example, in the alias definition, the Expression
could be a quite long input instead of just a model name.
}, | ||
"Operation": { | ||
"prefix": ["op", "operation"], | ||
"body": "operation ${1:OperationName}(${2:parameters}): ${0:ReturnType};", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe for operation, we can change the template to
"body": "operation ${1:OperationName}(${2:parameters}): ${0:ReturnType};", | |
"body": "operation ${1:OperationName}(${0:parameters}): ${2:ReturnType};", |
since the parameters
could be multiple inputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, the ReturnType
could be a union.
part of #4559