-
Notifications
You must be signed in to change notification settings - Fork 243
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
Compiler/Emitter behavior consistency and improvement #5660
Comments
Hi @allenjzhang maybe we should also design pages for those known bad states (defined either in compiler/TCGC/language emitters) and put them inside To build this page, I would like to propose that we do it through automation inside of writing docs from scratches. Such as those reference docs for our decorators, we write them inside our code as comments, and there is a tool to extract them out as a doc page. We should do the same for those diagnostic error/warning pages. |
@ArcturusZhang we actually already have that where a diagnostic can define a url with additional documentation which then can be link in the terminal/ide. (Realized now that we never actually linked it in the website and we really need to go and do it for most diagnostic but here is an example https://github.com/microsoft/typespec/blob/main/website/src/content/docs/docs/standard-library/diags/triple-quote-indent.md I think the point of those are to define a detailed document that shows how to resolve the issue and having to write those inline means they probably will be very limited. |
sure - having a page for each diagnostic is great. |
Current stateThe current state is that emitters and library should NOT log anything to stdout or stderr. Only things used should be
And by default the compiler would just log that it completed successfully, keeping things clean. If a library or an emitter throws an error it is reported as a bug to the user. Throwing errors should be avoided as much as possible as they prevent any additional collection of diagnostics. IssueThis was fine when openapi was the only emitter you might use. Now with client emitters that create a lot more output and might be significantly slower to run and the ability to run multiple emitters together leaves the user wondering what is happening. Proposal
When an emitter is completed it stays with the spinner replaced with a checkmark and showing the output dir
Examples
tsp compile .
⠼ Compiling...
tsp compile .
✓ @typespec/openapi3 ./tsp-output/schemas/
./tsp-output/schemas/openapi.v1.yaml
./tsp-output/schemas/openapi.v2.yaml
✓ @typespec/http-client-csharp ./tsp-output/clients/csharp
./tsp-output/clients/csharp/proj.csproj
./tsp-output/clients/csharp/FooClient.cs
./tsp-output/clients/csharp/models/A.cs
./tsp-output/clients/csharp/models/B.cs
tsp compile . --trace *
import-resolution Resolving file a.tsp
openapi3.emitSchema Emitting schema A
openapi3.emitSchema Emitting schema B
http-client-csharp.emittingClass A
http-client-csharp.emittingClass B
✓ @typespec/openapi3 ./tsp-output/schemas/
./tsp-output/schemas/openapi.v1.yaml
./tsp-output/schemas/openapi.v2.yaml
✓ @typespec/http-client-csharp ./tsp-output/clients/csharp
./tsp-output/clients/csharp/proj.csproj
./tsp-output/clients/csharp/FooClient.cs
./tsp-output/clients/csharp/models/A.cs
./tsp-output/clients/csharp/models/B.cs |
@timotheeguerin It does look nicer in your proposal, but in our emitters we have some more technical difficulties. But in our implementation, quite a few emitters have a backend written in their own language - for instance in our In the old autorest, we used JRPC. What is your current suggestion? |
Ah, yeah I didn't see this being part of this proposal. The idea thrown around to is preciously was a one way stdout rpc for specific things like diagnostics. For emitting files I am not sure going through the rpc was a great idea in autorest but we could at least have a reporter |
BTW @timotheeguerin I understand the diagnostics in your proposal, we have a page for it here: https://typespec.io/docs/extending-typespec/diagnostics/ I am planning to work on a refactor in .net emitter to unify the way of writing logs and diagnostics, this could be important to align your proposal as the first step |
yep this is it. Goal is that every log belongs to an area(Starting with your library ideally) so user can decide to enable tracing for only a certain part. |
est: 5 |
Compiler improvements:
Consistent behavior among emitters
File a bug
message.More to add?
The text was updated successfully, but these errors were encountered: