Source Generators on save #59388
-
|
Is it possible to run source generators on save only, not real-time? The IDE experience degrades a lot with the frequent use of source generators |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 20 replies
-
We get this feedback often, but our observation over time is this is not true for cases where the source generator was optimally written using Roslyn's new APIs. The request to only run the source generator on save thus eventually reduces to a request to require users to opt-in to a work around for an inefficiently written source generator. It would be better to fix the source generator itself, thus not requiring a new user option and not having the performance problem. If you can provide more information about the goals of the source generator and the reason why you believe it is causing performance problems, we will likely be able to provide tips for correcting it. |
Beta Was this translation helpful? Give feedback.
-
|
I quite concur with the ask here. The default should have been to run a source generator only on save, not on every single key strokes. Even when using incremental source generator, it doesn't help when you see your generator running just because you changed a whitespace in a comment on the file and you are not done with your changes. I don't know what is the real use case for realtime changes on every single key stroke, but I can't think of any for all the use cases I have been using it so far. |
Beta Was this translation helpful? Give feedback.
-
|
I have proposed an extension of this issue at #64173 |
Beta Was this translation helpful? Give feedback.
We get this feedback often, but our observation over time is this is not true for cases where the source generator was optimally written using Roslyn's new APIs. The request to only run the source generator on save thus eventually reduces to a request to require users to opt-in to a work around for an inefficiently written source generator. It would be better to fix the source generator itself, thus not requiring a new user option and not having the performance problem.
If you can provide more information about the goals of the source generator and the reason why you believe it is causing performance problems, …