-
Notifications
You must be signed in to change notification settings - Fork 230
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
Generate Code from TypeSpec in VSCode #5312
base: main
Are you sure you want to change the base?
Changes from 66 commits
ca3249a
b8468b6
f0c4b89
4691431
539bee9
7779481
05bbef7
41a8796
31ee9e2
6d604d8
406e7f9
a143f0a
a93c8b8
4ba9a3a
ca87267
a14b47e
5534466
92790d6
3a9886c
7fec5be
bddc07b
8c36463
3b820b8
b3d794b
c5e28e1
8b5ec56
3c333d9
dfcc1fb
64af9ad
416a8ce
21536fe
b592c14
c883353
6931980
0c8c284
86372ee
b121717
758ff38
7129527
e96e073
9105874
6f49c5f
bae77bb
f70e9d0
e836b52
97d57de
8dc67ec
ee763ab
792ec1c
95dcef6
99c9ad0
b2e27ca
3b52923
82b1a42
db5d908
77452a0
0e2ab0f
d353b46
0bf3f40
9d7c0b1
88eb4a4
7cec0fb
8af049c
7a96a1c
b0fb151
d528575
ea9c4f1
cdbcc8c
882f14c
3973ad3
ba6b54a
e066e81
303bf9d
86d7822
168d116
128aab5
ab13f86
dd365b4
01c693f
609928b
69fe0bd
9bcc6fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: feature | ||
packages: | ||
- typespec-vscode | ||
--- | ||
|
||
integrate client SDK generation |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the most icons. except java for dark themes. |
chunyu3 marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,104 @@ | |
], | ||
"default": "off", | ||
"description": "Define whether/how the TypeSpec language server should send traces to client. For the traces to show properly in vscode Output, make sure 'Log Level' is also set to 'Trace' so that they won't be filtered at client side, which can be set through 'Developer: Set Log Level...' command." | ||
}, | ||
"typespec.generateCode.emitters": { | ||
"scope": "window", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"language": { | ||
"type": "string", | ||
"enum": [ | ||
".NET", | ||
"Java", | ||
"JavaScript", | ||
"Python", | ||
"Go", | ||
"OpenAPI3", | ||
"ProtoBuf", | ||
"JsonSchema" | ||
], | ||
"description": "Define the language the emitter will emit." | ||
}, | ||
"package": { | ||
"type": "string", | ||
"description": "Define the emitter package.\n\nExample (with version): @typespec/[email protected]\n\nExample (without version): @typespec/http-client-csharp" | ||
}, | ||
"sourceRepo": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. user may not have repo and may want to show other information. How about name it "description" instead of "sourceRepo"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to use |
||
"type": "string", | ||
"description": "Define the source repository of the emitter package." | ||
}, | ||
"requisites": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "Define the requisites of the emitter package." | ||
}, | ||
"kind": { | ||
"type": "string", | ||
"enum": [ | ||
"client", | ||
"server", | ||
"openapi" | ||
], | ||
"description": "Define the emitter kind." | ||
} | ||
} | ||
}, | ||
"default": [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @RodgeFu, looks like we are baking a list of known 1P emitters in the extension packages. We have discussed this being built-in template driven. I would also like to re-review design of the Generate Code flow. I have comments on what's listed in the design doc on this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please check my comment in the doc. thx. |
||
{ | ||
"language": ".NET", | ||
"package": "@typespec/http-client-csharp", | ||
"sourceRepo": "https://github.com/microsoft/typespec/tree/main/packages/http-client-csharp", | ||
"requisites": [ | ||
".NET 8.0 SDK" | ||
], | ||
"kind": "client" | ||
}, | ||
{ | ||
"language": "Java", | ||
"package": "@typespec/http-client-java", | ||
"sourceRepo": "https://github.com/microsoft/typespec/tree/main/packages/http-client-java ", | ||
"requisites": [ | ||
"Java 17 or above", | ||
"Maven" | ||
], | ||
"kind": "client" | ||
}, | ||
{ | ||
"language": "JavaScript", | ||
"package": "@azure-tools/typespec-ts", | ||
"sourceRepo": "https://github.com/Azure/autorest.typescript/tree/main/packages/typespec-ts", | ||
"kind": "client" | ||
}, | ||
{ | ||
"language": "Python", | ||
"package": "@typespec/http-client-python", | ||
"sourceRepo": "https://github.com/microsoft/typespec/tree/main/packages/http-client-python", | ||
"kind": "client" | ||
}, | ||
{ | ||
"language": ".NET", | ||
"package": "@typespec/http-server-csharp", | ||
"sourceRepo": "https://github.com/microsoft/typespec/tree/main/packages/http-server-csharp", | ||
"kind": "server" | ||
}, | ||
{ | ||
"language": "JavaScript", | ||
"package": "@typespec/http-server-javascript", | ||
"sourceRepo": "https://github.com/microsoft/typespec/tree/main/packages/http-server-javascript", | ||
"kind": "server" | ||
}, | ||
{ | ||
"language": "OpenAPI3", | ||
"package": "@typespec/openapi3", | ||
"sourceRepo": "https://github.com/microsoft/typespec/tree/main/packages/openapi3", | ||
"kind": "openapi" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
@@ -141,6 +239,11 @@ | |
"title": "Show Output Channel", | ||
"category": "TypeSpec" | ||
}, | ||
{ | ||
"command": "typespec.generateCode", | ||
"title": "Generate from TypeSpec", | ||
"category": "TypeSpec" | ||
}, | ||
{ | ||
"command": "typespec.createProject", | ||
"title": "Create TypeSpec Project", | ||
|
@@ -152,6 +255,22 @@ | |
"category": "TypeSpec" | ||
} | ||
], | ||
"menus": { | ||
"explorer/context": [ | ||
{ | ||
"command": "typespec.generateCode", | ||
"when": "explorerResourceIsFolder || resourceLangId == typespec", | ||
"group": "code_generation" | ||
} | ||
], | ||
"editor/context": [ | ||
{ | ||
"command": "typespec.generateCode", | ||
"when": "resourceLangId == typespec", | ||
"group": "code_generation" | ||
} | ||
] | ||
}, | ||
"semanticTokenScopes": [ | ||
{ | ||
"scopes": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const StartFileName = "main.tsp"; | ||
chunyu3 marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
Can this wait until I'm back before merging so we can discuss a little more what we want. I do not think this is a good feature to add in this form. The argument for not requiring to learn commands to generate is I feel invalid as you still need to know the language and install anything to get the rest working.
If this instead was just providing a way to add some known emitters and configure them to the tspconfig I think this would be much much better.
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.
Thanks @timotheeguerin .
Emitters will be registered in the VSCode extension settings. We pre-defined default emtters (both client emitters, server emitters for all languages, and the schema emitter also). We will provide a way for customer to register their customized emitter in future.
We will hold this PR merge and we discuss more after you back. Thanks
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.
@timotheeguerin , thanks for looking at the PR in holiday and Merry Christmas!
Below is the spec for the feature (Those user cases with name "Generate XXX from TypeSpec") which should be able to give you more context and the user experience we want to provide. Any feedback is welcome, and we can discuss more when you are back. thanks.
https://microsoft.sharepoint.com/:w:/t/AzureDeveloperExperience/EXfInUWxaOpNpXVtcQOAt4cBoVwvu3tZe3Od__r9vdc8qQ?e=cmyNb0